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.
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:
- Standard Tax Invoice (
TypeCode: 388,name: 0100000) - Standard Credit Note (
TypeCode: 381,name: 0100000) - Standard Debit Note (
TypeCode: 383,name: 0100000) - Simplified Tax Invoice (
TypeCode: 388,name: 0200000) - Simplified Credit Note (
TypeCode: 381,name: 0200000) - 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:
| Stage | API Endpoint | Auth Method | Key Input | Output |
|---|---|---|---|---|
| 1. Generate Key & CSR | Local (secp256k1) | N/A | Organization VAT (3...3), EGS Serial, invoiceType (1100) | Private Key (kept secret) + Base64 CSR |
| 2. Get Compliance CSID | POST /compliance | Header: OTP (6 digits from Fatoora) | Base64 CSR | requestID, Compliance binarySecurityToken, secret |
| 3. Pass 6 Compliance Checks | POST /compliance/invoices | Basic Auth (Compliance Token : Secret) | Signed UBL 2.1 XML + invoiceHash + uuid (×6) | validationResults.status: PASS |
| 4. Get Production CSID | POST /production/csids | Basic Auth (Compliance Token : Secret) | compliance_request_id (from Stage 2) | Live Production binarySecurityToken + secret |
Important: Note that your
invoiceTypebitmask in the CSR (1100= Standard + Simplified,1000= Standard B2B only,0100= Simplified B2C only) controls which checks are enforced. If you set1100, you must pass all 6 checks before/production/csidssucceeds.
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 Type | InvoiceTypeCode | name Attribute | Key Mandatory Fields That Cause Rejections |
|---|---|---|---|---|
| 1 | Standard Tax Invoice (B2B) | 388 | 0100000 | Buyer VAT/TIN or CRN, Buyer National Address, SupplyDate (KSA-5) |
| 2 | Standard Credit Note (B2B) | 381 | 0100000 | BillingReference (IBT-25) + InstructionNote reason (KSA-10) |
| 3 | Standard Debit Note (B2B) | 383 | 0100000 | BillingReference (IBT-25) + InstructionNote reason (KSA-10) |
| 4 | Simplified Tax Invoice (B2C) | 388 | 0200000 | Must include 9-tag TLV QR Code (signed with Compliance CSID) |
| 5 | Simplified Credit Note (B2C) | 381 | 0200000 | BillingReference + InstructionNote (KSA-10) + 9-tag TLV QR |
| 6 | Simplified Debit Note (B2C) | 383 | 0200000 | BillingReference + 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:
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 withoutUBLExtensions/QR/Signature→ compute SHA-256 → sign withsecp256k1→ injectUBLExtensionsand 9-tag QR. SeeBR-KSA-31fix.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.- Previous Invoice Hash (
PIH) Chain Broken: Even during the 6 compliance checks, yourICV(1, 2, 3...) andPIH(KSA-13) must chain cleanly. Document #1 uses the base64 SHA-256 of"0"(NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==), and Document #2 uses Document #1’sinvoiceHash. - Wrong
Accept-VersionHeader: Always sendAccept-Version: V2andContent-Type: application/jsonon/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:
-
Generate
secp256k1keys, CSRs, and enter your 6-digit Fatoora OTP directly inside Company Settings. -
Qeemah automatically executes and passes all 6 ZATCA compliance checks in seconds to activate your Production CSID.
-
Every live B2B invoice clears in real time, and every B2C POS receipt reports automatically—with zero middleware fees.
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.