ZATCA E-Invoice Template

Complete guide to XML UBL 2.1 format, required fields, QR code generation, and integration examples

📅 Last updated: April 01, 2026

ZATCA (Zakat, Tax and Customs Authority) requires all taxable businesses in Saudi Arabia to issue e-invoices in a standardized XML format (UBL 2.1) with specific fields, cryptographic stamps, and QR codes. Below is the complete technical specification and downloadable template.

Required Fields in ZATCA Invoice

Field NameDescriptionRequirement
Seller NameLegal name of the taxpayer issuing the invoiceMandatory
VAT Number (TRN)Tax Registration Number (15 digits)Mandatory
Invoice Date & TimeTimestamp of issuance (ISO 8601 format)Mandatory
Invoice NumberUnique sequential numberMandatory
Buyer NameFor B2B invoices (if TRN available)Conditional
Buyer TRNBuyer's Tax Registration Number (for B2B)Conditional
Line ItemsDescription, quantity, unit price, VAT rate for each itemMandatory
SubtotalTotal before VATMandatory
VAT AmountTax amount (15% standard rate or applicable rate)Mandatory
Total DueSubtotal + VATMandatory
QR Code (Cryptographic Stamp)Base64-encoded string containing seller details, timestamp, invoice total, VAT, and digital signatureMandatory

💻 Sample XML (UBL 2.1) - ZATCA Compliant

<?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">
  <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
  <cbc:ID>INV-2026-001</cbc:ID>
  <cbc:IssueDate>2026-03-30</cbc:IssueDate>
  <cbc:IssueTime>14:30:00</cbc:IssueTime>
  <cbc:InvoiceTypeCode>388</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cac:PartyName><cbc:Name>Your Company Name</cbc:Name></cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>Business Street</cbc:StreetName>
        <cbc:CityName>Riyadh</cbc:CityName>
        <cbc:CountrySubentity>Riyadh Province</cbc:CountrySubentity>
        <cac:Country><cbc:IdentificationCode>SA</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>123456789012345</cbc:CompanyID>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:PartyTaxScheme>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="SAR">1000.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="SAR">1000.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="SAR">1150.00</cbc:TaxInclusiveAmount>
    <cbc:PayableAmount currencyID="SAR">1150.00</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="SAR">150.00</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="SAR">1000.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="SAR">150.00</cbc:TaxAmount>
      <cac:TaxCategory>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
</Invoice>

🔐 QR Code Generation for ZATCA Invoice

The QR code (cryptographic stamp) contains a Base64-encoded string of the following fields in Tag-Length-Value (TLV) format:

Example TLV encoding (simplified): |Seller Name|123456789012345|2026-03-30T14:30:00Z|1150.00|150.00|signature|

🔧 Integration Steps

Frequently Asked Questions

Can I use JSON instead of XML?

No. ZATCA requires XML in UBL 2.1 format for both Clearance and Reporting models. JSON is not accepted.

What is the difference between simplified and standard invoice?

Simplified invoices (under 1,000 SAR for B2C) have fewer required fields. Standard invoices require buyer TRN and address details.

How do I test my XML template?

Use ZATCA's Sandbox environment (Simulation portal). They provide validation tools to check XML structure before production.

Is there a deadline for XML implementation?

Phase 2 integration deadlines vary by business revenue. Large taxpayers (over SAR 3M) have earlier deadlines. Check ZATCA portal for your specific date.