⚡ Bottom Line

ZATCA rejections almost always trace back to one of three layers: business rules (sequencing, hashing, tax codes), schema validation (malformed XML against the UBL 2.1 KSA profile), or infrastructure (certificate and authentication problems). Fix the root cause in your source system before resubmitting — resending the same broken file just produces the same rejection.

1. The Three Rejection Categories

Every ZATCA validation response falls into one of three buckets, and knowing which one you're dealing with tells you where to actually look for the fix:

CategoryWhat It ChecksTypical Symptom
Business Rules (BR)Sequencing, hashing, tax logic, identity consistency against ZATCA's recordsMost common — often the same HTTP error code as schema failures, different root cause
XML Schema (XSD)Whether the XML conforms to UBL 2.1 with the required KSA extensionsLoud and usually easy to pinpoint — a missing or malformed field
InfrastructureCertificate validity, authentication, environment (sandbox vs production)401/403-style errors, often unrelated to the invoice content itself
ℹ️

Schema and business-rule errors can look identical at first glance

Both can surface as the same generic HTTP 400 response from your integration layer. The difference only becomes clear once you read the actual validation message ZATCA returns — which is why the first troubleshooting step is always to pull the full error payload, not just the status code.

2. Business Rule Errors — Sequencing, Hashing & Tax Logic

Business Rule violations are the highest-volume rejection cause once a business moves into Phase 2 integration. These six show up most often:

SEQUENCING

Invoice Counter Value (ICV) Not Sequential

Cause: Every document needs an ICV that increments by exactly 1 from the previous one. Gaps or duplicates typically come from legacy data migration, multiple servers issuing invoices without a shared counter, or invoices generated out of order.
Fix: Centralize ICV generation through a single authoritative counter per legal entity, and reconcile any gap before issuing the next invoice — ZATCA expects an unbroken chain.
HASHING

Previous Invoice Hash (PIH) Mismatch

Cause: Each invoice must reference the cryptographic hash of the immediately preceding invoice, chaining every document together. A mismatch usually means an invoice was skipped, issued out of sequence, or the chain was broken during a system migration.
Fix: Verify your chain against ZATCA's last accepted invoice for that series before resuming issuance, and never regenerate a historical invoice's hash after the fact.
HASHING

Invoice Hash Doesn't Match Content

Cause: The SHA-256 hash embedded in the invoice no longer matches the actual invoice content — almost always because the invoice was edited after the hash was calculated and signed.
Fix: Finalize every field first, then generate the hash and signature last. Never touch a signed invoice's content afterward — issue a credit note and a new invoice instead.
TAX LOGIC

Missing Exemption or Zero-Rate Reason Code

Cause: A line item is marked as exempt or zero-rated, but no corresponding reason code was included — ZATCA requires the justification, not just the rate.
Fix: Map every exempt and zero-rated product/service category in your system to its correct ZATCA reason code before go-live, not as an afterthought during rejection cleanup.
IDENTITY

Seller Name Doesn't Match VAT Registration Record

Cause: The Arabic (or English) seller name on the invoice doesn't exactly match the name on file with ZATCA — including spacing, diacritics, or transliteration differences.
Fix: Copy the seller name directly from your VAT certificate verbatim and use it as the single source of truth across your CSR, certificate, and every invoice template — don't retype it in different systems.
DOCUMENT TYPE

Incorrect Invoice Type Code

Cause: ZATCA expects specific standard codes for each document type — a common one being 388 for a standard invoice, 381 for a credit note, and 383 for a debit note — plus a correct subtype for simplified (B2C) invoices.
Fix: Confirm your ERP or e-invoicing middleware maps every document type to the correct code and subtype rather than defaulting everything to a single generic invoice type.

3. Schema Validation Errors — Malformed XML

Schema errors happen when your XML doesn't conform to the UBL 2.1 standard with ZATCA's Kingdom-specific extensions layered on top.

SCHEMA

Missing KSA UBL Extension Blocks

Cause: The invoice sends base UBL 2.1 without the additional ZATCA-specific blocks — ProfileID, the ICV/PIH/QR AdditionalDocumentReference elements — that the KSA profile requires on top of the international standard.
Fix: Declare the correct ProfileID (reporting:1.0 for simplified, standard:1.0 for standard invoices), include the required AdditionalDocumentReference blocks, and validate against ZATCA's published XSD before submission — not just generic UBL 2.1.
SCHEMA

Missing or Incorrectly Formatted Issue Date/Time

Cause: The invoice's issue date element is missing, empty, or in the wrong format — or, common with systems upgraded from Phase 1, missing the issue time, which Phase 2 requires in addition to the date.
Fix: Ensure both date and time are populated in the correct ISO format on every invoice, not just the date field that satisfied Phase 1 generation requirements.
SCHEMA

Structured Address Fields Incomplete

Cause: Address data doesn't meet ZATCA's structured-field requirements — a frequently cited example is a building number that isn't formatted as a 4-digit value.
Fix: Validate seller and buyer address fields against the structured format ZATCA expects, including zero-padding building numbers to 4 digits where required.

4. Infrastructure & Certificate Errors

These errors have nothing to do with the invoice content itself — they're about whether ZATCA can authenticate who's sending it.

AUTH

401 Unauthorized

Cause: Most often an expired or invalid Cryptographic Stamp Identifier (CSID) — including the common mistake of using a Compliance CSID (meant for pre-production testing) against the Production environment.
Fix: Confirm which environment you're submitting to, renew the CSID before its validity period lapses (typically annual), and keep Compliance and Production certificates clearly separated in your configuration.
AUTH

Certificate Permissions / VAT Number Mismatch

Cause: The VAT registration number on the invoice doesn't match the VAT number embedded in the authentication certificate being used to submit it — common when a single integration serves multiple legal entities.
Fix: Maintain a distinct CSID per VAT-registered entity and route each entity's invoices through its own certificate — never share one certificate across multiple VAT numbers.
TIMING

B2C Reporting Deadline Missed

Cause: Simplified (B2C) invoices must be reported to ZATCA within 24 hours of issuance under the Reporting Model. Batch-upload processes that run daily or less frequently can slip past this window.
Fix: Move to near-real-time reporting rather than end-of-day batches — the tighter your reporting cadence, the less exposure you have to missing the 24-hour window.

5. QR Code / TLV Encoding Errors

The QR code on simplified invoices uses TLV (Tag-Length-Value) encoding, and Arabic text is a frequent source of subtle, hard-to-spot failures.

  • Incomplete QR payload: One or more of the five required fields (seller name, VAT number, timestamp, invoice total, VAT total) is missing from the encoded data.
  • Byte-length miscalculation on Arabic text: TLV length bytes must reflect the actual byte length of UTF-8 encoded Arabic text, not the character count — a frequent source of QR corruption when developers assume 1 character = 1 byte.
  • Cryptographic stamp mismatch: The stamp added after ZATCA clearance doesn't match the invoice data, or was generated using an expired certificate.
💡

Test your QR decode, not just your QR generation

A QR code that "looks right" visually can still carry corrupted TLV data. Decode your own generated QR codes with an independent TLV parser as a validation step — don't rely solely on visual inspection or a successful-looking scan.

⚠️

Exact error code labels vary by system — verify against the live response

Different ERPs, middleware providers, and ZATCA SDK versions can surface slightly different code names and descriptions for the same underlying rule. Treat any specific code number you see in a support forum or vendor guide as a starting point, not gospel — always cross-check the precise validation message in your own live API response against ZATCA's official documentation.

🎯 Key Takeaways
  • Three failure layers: business rules, schema validation, and infrastructure/certificates — identify which one before troubleshooting
  • ICV and PIH chains must be unbroken — centralize invoice numbering through one authoritative counter per entity
  • Never edit a signed invoice — hash mismatches come from post-signature changes; issue a credit note instead
  • Separate Compliance and Production certificates — the single most common 401 error is using the wrong CSID environment
  • Map exemption/zero-rate reason codes before go-live, not during rejection cleanup
  • B2C invoices need reporting within 24 hours — daily batch uploads are a common way to miss this
  • Arabic TLV encoding uses byte length, not character count — a frequent silent QR corruption source
  • Fix the root cause, then resubmit — resending the same file without a correction reproduces the same rejection

6. Troubleshooting Checklist

1

Pull the full validation response

Get the actual error message and code from ZATCA's API response, not just the HTTP status — this tells you which of the three categories you're dealing with.

2

Check sequencing first

If it's a Business Rule error, verify ICV continuity and PIH chain integrity before looking anywhere else — this is the highest-frequency cause.

3

Validate against the KSA schema, not generic UBL 2.1

Confirm ProfileID and the required AdditionalDocumentReference blocks are present if you're seeing schema failures.

4

Confirm your certificate environment

Check whether you're using a Compliance or Production CSID, and that it matches the VAT number on the invoice and hasn't expired.

5

Decode your own QR output

Independently verify TLV encoding, especially for Arabic seller names, rather than trusting visual inspection.

6

Fix at the source, then regenerate

Correct the underlying data or configuration, regenerate the hash/UUID as needed, and resubmit — don't just retry the original file.

Frequently Asked Questions

Why does ZATCA reject e-invoices most often?

Rejections fall into three categories: Business Rule violations (sequencing, hashing, tax logic), XML schema failures against the UBL 2.1 KSA profile, and infrastructure errors like expired certificates. Business Rule violations are the most frequent during Phase 2 integration.

What causes an ICV or PIH error?

The ICV must increment by exactly 1 per document, and the PIH must match the hash of the immediately preceding invoice. These break during legacy migrations, multi-server issuance without a shared counter, or invoices generated out of order.

Why is my integration returning 401 Unauthorized?

Usually an expired, invalid, or mismatched CSID certificate — including using a Compliance CSID in the Production environment, or a certificate registered to a different VAT number than the one submitting the invoice.

What is the deadline to report B2C simplified invoices?

Within 24 hours of issuance under the Reporting Model. Businesses relying on daily batch uploads rather than near-real-time reporting are the most likely to miss this window.

Do exact ZATCA error code numbers stay consistent across systems?

Not entirely — code labels can vary by ERP, middleware, or SDK version. Treat third-party code references as a general guide and confirm the precise rule against ZATCA's own documentation and your live API response.

Can a rejected invoice be corrected and resubmitted?

Yes — fix the underlying issue at the source, regenerate the hash and UUID where needed, and resubmit. Resending the same rejected file unchanged will typically produce the same rejection.