ZATCA Compliance

How to Pass the 6 ZATCA Phase 2 Compliance Checks (CSID Onboarding Guide 2026)

Step-by-step developer and ERP guide to passing ZATCA Fatoora's 6 mandatory compliance checks (Standard & Simplified Invoice, Credit Note, Debit Note) to obtain your Production CSID.

Qeemah Team • Published: • Updated: • 12 min read
How to Pass the 6 ZATCA Phase 2 Compliance Checks (CSID Onboarding Guide 2026)

Summarize or verify this guide with AI:

Opens your preferred AI assistant with this article and ZATCA compliance context pre-loaded.

Quick Answer: What Are the 6 ZATCA Compliance Checks?

To obtain a Production CSID (Cryptographic Stamp Identifier) from ZATCA’s Fatoora portal (fatoora.zatca.gov.sa), your ERP or E-Invoice Generation Solution (EGS) must first request a temporary Compliance CSID via a 6-digit Fatoora OTP and then pass validation on 6 mandatory UBL 2.1 XML documents against the /compliance/invoices API:

  1. Standard Tax Invoice (TypeCode: 388, name: 0100000)
  2. Standard Credit Note (TypeCode: 381, name: 0100000)
  3. Standard Debit Note (TypeCode: 383, name: 0100000)
  4. Simplified Tax Invoice (TypeCode: 388, name: 0200000)
  5. Simplified Credit Note (TypeCode: 381, name: 0200000)
  6. Simplified Debit Note (TypeCode: 383, name: 0200000)

Only after all applicable checks return PASS (or PASS with non-blocking WARNINGs) will ZATCA’s /production/csids endpoint issue your live Production CSID for B2B Clearance and B2C Reporting.


Step-by-Step CSID Onboarding Flow (Sandbox, Simulation & Production)

Every device or cloud tenant onboarded to ZATCA Phase 2 follows the exact same 4-stage cryptographic workflow across ZATCA’s Developer Sandbox, Simulation Portal, and Production Portal:

StageAPI EndpointAuth MethodKey InputOutput
1. Generate Key & CSRLocal (secp256k1)N/AOrganization VAT (3...3), EGS Serial, invoiceType (1100)Private Key (kept secret) + Base64 CSR
2. Get Compliance CSIDPOST /complianceHeader: OTP (6 digits from Fatoora)Base64 CSRrequestID, Compliance binarySecurityToken, secret
3. Pass 6 Compliance ChecksPOST /compliance/invoicesBasic Auth (Compliance Token : Secret)Signed UBL 2.1 XML + invoiceHash + uuid (×6)validationResults.status: PASS
4. Get Production CSIDPOST /production/csidsBasic Auth (Compliance Token : Secret)compliance_request_id (from Stage 2)Live Production binarySecurityToken + secret

Important: Note that your invoiceType bitmask in the CSR (1100 = Standard + Simplified, 1000 = Standard B2B only, 0100 = Simplified B2C only) controls which checks are enforced. If you set 1100, you must pass all 6 checks before /production/csids succeeds.


The 6 Mandatory Compliance Documents (Exact XML Rules)

Before submitting any document to /compliance/invoices, validate its structure with our free ZATCA XML Validator & UBL 2.1 Viewer. Each of the 6 documents has strict cbc:InvoiceTypeCode and BR-KSA-* rules:

Check #Document TypeInvoiceTypeCodename AttributeKey Mandatory Fields That Cause Rejections
1Standard Tax Invoice (B2B)3880100000Buyer VAT/TIN or CRN, Buyer National Address, SupplyDate (KSA-5)
2Standard Credit Note (B2B)3810100000BillingReference (IBT-25) + InstructionNote reason (KSA-10)
3Standard Debit Note (B2B)3830100000BillingReference (IBT-25) + InstructionNote reason (KSA-10)
4Simplified Tax Invoice (B2C)3880200000Must include 9-tag TLV QR Code (signed with Compliance CSID)
5Simplified Credit Note (B2C)3810200000BillingReference + InstructionNote (KSA-10) + 9-tag TLV QR
6Simplified Debit Note (B2C)3830200000BillingReference + InstructionNote (KSA-10) + 9-tag TLV QR

Sample XML Snippets for Passing Checks 1–6

A. Invoice Type Code & Subtype (0100000 vs 0200000)

<!-- Standard Tax Invoice (Check #1) -->
<cbc:InvoiceTypeCode name="0100000">388</cbc:InvoiceTypeCode>

<!-- Simplified Credit Note (Check #5) -->
<cbc:InvoiceTypeCode name="0200000">381</cbc:InvoiceTypeCode>

B. Mandatory Credit / Debit Note Reference (Checks #2, #3, #5, #6)

ZATCA rejects any 381 or 383 compliance document if it lacks both the original invoice reference (cac:BillingReference) and the issuance reason (cbc:InstructionNote, KSA-10):

<cac:BillingReference>
  <cac:InvoiceDocumentReference>
    <cbc:ID>INV-2026-0001</cbc:ID>
  </cac:InvoiceDocumentReference>
</cac:BillingReference>
...
<cac:PaymentMeans>
  <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
  <cbc:InstructionNote>Returned goods / Pricing adjustment</cbc:InstructionNote>
</cac:PaymentMeans>

C. Supply Date (KSA-5) & Buyer National Address (Checks #1–#3)

For all Standard (0100000) documents, ZATCA requires cac:Delivery/cbc:ActualDeliveryDate and complete seller/buyer street, building number (4 digits), postal code (5 digits), city, and country code (SA):

<cac:Delivery>
  <cbc:ActualDeliveryDate>2026-11-24</cbc:ActualDeliveryDate>
</cac:Delivery>

Common Errors When Running the 6 Compliance Checks (and How to Fix Them)

If /compliance/invoices returns 400 Bad Request or REJECTED, check our ZATCA Error Codes Directory for the exact BR-KSA-* code:

  1. BR-KSA-31 / INVALID_INVOICE_HASH: You modified whitespace, XML formatting, or added the QR code before computing the canonicalized (C14N11) SHA-256 hash. Always follow the official ZATCA sequence: canonicalize without UBLExtensions/QR/Signature → compute SHA-256 → sign with secp256k1 → inject UBLExtensions and 9-tag QR. See BR-KSA-31 fix.
  2. BR-KSA-40 / Invalid QR Structure: Simplified (0200000) compliance invoices must contain all 9 TLV tags (including Tag 6 invoice hash, Tag 7 ECDSA signature, Tag 8 public key, and Tag 9 CSID certificate signature). Verify your QR payload with our ZATCA QR Decoder.
  3. Previous Invoice Hash (PIH) Chain Broken: Even during the 6 compliance checks, your ICV (1, 2, 3...) and PIH (KSA-13) must chain cleanly. Document #1 uses the base64 SHA-256 of "0" (NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==), and Document #2 uses Document #1’s invoiceHash.
  4. Wrong Accept-Version Header: Always send Accept-Version: V2 and Content-Type: application/json on /compliance, /compliance/invoices, and /production/csids.

Skip the Manual XML & CSID Plumbing with Qeemah Cloud

Building, signing, and maintaining ZATCA Phase 2 compliance checks in-house requires ongoing cryptographic maintenance, ICV/PIH concurrency locking across branches, and immediate updates whenever ZATCA updates BR-KSA business rules.

With Qeemah Cloud:

Frequently Asked Questions

What are the 6 ZATCA Phase 2 compliance checks?

Before issuing a Production CSID, ZATCA's Fatoora onboarding API requires every E-Invoice Generation Solution (EGS) to pass compliance validation on 6 distinct UBL 2.1 XML document types: 1) Standard Tax Invoice (388, subtype 0100000), 2) Standard Credit Note (381, subtype 0100000), 3) Standard Debit Note (383, subtype 0100000), 4) Simplified Tax Invoice (388, subtype 0200000), 5) Simplified Credit Note (381, subtype 0200000), and 6) Simplified Debit Note (383, subtype 0200000).

Which endpoint is used to submit the 6 ZATCA compliance test invoices?

All 6 compliance documents are signed using the temporary Compliance CSID returned by the /compliance endpoint and submitted via POST to ZATCA's /compliance/invoices endpoint with the Accept-Version: V2 header and Basic Auth (Compliance binarySecurityToken : secret).

What happens if my CSR specifies invoiceType 1100 vs 1000 or 0100?

The 4-digit invoiceType flag in your CSR (e.g., 1100 for both Standard and Simplified, 1000 for Standard B2B only, 0100 for Simplified B2C only) determines which subset of the 6 compliance checks ZATCA requires before unlocking your Production CSID. Setting 1100 requires passing all 6 document types.

Why do ZATCA compliance checks return 400 Bad Request or BR-KSA errors?

The most common causes are: missing BillingReference (IBT-25) and InstructionNote (KSA-10) on credit/debit notes (381/383), missing SupplyDate (KSA-5) on Standard invoices, invalid ECDSA secp256k1 signature or canonicalized XML hash mismatch (BR-KSA-31), or missing 9-tag TLV QR code on Simplified invoices (BR-KSA-40).

How can I avoid building and maintaining ZATCA CSID onboarding manually?

Instead of maintaining custom CSR, ECDSA signing, PIH hash chaining, and compliance retry logic in-house, Saudi businesses use native ZATCA Phase 2 ERPs like Qeemah Cloud, which completes CSR generation, OTP onboarding, and all 6 compliance checks automatically in minutes.

Works Cited & Technical References

  1. Zakat, Tax and Customs Authority (ZATCA) — Electronic Invoicing (Fatoora) Phase 2 Onboarding & API Integration Specifications.
  2. ZATCA — E-Invoicing Security Features, CSR Configuration & Cryptographic Stamp (CSID) Guidelines.
  3. ZATCA — XML Implementation Standard (UBL 2.1) & Business Rules (BR-KSA).

Recommended next steps

Share this article