ClearTax Docs
Subscribe for Updates
  • Introduction to ClearTax APIs
  • ☁️Clear Finance Cloud
    • Introduction to Clear Finance Cloud
    • Learn Clear Finance Cloud Basics
      • API client
      • Access token
      • FTP client
      • How to get Custom Upload Template ID?
    • CFC API Reference
      • Resources and Masters
        • Sale Document Line Object
        • Purchase Document Line Object
      • Generate Access Token API
      • Ingestion API
        • Ingest Documents via File
          • Get Pre-signed URL
          • Upload File to Storage
          • Trigger File Ingestion
          • Get File Ingestion Status
        • (Deprecated) Ingest Documents via JSON
    • Notifications
  • 🇮🇳GLS API
    • GLS API Reference
      • Resources and Masters
      • Advanced Ingestion API Reference
        • Get Pre-signed URL
        • Upload File to Storage
        • Create Ingestion Activity
        • Get Ingestion Activity Status
  • 🇮🇳GST API
    • Introduction to GST API
    • GST 2.0 API Reference
      • Upload Documents
    • GST FTP Magnet
  • 🇮🇳Max ITC API
    • Introduction to Max ITC API
    • Getting Started with Max ITC API
    • Max ITC API Reference
      • Resources and Masters
        • Input and output templates
        • Error Code Master
        • Learn Max ITC API Architecture
      • Max ITC APIs
        • Fetch Max ITC Configuration
        • Upload Purchase Documents
          • Ingest PR via File
          • (Deprecated) Ingest PR via JSON
        • Trigger Max ITC Workflow
        • Get Max ITC Results
        • Postman Collection
    • Max ITC FTP Magnet
  • 🇮🇳TDS API
    • Introduction to TDS API
    • TDS API Reference
      • Resources and Masters
        • Deduction Document Line Objects
        • Output Template(Error)
      • TDS APIs
        • Upload Deductions
          • Ingest Deductions via File
            • Get Pre-signed URL
            • Upload File to Storage
            • Trigger File Ingestion
            • Get File Ingestion Status
          • (Deprecated) Ingest Deductions via JSON
  • 🇮🇳E-Invoicing API
    • Introduction to E-Invoicing API
    • Learn E-Invoicing API Basics
      • How to get E-Invoicing User Auth Token?
      • How to scan the E-Invoice QR code?
      • How to add GSTIN to E-Invoicing?
        • Clear IRP API Credentials
    • Learn E-waybill API Basics
    • E-Invoicing API Reference
      • Setting up your account
      • Clear Schema
        • Generate IRN
        • Cancel IRN
        • Get E-Invoice PDF
        • Get E-Invoice by IRN
        • Generate E-Waybill by IRN
        • Generate E-Waybill for Non-IRN documents
        • Bulk Generate E-Waybill for Non-IRN documents
        • Cancel E-Waybill
        • Get E-Waybill PDF
        • Update E-Waybill Transporter ID
        • Update E-Waybill Part-B
        • Extend E-Waybill Validity
        • Generate/Regenerate Consolidated EWB
        • Get Consolidated EWB PDF
        • Initiate Multi-Vehicle E-Waybills
        • Update EWB Status from NIC
        • Download E-waybills by Others
        • Get E-Waybill Download Status
        • Get E-Waybills
        • Get latest E-Waybill status from Government
        • Generate B2C Payment QR Code
          • Generate B2C Payment QR Code (Lite)
        • Get Signed PDF
        • Sign PDF API Base 64 Encoded
        • Send an E-Invoice via Email
        • Get Invoice Details
      • Government Schema
        • Generate IRN
        • Cancel IRN
        • Get Invoice by IRN
        • Generate E-Waybill by IRN
      • Resources and Masters
        • E-Invoice Object
        • Country Code Master
        • State Code Master
        • Pincode Master
        • Pincode State Mapping Pattern
        • Port Code Master
        • Currency Code Master
        • UQC Master
        • Tax Rates
        • Error Codes
    • E-Invoicing FTP Magnet
  • 🇮🇳Invoicing API
    • Invoicing API Reference
      • Create an Invoice
      • Create Document (Non-Sale)
      • Download PDF of a Document
      • Get Document details
      • Resources and Master
        • Country Master
        • State Master
        • Pincode Master
        • Port Master
        • Currency Master
        • Unit Master
        • Document Types
        • Supply Types
  • 🇲🇾E-INVOICING MALAYSIA API
    • E-Invoicing Malaysia API Reference
      • Resources and Masters
        • Error resolution guide
        • Frequently asked questions (FAQs)
        • E-Invoice Object
      • Generate Access Token API
      • Malaysia E-Invoicing APIs
        • Generate E-Invoice for a Document
        • Status Check for Submitted E-Invoice
        • Cancel E-Invoice
        • Upload E-Invoice
        • Get Documents
        • Get E-Invoice PDF
        • Get Document via UUID
        • Delete Invoice
        • Send Bulk Email
        • Search Taxpayer Tin API
  • E-Invoicing FTP Magnet (XML)
  • E-Invoicing FTP Magnet (Excel)
  • 🇸🇦E-Invoicing KSA API
    • Introduction to E-Invoicing KSA API
    • Learn E-Invoicing KSA API Basics
      • How to get E-Invoicing KSA Auth Token?
      • How to add a VAT number to KSA E-Invoicing Account?
      • How to add Branch for existing Vat to KSA E-Invoicing Account ?
      • How to register a device for a VAT?
      • How to generate OTP on ERAD Portal?
      • How to get Print Template ID?
      • KSA E-Invoicing Integration Architecture
    • E-Invoicing KSA API Reference
      • Resources and Masters
        • E-Invoice Object
        • Error Details Object
        • Data Types
        • Code Lists
        • Common Errors and Resolution
      • Authentication
      • Generate Access Token API
      • KSA E-Invoicing APIs
        • Generate E-Invoice
          • Additional Standard (B2B) E-Invoice Examples
          • Additional Simplified (B2C) E-Invoice Examples
        • Generate E-Invoice Async
        • Generate E-Invoice via XML
        • Send Signed E-Invoice XML To ZATCA
        • Get Bulk Invoice Lite
        • Get Invoice
        • Get E-Invoice PDF
        • Get E-Invoice PDF/A-3 with PDF API
        • Register Device
        • Get PCSID Generation Status
        • Renew PCSID
        • Generate E-Invoice (Phase I)
        • Generate QR Code (Phase I)
        • Generate Device ID
        • Generate CSID and PCSID
        • Send E-Invoice via Email
        • Add Business units API
    • E-Invoicing KSA FTP Magnet
    • E-Invoicing KSA XML reporting FTP Magnet
  • 🧩Add-ons and Extensions
    • SAP Add-on
      • SAP Connectivity Checklist
        • Steps to import SSL/TLS certificates in SAP
        • Steps to check ICM settings in SAP
        • Steps to test connectivity in SAP
        • Steps to troubleshoot connectivity issues in SAP
    • Tally Add-on
  • Microsoft Dynamics 365(F&O)
  • General
    • Go-Live Cutover Activity Checklist
    • How to check DNS resolution?
    • How to check hostname reachability?
    • How to check if hostname is trusted?
    • How to get the SSL certificate of a host?
  • ⭐GST GSP API
    • Introduction to GST GSP API
    • Getting Started with GST GSP API
    • GST GSP API Reference
      • Sample API
    • Migrating from Karvy GST GSP
  • ⭐E-Waybill GSP API
    • Introduction to E-Waybill GSP API
    • Getting Started with EWB GSP API
      • How to register EWB GSP on NIC?
      • Sandbox GSTIN for EWB GSP
    • E-Waybill GSP API Reference
      • Sample API
    • Migrating from Karvy EWB GSP
  • ⭐E-Invoicing GSP API
    • Introduction to E-Invoicing GSP API
    • Getting Started with EINV GSP API
      • How to register EINV GSP on IRP?
      • Sandbox GSTIN for EINV GSP
    • E-Invoicing GSP API Reference
      • Sample API
  • Subscribe for Updates
  • 🚫(Deprecated) GST 1.0 API
    • (Deprecated) Introduction to GST API
    • (Deprecated) Learn GST API Basics
    • (Deprecated) Getting Started with GST API
      • (Deprecated) How to set up ClearTax account?
      • (Deprecated) How to authenticate API requests?
      • (Deprecated) How to upload an invoice from File?
      • (Deprecated) How to create custom import template?
    • (Deprecated) GST 1.0 API Reference
      • Taxpayer Information
      • (Deprecated) Invoices
      • (Deprecated) Bills of Supply
      • (Deprecated) Credit Debit Notes (CDN)
      • (Deprecated) Advances
      • (Deprecated) Resources and Masters
        • (Deprecated) How to read GST error response
        • (Deprecated) Unit of Measurement master
        • (Deprecated) State master
        • (Deprecated) Document Classification/Section Name master
      • (Deprecated) Items
      • (Deprecated) Contacts
      • (Deprecated) GST File Upload API Reference
  • 🚫Deprecated E-Waybill API
    • (Deprecated) Introduction to E-Waybill API
    • (Deprecated) Learn E-Waybill API Basics
    • (Deprecated) Getting Started with E-Waybill API
    • (Deprecated) E-Waybill API Reference
      • (Deprecated) Resources and Masters
        • (Deprecated) Unit Master
        • (Deprecated) State Master
        • (Deprecated) Error Master
      • (Deprecated) E-Waybill JSON API Reference
        • (Deprecated) Generating E-Waybill
        • (Deprecated) Getting E-Waybill
        • (Deprecated) Updating E-Waybill
        • (Deprecated) Extending Validity of E-Waybill
        • (Deprecated) Multi-vehicle E-Waybill
        • (Deprecated) Printing E-Waybill
        • (Deprecated) Cancelling E-Waybill
        • (Deprecated) Generating Consolidated E-Waybill
        • (Deprecated) Getting Consolidated E-Waybill
        • (Deprecated) Regenerating Consolidated E-Waybill
        • (Deprecated) Printing Consolidated E-Waybill
      • (Deprecated) E-Waybill File Upload API Reference
        • (Deprecated) Creating or Updating Documents
        • (Deprecated) Getting Upload Status
        • (Deprecated) Getting Upload Validation
        • (Deprecated) Getting Upload History
        • (Deprecated) Rate Limiting & Best Practices
    • (Deprecated) E-Waybill FTP Magnet
Powered by GitBook
On this page
  • Request Method
  • Request URL
  • Request Headers
  • Request Path Params
  • Request Query Params
  • Request Body
  • Sample Request
  • Additional Sample of XML with all fields for Simplified (B2C) -
  • Response Status Codes
  • Response Schema
  • Sample Response
  • API Validations
  • API Constraints

Was this helpful?

  1. E-Invoicing KSA API
  2. E-Invoicing KSA API Reference
  3. KSA E-Invoicing APIs

Generate E-Invoice via XML

PreviousGenerate E-Invoice AsyncNextSend Signed E-Invoice XML To ZATCA

Last updated 7 months ago

Was this helpful?

Generate a valid E-Invoice with an XML file and send it to ZATCA for clearance or reporting.

Request Method

POST

Request URL

{{BASE_URL}}/v2/einvoices/generate-with-file

Replace the {{BASE_URL}} with the one mentioned based on whether you are using sandbox or production.

Rate Limit : 1000 API requests per minute

Request Headers

Parameter
Data Type
Field Validations
Description

x-cleartax-auth-token

String

Cannot be empty.

vat

String

Cannot be empty

Mandatory. VAT or Group VAT of the entity.

branch

String

Should be a valid branch from the user account.

Optional. Branch name (store name) added in the user account which maps to a VAT or Group VAT of the entity.

accept-language

String

Enum: ar, en

Optional. Language of error message from ZATCA.

ar - Arabic

en - English

Default: en.

device-id

String

MaxLength: 36

Request Path Params

There are no path parameters for this API.

Request Query Params

There are no query parameters for this API.

Request Body

Parameter
Data Type
Field Validations
Description

file

form-data

NA

Mandatory.

Requirement of Critical Fields

Fields
Generate E-Invoice API (via JSON)
Generate E-Invoice via XML API

UUID

Optional. Will be generated by ClearTax if not sent in input.

Optional. Will be generated by ClearTax if not sent in input.

ICV

Read Only. Will be ignored if sent in input.

Read Only. Will be ignored if sent in input.

PIH

Read Only. Will be ignored if sent in input.

Read Only. Will be ignored if sent in input.

InvoiceHash

Read Only. Will be ignored if sent in input.

Read Only. Will be ignored if sent in input.

Signature

Read Only. Will be ignored if sent in input.

Read Only. Will be ignored if sent in input.

RawQRCode

Read Only. Will be ignored if sent in input.

Read Only. Will be ignored if sent in input.

InvoiceXml

NA. Not available in the input schema.

NA. Not available in the input schema. The XML received will be enhanced before sending to ZATCA.

The use case where generation CSID (at customer side) and reporting CSID (at ClearTax side) is different, is not supported at the moment.

Sample Request

Standard Tax Invoice XML-

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
    
    <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
    <cbc:ID>KSAINV-002</cbc:ID>
    <cbc:UUID>8d487816-70b8-4ade-a618-9d620b73814a</cbc:UUID>
    <cbc:IssueDate>2022-04-07</cbc:IssueDate>
    <cbc:IssueTime>12:21:28</cbc:IssueTime>
    <cbc:InvoiceTypeCode name="0100000">388</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
    <cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode>
    <cac:AdditionalDocumentReference>
        <cbc:ID>ICV</cbc:ID>
        <cbc:UUID>23</cbc:UUID>
    </cac:AdditionalDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>PIH</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    
    
<cac:Signature>
      <cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
      <cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
</cac:Signature>
<cac:AccountingSupplierParty>
      <cac:Party>
         <cac:PartyIdentification>
            <cbc:ID schemeID="MLS">123457890</cbc:ID>
         </cac:PartyIdentification>
         <cac:PostalAddress>
            <cbc:StreetName>King Abdulaziz Road</cbc:StreetName>
            <cbc:BuildingNumber>8228</cbc:BuildingNumber>
            <cbc:PlotIdentification>2121</cbc:PlotIdentification>
            <cbc:CitySubdivisionName>Al Amal</cbc:CitySubdivisionName>
            <cbc:CityName>Riyadh</cbc:CityName>
            <cbc:PostalZone>12643</cbc:PostalZone>
            <cbc:CountrySubentity>Riyadh Region</cbc:CountrySubentity>
            <cac:Country>
               <cbc:IdentificationCode>SA</cbc:IdentificationCode>
            </cac:Country>
         </cac:PostalAddress>
         <cac:PartyTaxScheme>
            <cbc:CompanyID>300188493300003</cbc:CompanyID>
            <cac:TaxScheme>
               <cbc:ID>VAT</cbc:ID>
            </cac:TaxScheme>
         </cac:PartyTaxScheme>
         <cac:PartyLegalEntity>
            <cbc:RegistrationName>Al Salam Supplies Co. LTD</cbc:RegistrationName>
         </cac:PartyLegalEntity>
      </cac:Party>
   </cac:AccountingSupplierParty>
   <cac:AccountingCustomerParty>
      <cac:Party>
         <cac:PartyIdentification>
            <cbc:ID schemeID="SAG">123C12345678</cbc:ID>
         </cac:PartyIdentification>
         <cac:PostalAddress>
            <cbc:StreetName>King Abdullah Road</cbc:StreetName>
            <cbc:BuildingNumber>3709</cbc:BuildingNumber>
            <cbc:PlotIdentification>1004</cbc:PlotIdentification>
            <cbc:CitySubdivisionName>Al Mursalat</cbc:CitySubdivisionName>
            <cbc:CityName>Riyadh</cbc:CityName>
            <cbc:PostalZone>11564</cbc:PostalZone>
            <cbc:CountrySubentity>Riyadh Region</cbc:CountrySubentity>
            <cac:Country>
               <cbc:IdentificationCode>SA</cbc:IdentificationCode>
            </cac:Country>
         </cac:PostalAddress>
         <cac:PartyTaxScheme>
            <cac:TaxScheme>
<cbc:CompanyID>310175397400003</cbc:CompanyID>
               <cbc:ID>VAT</cbc:ID>
            </cac:TaxScheme>
         </cac:PartyTaxScheme>
         <cac:PartyLegalEntity>
            <cbc:RegistrationName>AL KAWTHAR MARKETS</cbc:RegistrationName>
         </cac:PartyLegalEntity>
      </cac:Party>
   </cac:AccountingCustomerParty>

    <cac:Delivery>
        <cbc:ActualDeliveryDate>2022-09-07</cbc:ActualDeliveryDate>
    </cac:Delivery>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
    </cac:PaymentMeans>
    <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
        <cac:TaxCategory>
            <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
            <cbc:Percent>15</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:AllowanceCharge>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0.6</cbc:TaxAmount>
    </cac:TaxTotal>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0.6</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">4.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
             <cac:TaxCategory>
                 <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
                 <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                   <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
                </cac:TaxScheme>
             </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">4.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">4.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">4.60</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0.00</cbc:AllowanceTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">4.60</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">2.000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">4.00</cbc:LineExtensionAmount>
        <cac:TaxTotal>
             <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
             <cbc:RoundingAmount currencyID="SAR">4.60</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>قلم رصاص</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">2.00</cbc:PriceAmount>
            <cac:AllowanceCharge>
               <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
               <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
               <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

Simplified Tax Invoice XML-

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
    
    <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
    <cbc:ID>KSAINV-001</cbc:ID>
    <cbc:UUID>8d487816-70b8-4ade-a618-9d620b73814a</cbc:UUID>
    <cbc:IssueDate>2022-04-07</cbc:IssueDate>
    <cbc:IssueTime>12:21:28</cbc:IssueTime>
    <cbc:InvoiceTypeCode name="0200000">388</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
    <cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode>
    <cac:AdditionalDocumentReference>
        <cbc:ID>ICV</cbc:ID>
        <cbc:UUID>23</cbc:UUID>
    </cac:AdditionalDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>PIH</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    
    
<cac:Signature>
      <cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
      <cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
</cac:Signature>
<cac:AccountingSupplierParty>
      <cac:Party>
         <cac:PartyIdentification>
            <cbc:ID schemeID="MLS">123457890</cbc:ID>
         </cac:PartyIdentification>
         <cac:PostalAddress>
            <cbc:StreetName>King Abdulaziz Road</cbc:StreetName>
            <cbc:BuildingNumber>8228</cbc:BuildingNumber>
            <cbc:PlotIdentification>2121</cbc:PlotIdentification>
            <cbc:CitySubdivisionName>Al Amal</cbc:CitySubdivisionName>
            <cbc:CityName>Riyadh</cbc:CityName>
            <cbc:PostalZone>12643</cbc:PostalZone>
            <cbc:CountrySubentity>Riyadh Region</cbc:CountrySubentity>
            <cac:Country>
               <cbc:IdentificationCode>SA</cbc:IdentificationCode>
            </cac:Country>
         </cac:PostalAddress>
         <cac:PartyTaxScheme>
            <cbc:CompanyID>300188493300003</cbc:CompanyID>
            <cac:TaxScheme>
               <cbc:ID>VAT</cbc:ID>
            </cac:TaxScheme>
         </cac:PartyTaxScheme>
         <cac:PartyLegalEntity>
            <cbc:RegistrationName>Al Salam Supplies Co. LTD</cbc:RegistrationName>
         </cac:PartyLegalEntity>
      </cac:Party>
   </cac:AccountingSupplierParty>
   <cac:AccountingCustomerParty>
      <cac:Party>
         <cac:PartyIdentification>
            <cbc:ID schemeID="SAG">123C12345678</cbc:ID>
         </cac:PartyIdentification>
         <cac:PostalAddress>
            <cbc:StreetName>King Abdullah Road</cbc:StreetName>
            <cbc:BuildingNumber>3709</cbc:BuildingNumber>
            <cbc:PlotIdentification>1004</cbc:PlotIdentification>
            <cbc:CitySubdivisionName>Al Mursalat</cbc:CitySubdivisionName>
            <cbc:CityName>Riyadh</cbc:CityName>
            <cbc:PostalZone>11564</cbc:PostalZone>
            <cbc:CountrySubentity>Riyadh Region</cbc:CountrySubentity>
            <cac:Country>
               <cbc:IdentificationCode>SA</cbc:IdentificationCode>
            </cac:Country>
         </cac:PostalAddress>
         <cac:PartyTaxScheme>
            <cac:TaxScheme>
               <cbc:ID>VAT</cbc:ID>
            </cac:TaxScheme>
         </cac:PartyTaxScheme>
         <cac:PartyLegalEntity>
            <cbc:RegistrationName>AL KAWTHAR MARKETS</cbc:RegistrationName>
         </cac:PartyLegalEntity>
      </cac:Party>
   </cac:AccountingCustomerParty>
​
    <cac:Delivery>
        <cbc:ActualDeliveryDate>2022-09-07</cbc:ActualDeliveryDate>
    </cac:Delivery>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
    </cac:PaymentMeans>
    <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
        <cac:TaxCategory>
            <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
            <cbc:Percent>15</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:AllowanceCharge>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0.6</cbc:TaxAmount>
    </cac:TaxTotal>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0.6</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">4.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
             <cac:TaxCategory>
                 <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
                 <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                   <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
                </cac:TaxScheme>
             </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">4.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">4.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">4.60</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0.00</cbc:AllowanceTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">4.60</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">2.000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">4.00</cbc:LineExtensionAmount>
        <cac:TaxTotal>
             <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
             <cbc:RoundingAmount currencyID="SAR">4.60</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>قلم رصاص</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">2.00</cbc:PriceAmount>
            <cac:AllowanceCharge>
               <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
               <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
               <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

Additional Sample of XML with all fields for Simplified (B2C) -

Response Status Codes

Response Schema

Sample Response

API Validations

API Constraints

  1. This API needs to be authenticated with a valid user authentication token. If the auth token is not present or is invalid, the API will return HTTP Status Code 401.

  2. Each customer is allowed to send a limited number of requests per minute to prevent server overload. If the limit is exceeded, the server will respond with a 429 Too Many Requests status code.

  3. If the auth token is valid, but the user does not have the authorization to generate device ID, then the API will return HTTP Status Code 403. The user, whose auth token is used, should have an Admin role for the particular VAT used in the request.

Mandatory. .

Mandatory. The Device ID registered with ClearTax. Refer to ?

Same as . Refer to the corresponding section.

Same as . Refer to the corresponding section.

Same as . Refer to the corresponding section.

Same as . Refer to the corresponding section.

🇸🇦
here
Generate E-Invoice API
Generate E-Invoice API
Generate E-Invoice API
Generate E-Invoice API
User auth token
How to get a Device ID
15KB
Unsigned XML Sample_B2C_10th Jun.xml