Generate E-Invoice
Last updated
Last updated
Generate a valid E-Invoice with JSON payload and send it to ZATCA for clearance or reporting.
POST
{{BASE_URL}}/v2/einvoices/generate
Replace the {{BASE_URL}}
with the one mentioned here based on whether you are using sandbox or production.
Rate Limit : 1000 API requests per minute
Parameter | Data Type | Field Validations | Description |
---|---|---|---|
There are no path parameters for this API.
There are no query parameters for this API.
This is a custom object of key-value pairs that can be used to display custom fields in custom output PDF templates or in certain reports. For example:
{
"country_of_origin": "IN",
"total_containers": "3"
}
{
"DeviceId": "{{DeviceId}}",
"EInvoice": {
"ProfileID": "reporting:1.0",
"ID": {
"en": "Test179",
"ar": "Test179"
},
"InvoiceTypeCode": {
"name": "0100000",
"value": "388"
},
"IssueDate": "2023-10-27",
"IssueTime": "12:15:48",
"Delivery": [
{
"ActualDeliveryDate": "2023-10-27",
"LatestDeliveryDate": "2023-10-27"
}
],
"BillingReference": [
{
"InvoiceDocumentReference": {
"ID": {
"ar": null,
"en": "156166151"
}
}
}
],
"OrderReference": {
"ID": {
"ar": null,
"en": "161313031"
}
},
"ContractDocumentReference": [
{
"ID": {
"ar": null,
"en": "1771313066"
}
}
],
"DocumentCurrencyCode": "USD",
"TaxCurrencyCode": "SAR",
"AccountingSupplierParty": {
"Party": {
"PartyLegalEntity": {
"RegistrationName": {
"en": "ClearTax LCC",
"ar": "كليرتاكس ذ.م.م"
}
},
"PartyTaxScheme": {
"CompanyID": "{{vat}}",
"TaxScheme": {
"ID": "VAT"
}
},
"PartyIdentification": {
"ID": {
"schemeID": "CRN",
"value": "1010182239"
}
},
"PostalAddress": {
"StreetName": {
"en": "AlAlmin Street",
"ar": "شارع العلمين"
},
"AdditionalStreetName": {
"en": null,
"ar": null
},
"BuildingNumber": {
"en": "6623",
"ar": "6623"
},
"PlotIdentification": {
"en": "2892",
"ar": "2892"
},
"CityName": {
"en": "Riyadh",
"ar": "الرياض"
},
"CitySubdivisionName": {
"en": "Al Shohda Dist.",
"ar": "حي الشهداء"
},
"PostalZone": "13241",
"CountrySubentity": {
"en": "Riyadh Region",
"ar": "منطقة الرياض"
},
"Country": {
"IdentificationCode": "SA"
}
}
}
},
"AccountingCustomerParty": {
"Party": {
"PartyLegalEntity": {
"RegistrationName": {
"en": "ALMARAI COMPANY",
"ar": " شركة المراعي"
}
},
"PartyTaxScheme": {
"CompanyID": "{{buyervat}}",
"TaxScheme": {
"ID": "VAT"
}
},
"PartyIdentification": null,
"PostalAddress": {
"StreetName": {
"en": "STREET NAME EN:Riyadh1",
"ar": "أسم الش"
},
"AdditionalStreetName": null,
"BuildingNumber": {
"en": "1212",
"ar": "1212"
},
"PlotIdentification": {
"en": "1210",
"ar": "1210"
},
"CityName": {
"en": "CITY NAME EN",
"ar": "أسم المدينة"
},
"CitySubdivisionName": {
"en": "CITY S.DIVISION EN ",
"ar": "المدينة - قطاع "
},
"PostalZone": "12345",
"CountrySubentity": {
"en": "COUNTRY EN",
"ar": "COUNTRY EN"
},
"Country": {
"IdentificationCode": "SA"
}
}
}
},
"InvoiceLine": [
{
"ID": "1",
"Item": {
"Name": {
"en": "Item A",
"ar": "البند أ"
},
"BuyersItemIdentification": {
"ID": {
"en": "PRD789",
"ar": null
}
},
"SellersItemIdentification": {
"ID": {
"en": "ITM123",
"ar": null
}
},
"StandardItemIdentification": {
"ID": {
"en": "9067845",
"ar": null
}
},
"ClassifiedTaxCategory": {
"ID": "S",
"Percent": "15.00",
"TaxScheme": {
"ID": "VAT"
}
}
},
"Price": {
"AllowanceCharge": {
"ChargeIndicator": "false",
"BaseAmount": {
"currencyID": "USD",
"value": "55.00"
},
"Amount": {
"currencyID": "USD",
"value": "5"
}
},
"PriceAmount": {
"currencyID": "USD",
"value": "50.00"
},
"BaseQuantity": {
"unitCode": "HMO",
"value": "1"
}
},
"InvoicedQuantity": {
"unitCode": "HMO",
"value": "10"
},
"AllowanceCharge": [
{
"ChargeIndicator": "false",
"BaseAmount": {
"currencyID": "USD",
"value": "500"
},
"MultiplierFactorNumeric": "20",
"Amount": {
"currencyID": "USD",
"value": "100"
},
"AllowanceChargeReason": {
"ar": "خصم",
"en": "Discount"
},
"AllowanceChargeReasonCode": null
}
],
"LineExtensionAmount": {
"currencyID": "USD",
"value": "400.00"
},
"TaxTotal": {
"TaxAmount": {
"currencyID": "USD",
"value": "60.00"
},
"RoundingAmount": {
"currencyID": "USD",
"value": "460.00"
}
}
},
{
"ID": "2",
"Item": {
"Name": {
"en": "Item B",
"ar": "البند ب"
},
"ClassifiedTaxCategory": {
"ID": "S",
"Percent": "15.00",
"TaxScheme": {
"ID": "VAT"
}
}
},
"Price": {
"PriceAmount": {
"currencyID": "USD",
"value": "300.00"
}
},
"InvoicedQuantity": {
"value": "2"
},
"LineExtensionAmount": {
"currencyID": "USD",
"value": "600.00"
},
"TaxTotal": {
"TaxAmount": {
"currencyID": "USD",
"value": "90.00"
},
"RoundingAmount": {
"currencyID": "USD",
"value": "690.00"
}
}
},
{
"ID": "3",
"Item": {
"Name": {
"en": "Item C",
"ar": "البند ج"
},
"ClassifiedTaxCategory": {
"ID": "Z",
"Percent": "0.00",
"TaxScheme": {
"ID": "VAT"
}
}
},
"Price": {
"PriceAmount": {
"currencyID": "USD",
"value": "50.00"
}
},
"InvoicedQuantity": {
"value": "2"
},
"LineExtensionAmount": {
"currencyID": "USD",
"value": "100.00"
},
"TaxTotal": {
"TaxAmount": {
"currencyID": "USD",
"value": "0.00"
},
"RoundingAmount": {
"currencyID": "USD",
"value": "100.00"
}
}
},
{
"ID": "4",
"Item": {
"Name": {
"en": "Prepayment adjustment",
"ar": "تعديل الدفع المسبق"
},
"ClassifiedTaxCategory": {
"ID": "S",
"Percent": "15.00",
"TaxScheme": {
"ID": "VAT"
}
}
},
"Price": {
"PriceAmount": {
"currencyID": "USD",
"value": "0.00"
}
},
"DocumentReference": {
"ID": "Advance-test100",
"UUID": "5a8a6b8c-2712-4032-9c3a-5e1bc7243e7d",
"IssueDate": "2023-08-01",
"IssueTime": "12:15:48",
"InvoiceTypeCode": "386"
},
"InvoicedQuantity": {
"unitCode": "EA",
"value": "0.00"
},
"LineExtensionAmount": {
"currencyID": "USD",
"value": "0.00"
},
"TaxTotal": {
"TaxAmount": {
"value": "0.00",
"currencyID": "USD"
},
"RoundingAmount": {
"currencyID": "USD",
"value": "0.00"
},
"TaxSubtotal": [
{
"TaxableAmount": {
"value": "86.96",
"currencyID": "USD"
},
"TaxAmount": {
"value": "13.04",
"currencyID": "USD"
},
"TaxCategory": {
"ID": "S",
"Percent": "15.00",
"TaxScheme": {
"ID": "VAT"
},
"TaxExemptionReasonCode": "",
"TaxExemptionReason": {
"ar": "",
"en": ""
}
}
}
]
}
}
],
"AllowanceCharge": [
{
"ChargeIndicator": "false",
"BaseAmount": {
"currencyID": "USD",
"value": "1000"
},
"MultiplierFactorNumeric": "10",
"Amount": {
"currencyID": "USD",
"value": "100"
},
"TaxCategory": {
"ID": "S",
"Percent": "15",
"TaxScheme": {
"ID": "VAT"
}
}
}
],
"TaxTotal": [
{
"TaxAmount": {
"currencyID": "SAR",
"value": "25.01"
}
},
{
"TaxAmount": {
"currencyID": "USD",
"value": "135.00"
},
"TaxSubtotal": [
{
"TaxableAmount": {
"currencyID": "USD",
"value": "900.00"
},
"TaxAmount": {
"currencyID": "USD",
"value": "135.00"
},
"TaxCategory": {
"ID": "S",
"Percent": "15.00",
"TaxScheme": {
"ID": "VAT"
}
}
},
{
"TaxableAmount": {
"currencyID": "USD",
"value": "100.00"
},
"TaxAmount": {
"currencyID": "USD",
"value": "0"
},
"TaxCategory": {
"ID": "Z",
"Percent": "0.00",
"TaxScheme": {
"ID": "VAT"
},
"TaxExemptionReasonCode": "VATEX-SA-34-4",
"TaxExemptionReason": {
"en": "Supply of a qualifying means of transport.",
"ar": null
}
}
}
]
}
],
"LegalMonetaryTotal": {
"LineExtensionAmount": {
"currencyID": "USD",
"value": "1100"
},
"AllowanceTotalAmount": {
"currencyID": "USD",
"value": "100"
},
"TaxExclusiveAmount": {
"currencyID": "USD",
"value": "1000.00"
},
"TaxInclusiveAmount": {
"currencyID": "USD",
"value": "1135.00"
},
"PrepaidAmount": {
"currencyID": "USD",
"value": "100.00"
},
"PaybleRoundingAmount": {
"currencyID": "USD",
"value": "0"
},
"PayableAmount": {
"currencyID": "USD",
"value": "1035.00"
}
},
"PaymentMeans": [
{
"PaymentMeansCode": 10,
"InstructionNote": {
"en": "",
"ar": ""
},
"PayeeFinancialAccount": {
"PaymentNote": {
"en": "",
"ar": ""
}
}
}
],
"Note": {
"en": "This is a computer generated invoice.",
"ar": null
}
}
}
Standard (B2B)
Simplified (B2C)
If QrCodeStatus
is GENERATED, then the invoice can be issued.
If InvoiceStatus
is CLEARED or REPORTED or ACCEPTEDWITHWARNING, then no further action is required. NOT_SUBMITTED may be returned only in the case of Excel upload on the Web UI. Else, an invoice with valid data needs to be sent to ClearTax.
Success for Simplified Document - HTTP Status Code - 200
{
"DeviceId": "625410e387173015f7e5a4c6",
"Status": "GENERATED",
"QrCodeStatus": "GENERATED",
"InvoiceStatus": "REPORTED",
"QRCode": "MjAsSIy1….",
"RawQRCode": "ARlBb….",
"InvoiceXml": "ASsdfkf...",
"UUID": "03779160-c140-4a32-9f9a-7b429149c0ef",
"ICV": "61",
"PIH": "KILyvZqPxblzStkif5UsaEtMhLDZUgU/VudKsBFxQN0=",
"InvoiceHash": "HDlSmFWBE+9LHLrg6X0moqr3fQU677tFbrITarslOZI=",
"InvoiceType": "INV",
"InvoiceNumber": "315",
"IssueDate": "2021-04-25",
"IssueTime": "16:42:25",
"GeneratedDate": "2021-04-25",
"GeneratedTime": "16:42:25",
"SellerVatNumber": "300492946900003",
"BuyerVatNumber": null,
"ErrorList": [],