Skip to content

Database tables ​

All tables use the prefix zatca_ (configurable). On MySQL/MariaDB they are InnoDB.

Read, don't write

Reading these tables for reports is fine. Never insert, update or delete counters, issuances, chain entries or submissions yourself: the invoice chain's guarantees depend on the package doing it inside locked transactions.

Organisation and devices ​

TableContent
companiesYour companies (tenants of the package); external_ref = your own ID
vat_registrationsVAT number, legal name, seller IDs, address
branchesStores / branches of a company; external_ref = your own ID
devicesDevices (EGS units), environment, lifecycle status
device_keysEncrypted private keys (history kept)
certificatesCompliance and production certificates, validity
device_onboardingsOnboarding attempts with step results
device_renewalsRenewal attempts

Invoices ​

TableContent
invoicesInvoice records and current statuses; source_type/source_id link to your record; credited_amount, debited_amount, cancellation_invoice_id, closed_at
invoice_linesCalculated lines per signed document (append-only)
invoice_vat_breakdownVAT per category/rate per signed document (append-only)
invoice_versionsOriginal JSON and corrections (append-only)
invoice_issuancesLegal documents: UUID, ICV, PIH, hash, QR, status
invoice_countersPer device: last ICV and last hash (the chain head)
chain_entriesLedger of every ICV per device (unique keys prevent duplicates and forks)
invoice_artifactsPointers to stored XML (signed, cleared) with SHA-256
invoice_draftsDrafts (reserved for the dashboard)

Submission ​

TableContent
b2c_reporting_submissionsOne per B2C issuance: status, attempts, lease, next retry
b2b_clearance_submissionsOne per B2B issuance
submission_attemptsEvery HTTP call to ZATCA: status, duration, sanitised response
outboxTransactional outbox for queue dispatch

Errors, history, audit ​

TableContent
errorsErrors with category, severity, code, resolution
error_groupsGrouped similar errors with counts
warningsLocal and ZATCA warnings
processing_logsEvery status transition (time, actor, reason)
audit_logsHash-chained audit trail

Other ​

TableContent
settingsRuntime settings
stats_dailyDaily counters (dashboard)
bulk_operations, bulk_operation_itemsBulk actions (dashboard)

Not affiliated with or endorsed by ZATCA. Verify regulatory requirements with ZATCA and your tax advisor.