Skip to main content
POST
/
external
/
invoice
/
upsert
cURL
curl --request POST \
  --url https://api.valyx.com/external/invoice/upsert \
  --header 'Content-Type: application/json' \
  --header 'X-Valyx-Signature: <x-valyx-signature>' \
  --data '
{
  "invoice": {
    "invoiceId": "<string>",
    "invoiceNumber": "<string>",
    "invoiceSubtotal": 123,
    "invoiceAdjustedAmount": 0,
    "invoicePaidAmount": 0,
    "invoiceTotal": 0,
    "invoiceCurrency": "INR",
    "invoiceDate": {},
    "invoiceDueDate": {},
    "promiseToPayDate": {},
    "invoiceTax": {
      "total": 0,
      "gstTax": {
        "totalGst": 0,
        "totalGstRate": 0,
        "cgst": 0,
        "cgstRate": 0,
        "sgst": 0,
        "sgstRate": 0,
        "igst": 0,
        "igstRate": 0
      },
      "cessTax": {
        "cess": 0,
        "cessRate": 0
      },
      "serviceTax": {
        "serviceTax": 0,
        "serviceTaxRate": 0
      },
      "tdsTax": {
        "tds": 0,
        "tdsRate": 0
      },
      "otherTaxes": [
        {
          "name": "<string>",
          "genericTax": 0,
          "genericTaxRate": 0
        }
      ],
      "cgst": 123,
      "sgst": 123,
      "igst": 123,
      "tds": 0
    },
    "discount": {
      "amount": 0,
      "percentage": 0,
      "isPostTax": false
    },
    "discounts": [
      {
        "amount": 0,
        "percentage": 0,
        "isPostTax": false
      }
    ],
    "discountSplitByWeight": true,
    "invoiceAcceptanceStatus": "PENDING",
    "customerId": "<string>",
    "customerDetails": {
      "buyerId": "<string>",
      "isManuallyCreated": true,
      "taxIdentifiers": [
        {
          "value": "<string>",
          "type": "GSTIN"
        }
      ],
      "companyId": "<string>",
      "name": "<string>",
      "alias": "<string>",
      "registeredAddress": {
        "line1": "<string>",
        "line2": "<string>",
        "state": "<string>",
        "city": "<string>",
        "country": "<string>",
        "zipCode": "<string>"
      },
      "addresses": [
        {
          "line1": "<string>",
          "line2": "<string>",
          "state": "<string>",
          "city": "<string>",
          "country": "<string>",
          "zipCode": "<string>"
        }
      ],
      "contactsData": [
        {
          "id": "<string>",
          "name": "<string>",
          "primaryPhone": "<string>",
          "primaryEmail": "<string>",
          "role": "<string>"
        }
      ],
      "ownersData": [
        {
          "id": "<string>",
          "name": "<string>",
          "primaryPhone": "<string>",
          "primaryEmail": "<string>",
          "role": "<string>",
          "isRegistered": false
        }
      ],
      "stateCode": "<string>",
      "countryCode": "IN",
      "country": "<string>",
      "primaryPhone": "<string>",
      "primaryEmail": "<string>",
      "customerContactPerson": "<string>",
      "currency": "INR",
      "currencyId": "<string>",
      "tags": {},
      "metaData": {},
      "customerStatus": "PROSPECT",
      "upcomingCustomerStatus": "PROSPECT",
      "upcomingCustomerStatusChangeDate": "2023-12-25",
      "upcomingCustomerStatusChangeReason": "<string>",
      "upcomingCustomerStatusChangeByUserid": "<string>",
      "erpId": "<string>"
    },
    "customerName": "<string>",
    "invoiceType": "<string>",
    "supplyStateCode": "<string>",
    "placeOfSupply": "<string>",
    "invoiceCurrencyId": "<string>",
    "lineItems": [
      {
        "subTotal": 0,
        "total": 0,
        "lineItemDetails": {
          "name": "<string>",
          "taxRate": 123,
          "pricePerItem": 0,
          "hsnOrSacCode": "<string>",
          "description": "<string>",
          "companyId": "<string>",
          "erpId": "<string>",
          "lineItemId": "<string>"
        },
        "tax": {
          "total": 0,
          "gstTax": {
            "totalGst": 0,
            "totalGstRate": 0,
            "cgst": 0,
            "cgstRate": 0,
            "sgst": 0,
            "sgstRate": 0,
            "igst": 0,
            "igstRate": 0
          },
          "cessTax": {
            "cess": 0,
            "cessRate": 0
          },
          "serviceTax": {
            "serviceTax": 0,
            "serviceTaxRate": 0
          },
          "tdsTax": {
            "tds": 0,
            "tdsRate": 0
          },
          "otherTaxes": [
            {
              "name": "<string>",
              "genericTax": 0,
              "genericTaxRate": 0
            }
          ],
          "cgst": 123,
          "sgst": 123,
          "igst": 123,
          "tds": 0
        },
        "discount": {
          "amount": 0,
          "percentage": 0,
          "isPostTax": false
        },
        "quantity": 1
      }
    ],
    "referenceType": "<string>",
    "referenceId": "<string>",
    "referenceText": "<string>",
    "eInvoiceQrCode": "<string>",
    "irnNumber": "<string>",
    "companyId": "<string>",
    "tags": {},
    "metaData": {},
    "sort": "<string>",
    "invoiceRoundingConfig": {
      "type": "NEAREST",
      "roundingDirection": "UP",
      "isPostTax": true,
      "decimalPlace": 2
    },
    "prepaidAmount": 123,
    "createInvoiceAdjustments": [
      {
        "isPostTax": true,
        "amount": 123,
        "name": "<string>",
        "reference": "<string>"
      }
    ],
    "erpId": "<string>"
  }
}
'
{}

Headers

X-Valyx-Signature
string
required

Auth key for fetching ledger entries

Body

application/json
invoice
object

Response

200 - application/json

Success

The response is of type object.