Accounting · E-invoicing
ZATCA Signing Units
The e-invoice generation solution units (EGS) registered with ZATCA. Under Phase 2 every invoice is stamped by one -- the branch’s own, or the company’s default -- and carries its counter (ICV) and the previous invoice’s hash (PIH). The private key and the ZATCA secrets are sealed and never shown. A TEST unit stamps with a self-signed certificate ZATCA would not accept: for demonstrations only.
/api/accounting/zatca-egs-unitsPublished as /api/v1/zatca-egs-unitsDownload specification (OpenAPI 3.1) Screen: ZATCA Signing Units
Overview
| Package | Accounting |
|---|---|
| Authentication | Bearer token: a service account's token (POST /api/auth/service-token) or, for the published path, an API key |
| Authorization | The caller's roles must hold Accounting › ZATCA Signing Units on the Roles screen: display for GET, add for POST, change for PUT, delete for DELETE; an action needs the grant of the button that runs it on the screen. |
| Table | acct.zatca_egs_units · kept per company (and organisational unit where it has one) |
| Record | Created, changed and (where the screen allows) deleted; key id |
| Rules | The same as the screen: validation, numbering, approvals, posting, the company the caller belongs to, and the audit trail. |
API reference
8 operations. Open one for its parameters, bodies, responses and a sample request.
GET/api/accounting/zatca-egs-unitsList zatca signing units
Query parameters
| Name | Description | Example |
|---|---|---|
limit | Rows per page (50 by default, at most 200) | limit=100 |
offset | Rows to skip | offset=200 |
q | Free-text search over the search columns | q=acme |
sort | column:asc or column:desc, several separated by commas | sort=created_at:desc |
filter | A JSON condition or group (see the filter language), URL-encoded; any field below can be filtered and sorted | filter={"col":"status","op":"eq","value":"open"} |
<field>=<value> | Shorthand for "field is value" |
Response 200
{
"rows": [
{
"id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"branch_unit_id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"code": "COD-000001",
"name": "Example",
"common_name": "Example",
"egs_serial": "text",
"organization_unit": "text",
"invoice_types": "text",
"location": "text",
"industry": "text",
"environment": "sandbox",
"status": "draft",
"is_default": true,
"is_test": true
}
],
"count": 1
}Sample request
curl "https://demo.tranxact.ai/api/accounting/zatca-egs-units?limit=20" \
-H "Authorization: Bearer $TOKEN"GET/api/accounting/zatca-egs-units/{id}Read one signing unit
Path parameters
| Name | Type | Description |
|---|---|---|
id | string (uuid) | The record's id, as a list returns it. |
Response 200
{
"id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"branch_unit_id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"code": "COD-000001",
"name": "Example",
"common_name": "Example",
"egs_serial": "text",
"organization_unit": "text",
"invoice_types": "text",
"location": "text",
"industry": "text",
"environment": "sandbox",
"status": "draft",
"is_default": true,
"is_test": true
}404 when no record with that id is visible to the caller.
Sample request
curl "https://demo.tranxact.ai/api/accounting/zatca-egs-units/3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73" \
-H "Authorization: Bearer $TOKEN"POST/api/accounting/zatca-egs-unitsCreate a signing unit
Request body
The record as JSON. Fields marked Yes are required.
| Field | Type | Required | Description |
|---|---|---|---|
branch_unit_id | uuid | No | Branch — Empty: the company’s own unit, for every invoice whose branch has none. |
code | text | Yes | Code |
name | text | Yes | Name |
common_name | text | Yes | Common name (CN) — The unit’s name or asset tracking number. |
egs_serial | text | Yes | EGS serial number — 1-<solution provider>|2-<model or version>|3-<serial number>, e.g. 1-Tranxact|2-ERP 2026.10|3-ed22f1d8-e6a2-1118-9b58-d9a8f11e445f |
organization_unit | text | No | Organization unit (OU) — The branch name; for a VAT group, the member’s 10-digit TIN. |
invoice_types | text | No | Invoice types (TSCZ) — 1100: tax and simplified invoices. 1000: tax invoices only. 0100: simplified only. |
location | text | No | Location — The branch’s short national address. |
industry | text | No | Industry |
environment | text | No | Environment Allowed: sandbox simulation production |
is_default | boolean | No | Default unit |
is_test | boolean | No | Test unit (self-signed, not for ZATCA) |
notes | text | No | Notes |
Sample body
{
"code": "COD-000001",
"name": "Example",
"common_name": "Example",
"egs_serial": "text",
"branch_unit_id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"organization_unit": "text",
"invoice_types": "text",
"location": "text"
}Response 201
{
"id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"branch_unit_id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"code": "COD-000001",
"name": "Example",
"common_name": "Example",
"egs_serial": "text",
"organization_unit": "text",
"invoice_types": "text",
"location": "text",
"industry": "text",
"environment": "sandbox",
"status": "draft",
"is_default": true,
"is_test": true
}Sample request
curl -X POST "https://demo.tranxact.ai/api/accounting/zatca-egs-units" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"code":"COD-000001","name":"Example","common_name":"Example","egs_serial":"text","branch_unit_id":"3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73","organization_unit":"text","invoice_types":"text","location":"text"}'PUT/api/accounting/zatca-egs-units/{id}Change a signing unit
Path parameters
| Name | Type | Description |
|---|---|---|
id | string (uuid) | The record's id, as a list returns it. |
Request body
Only the fields to change; fields left out keep their value.
| Field | Type | Required | Description |
|---|---|---|---|
branch_unit_id | uuid | No | Branch — Empty: the company’s own unit, for every invoice whose branch has none. |
code | text | Yes | Code |
name | text | Yes | Name |
common_name | text | Yes | Common name (CN) — The unit’s name or asset tracking number. |
egs_serial | text | Yes | EGS serial number — 1-<solution provider>|2-<model or version>|3-<serial number>, e.g. 1-Tranxact|2-ERP 2026.10|3-ed22f1d8-e6a2-1118-9b58-d9a8f11e445f |
organization_unit | text | No | Organization unit (OU) — The branch name; for a VAT group, the member’s 10-digit TIN. |
invoice_types | text | No | Invoice types (TSCZ) — 1100: tax and simplified invoices. 1000: tax invoices only. 0100: simplified only. |
location | text | No | Location — The branch’s short national address. |
industry | text | No | Industry |
environment | text | No | Environment Allowed: sandbox simulation production |
is_default | boolean | No | Default unit |
is_test | boolean | No | Test unit (self-signed, not for ZATCA) |
notes | text | No | Notes |
Sample body
{
"code": "COD-000001",
"name": "Example"
}Response 200
{
"id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"branch_unit_id": "3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73",
"code": "COD-000001",
"name": "Example",
"common_name": "Example",
"egs_serial": "text",
"organization_unit": "text",
"invoice_types": "text",
"location": "text",
"industry": "text",
"environment": "sandbox",
"status": "draft",
"is_default": true,
"is_test": true
}Sample request
curl -X PUT "https://demo.tranxact.ai/api/accounting/zatca-egs-units/3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"code":"COD-000001","name":"Example"}'DELETE/api/accounting/zatca-egs-units/{id}Delete a signing unit
Path parameters
| Name | Type | Description |
|---|---|---|
id | string (uuid) | The record's id, as a list returns it. |
Response 200
{ "deleted": true }Many documents are cancelled or reversed instead; the API refuses a delete the screen would refuse.
Sample request
curl -X DELETE "https://demo.tranxact.ai/api/accounting/zatca-egs-units/3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73" \
-H "Authorization: Bearer $TOKEN"POST/api/accounting/zatca-egs-units/{id}/test-certificateTest certificate
Path parameters
| Name | Type | Description |
|---|---|---|
id | string (uuid) | The record's id, as a list returns it. |
No body is required.
Response
200 or 201 with the record or result as JSON; a refusal is 409 or 422 with a sentence saying why.
Sample request
curl -X POST "https://demo.tranxact.ai/api/accounting/zatca-egs-units/3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73/test-certificate" \
-H "Authorization: Bearer $TOKEN"POST/api/accounting/zatca-egs-units/{id}/generate-csrGenerate csr
Path parameters
| Name | Type | Description |
|---|---|---|
id | string (uuid) | The record's id, as a list returns it. |
No body is required.
Response
200 or 201 with the record or result as JSON; a refusal is 409 or 422 with a sentence saying why.
Sample request
curl -X POST "https://demo.tranxact.ai/api/accounting/zatca-egs-units/3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73/generate-csr" \
-H "Authorization: Bearer $TOKEN"GET/api/accounting/zatca-egs-units/{id}/csrCsr
Path parameters
| Name | Type | Description |
|---|---|---|
id | string (uuid) | The record's id, as a list returns it. |
Response
200 with the data as JSON.
Sample request
curl "https://demo.tranxact.ai/api/accounting/zatca-egs-units/3f1c2a9e-5b7d-4c1e-9a2f-0d4b8e6c1a73/csr" \
-H "Authorization: Bearer $TOKEN"Data model
Every field of a signing unit, as the API returns it. Field names are the JSON keys; any of them can be filtered and sorted on a list.
| Field | Type | Access | Description |
|---|---|---|---|
id | uuid | read only | Id |
org_id | uuid | read only | Org id |
branch_unit_id | uuid | read, write | Branch — Empty: the company’s own unit, for every invoice whose branch has none. |
code | text | read, write | Code |
name | text | read, write | Name |
common_name | text | read, write | Common name (CN) — The unit’s name or asset tracking number. |
egs_serial | text | read, write | EGS serial number — 1-<solution provider>|2-<model or version>|3-<serial number>, e.g. 1-Tranxact|2-ERP 2026.10|3-ed22f1d8-e6a2-1118-9b58-d9a8f11e445f |
organization_unit | text | read, write | Organization unit (OU) — The branch name; for a VAT group, the member’s 10-digit TIN. |
invoice_types | text | read, write | Invoice types (TSCZ) — 1100: tax and simplified invoices. 1000: tax invoices only. 0100: simplified only. |
location | text | read, write | Location — The branch’s short national address. |
industry | text | read, write | Industry |
environment | text | read, write | Environment Allowed: sandbox simulation production |
status | text | read only | Status |
is_default | boolean | read, write | Default unit |
is_test | boolean | read, write | Test unit (self-signed, not for ZATCA) |
public_key_der | bytea | read only | Public key der |
csr | text | read only | Csr |
certificate | text | read only | Certificate |
certificate_serial | text | read only | Certificate serial |
certificate_issuer | text | read only | Certificate issuer |
certificate_expires_at | timestamp with time zone | read only | Certificate expires at |
compliance_csid | text | read only | Compliance csid |
compliance_request_id | text | read only | Compliance request id |
production_csid | text | read only | Production csid |
production_csid_expires_at | timestamp with time zone | read only | Production csid expires at |
onboarded_at | timestamp with time zone | read only | Onboarded at |
last_icv | bigint | read only | Last icv |
last_hash | text | read only | Last hash |
last_invoice_id | uuid | read only | Last invoice id |
last_stamped_at | timestamp with time zone | read only | Last stamped at |
notes | text | read, write | Notes |
created_at | timestamp with time zone | read only | Created at |
updated_at | timestamp with time zone | read only | Updated at |
created_by | uuid | read only | Created by |
updated_by | uuid | read only | Updated by |
org_unit_id | uuid | read only | Org unit id |
onboarding_step | text | read only | Onboarding step |
onboarding_step_at | timestamp with time zone | read only | Onboarding step at |
onboarding_message | text | read only | Onboarding message |
compliance_passed_at | timestamp with time zone | read only | Compliance passed at |
production_request_id | text | read only | Production request id |
pending_public_key_der | bytea | read only | Pending public key der |
pending_csr | text | read only | Pending csr |
renewed_at | timestamp with time zone | read only | Renewed at |
certificate_is_sample | boolean | read only | Certificate is sample |
expiry_warned_on | date | read only | Expiry warned on |
clearance_off_seen_at | timestamp with time zone | read only | Clearance off seen at |
xf_text_1 | text | read only | Xf text 1 |
xf_text_2 | text | read only | Xf text 2 |
xf_text_3 | text | read only | Xf text 3 |
xf_text_4 | text | read only | Xf text 4 |
xf_text_5 | text | read only | Xf text 5 |
xf_num_1 | numeric | read only | Xf num 1 |
xf_num_2 | numeric | read only | Xf num 2 |
xf_num_3 | numeric | read only | Xf num 3 |
xf_date_1 | date | read only | Xf date 1 |
xf_date_2 | date | read only | Xf date 2 |
Errors
| Status | Meaning |
|---|---|
| 400 | The request could not be read: a filter that is not JSON, a bad parameter |
| 401 | No credential, or it is wrong, revoked or expired |
| 403 | The caller's roles do not hold Accounting › ZATCA Signing Units for this verb, or the address or origin is not allowed |
| 404 | No record with that id is visible to the caller |
| 409 | A conflict: a duplicate number, a document in a state that does not allow it, or a record changed or locked by someone else |
| 422 | Refused by the same validation as the screen; the error names the field and why |
Every error is JSON: {"error": "a sentence saying what was wrong"}, with field where it applies.