Jump to content
ZATCA & Tax

The E-Invoice XML File: Contents and Who Makes It

What is printed, what is sent to ZATCA, and how to download the signed file from Snad

Snad Team8 min readاقرأ هذا المقال بالعربية
In this article8 sections

The e-invoice XML file is the structured copy of your invoice that a machine can read, and it is the copy sent to the Zakat, Tax and Customs Authority (ZATCA). You do not write it by hand: your invoicing software builds it from the invoice data, signs it and sends it. What you and your customer see is a printed copy or a PDF with the same data.

This article shows what is inside the file with a worked example, how it differs from the printed copy, who produces it, and where you download it in Snad.

What an XML invoice file is and why ZATCA requires it

XML is a text file in which every piece of the invoice sits inside a tag that names it: invoice number, date, seller, each line, tax and total. A person sees a tidy invoice, and software reads the tags. That is what ZATCA needs to receive invoices from every business without anyone reading them.

The Zakat, Tax and Customs Authority1 defines an electronic invoice as a tax invoice generated in a structured electronic format by electronic means, and states that a paper invoice that is only copied or scanned does not count. The shape and content of that format are set by the XML Implementation Standard and the Data Dictionary2, both dated 19 May 2023. They are documents for software developers, not for a business owner. The format invoicing software builds its files on is UBL 2.1, a worldwide tag language for commercial documents.

This table separates what you may call an e-invoice from what the Authority counts as one:

What you holdIs it the e-invoice file?Why
A paper invoice that is copied or scannedNoThe Authority states it does not count as an electronic invoice
An XML file that follows the Authority's standardYesIt is the structured format software reads
A PDF/A-3 with embedded XMLYes, as a sharing formatOne file that people read and machines parse
An ordinary PDF from a word processor or spreadsheetIt holds no XMLFine as a reading copy, not for submission

What is inside the file: an invoice with numbers

Take an illustrative invoice: two items sold to a business. The names and numbers below are examples, not real data, and the VAT number follows the Authority's pattern (15 digits that start and end with 3).

ItemQuantity x priceTotal
Label paper (carton)10 x 1201,200.00
Barcode printer2 x 450900.00
Total before tax2,100.00
Value added tax (15%)315.00
Grand total2,415.00

The same data moves into the file, each piece under a tag with a fixed UBL name:

What you see on paperTag in the fileValue in the example
Invoice numbercbc:IDINV-1042
Issue datecbc:IssueDate2026-11-17
Issue timecbc:IssueTime10:30:00
Invoice type (tax or simplified)cbc:InvoiceTypeCodetype code
Currencycbc:DocumentCurrencyCodeSAR
Seller details and VAT numbercac:AccountingSupplierParty300000000000003
Buyer detailscac:AccountingCustomerPartycustomer name
Tax amountcac:TaxTotal315.00
Grand totalcac:LegalMonetaryTotal2,415.00

The file also adds what you cannot see on paper: a unique invoice identifier (UUID), a digital signature, a cryptographic stamp and a QR code. The Authority gathers the security requirements in its Security Features Implementation Standards3.

That is why you should not edit the file by hand: changing a single number after signing leaves a file that no longer matches its signature. A mistake in an issued invoice is corrected with a credit note or a debit note that cites the original invoice number, not by editing the original.

What is printed and what is sent: three forms of one invoice

One invoice appears in three forms, and each has a reader:

FormWho reads itUsed forSent to ZATCA?
The signed XML fileZATCA and softwareClearing the invoice or reporting itYes
A printed copy or ordinary PDFYour customerReading and keepingNo
PDF/A-3 with embedded XMLYour customer and softwareSharing one file that carries both the reading copy and the dataAn accepted sharing format; submission is in XML

When the XML is sent depends on the invoice type, according to the Detailed Guideline for e-invoicing4:

  • A tax invoice (usually between two businesses) is cleared by the Fatoora platform before it is handed to the customer.
  • A simplified tax invoice (usually for individuals) is handed to the customer at the sale, and its file is sent to the Authority in XML within 24 hours of issue.

For the two types and their fields, read Tax Invoice vs Simplified Tax Invoice. For the integration waves and their dates, read the Phase Two guide.

As for PDF/A-3, it is an archival flavour of PDF that allows files to be embedded inside the file itself. That is what makes it fit here: it puts the readable invoice on the surface and the XML file inside, so the other party receives one file that a person reads and software parses. If you send a PDF/A-3 to your customer you have sent the reading copy and the data together, but you do not substitute it for the XML file that goes to the Authority.

Who creates the file: three steps you do not write by hand

A business owner does not write XML and rarely sees it. This is what happens behind the Save button in software linked to the Authority:

  1. Build: the software turns the invoice data into a UBL 2.1 file that follows the standard.
  2. Sign: it signs the file with your business's certificate and adds the cryptographic stamp and QR code.
  3. Send: it sends the file to the Fatoora platform: clearance for a tax invoice before handover, reporting for a simplified one after the sale.

In Snad all three steps run inside the program: a ZATCA SDK service builds the file, signs it and computes its stamp and QR code, and the program keeps, for each organization and environment, the invoice counter chain and the hash of the previous invoice. A simplified invoice is signed at the moment of sale and sent afterwards, and a tax invoice is cleared before handover.

StageWhat you doWhat the program does
Before linkingEnter the VAT number and activate the link with an OTP from the Fatoora portalChecks the organization's readiness: currency, country and VAT number format
At the saleCreate the invoice as you always doBuilds the file, signs it and adds the QR code
After the saleCheck the document status in the ZATCA dashboardClears the tax invoice or reports the simplified one

The certificate has an expiry date: once it expires, sending stops until you renew it with a new OTP from the Fatoora portal, and Snad shows a warning before that.

The same logic applies to the credit note, that is, a sales return: it has its own XML file that is built, signed and sent as an invoice is, and it is downloaded from the same dashboard. Your accountant never needs to edit an earlier file.

About Snad

How to download the XML file from Snad

If you want the file itself, for your accountant, for your records or to inspect it, it is available for every document that was sent to the Authority:

  1. Open the ZATCA dashboard from Settings.
  2. Open the document from the list to see its details.
  3. Press Download XML for the signed file, or Download PDF/A-3 for the copy that carries the file embedded.
FileButtonWorks onCondition
Signed XMLDownload XMLInvoices and credit notesThe link with ZATCA is active
PDF/A-3Download PDF/A-3Invoices and credit notesThe document's share link is on

The link with ZATCA is included in the Basic and Pro plans, and the free Starter plan has no link, so it has no signed file. Both downloads are for users who have permission to submit to the Authority. For the details of the link, see E-invoicing and ZATCA, and for the plans, the pricing page.

Why download the file at all? Three usual cases: your accountant asks for the file that was sent so it can be matched with your books, you want a copy with your records, or you want to check that what was sent is what you see on the invoice. In all three the file is for reading and keeping, not editing; if you find a mistake, issue a credit note or debit note instead of editing it.

Common mistakes about the XML file

  • Treating the PDF as the e-invoice. An ordinary PDF is a reading copy; what the Authority reads is XML.
  • Editing the file after it is signed. An edit breaks the match with the signature. The right fix is a credit note or debit note that cites the original invoice number.
  • Sending to the simulation environment as if it were live. Simulation documents go to the Authority's test environment and do not meet the e-invoicing obligation. Snad shows a warning to that effect in the ZATCA dashboard: switch to the live link before issuing real invoices.
  • Letting the certificate expire. Sending stops when it expires; renew it with a new OTP.
  • A VAT number in the wrong pattern. The number is 15 digits that start and end with 3; Snad rejects anything else at linking and asks you to correct it in the organization settings.

To see the invoice fields before any linking, try the free tax invoice generator: a tool with no sign-up that prints a reading copy with the data the Authority asks for, and sends nothing to it.

Frequently asked questions

Do I need to write the XML file myself?
No. Invoicing software linked to the Authority builds the file, signs it and sends it, at the sale or soon after depending on the invoice type. What you enter is the usual invoice data: customer, items, quantities and prices.
Is the XML file the invoice I hand to my customer?
Usually not. Your customer needs a copy they can read: printed or a PDF. The XML file is what goes to the Authority. If you want one file that carries both the reading copy and the data, that is a PDF/A-3 with the XML embedded.
Can I open the file and read it?
Yes. It is text that opens in any text editor or browser, showing the tags and values. Read it, but do not edit it: an edit after signing leaves a file that no longer matches its signature.
Do I get the signed XML file on the free Starter plan?
No. The link with the Authority and invoice signing are included in the Basic and Pro plans, and the free Starter plan has no link. The free generator on the website prints a reading copy and sends nothing to the Authority.
Does the file differ between a tax invoice and a simplified one?
The invoice type and some of the data differ: a tax invoice carries the buyer's details, and a simplified one does not require the buyer's VAT number. In both cases the file is XML under the same Authority standard, and what differs is how it is sent: clearance for the tax invoice, reporting for the simplified one.

Sources

External links in this article, in the order they appear.

  1. 1Zakat, Tax and Customs Authorityzatca.gov.sa
  2. 2XML Implementation Standard and the Data Dictionaryzatca.gov.sa
  3. 3Security Features Implementation Standardszatca.gov.sa
  4. 4Detailed Guideline for e-invoicingzatca.gov.sa

Tags

  • E-Invoicing
  • ZATCA
  • Accounting
  • Zakat, Tax and Customs Authority

Share this article

Try what you read on your own numbers

Start on the free Starter plan: 2 of Snad's nine apps for one user, with no end date.

Starter stays free · 7-day trial of any paid plan, no card