Build on NFatoora
A simple REST API to issue ZATCA-compliant invoices from your own systems — with webhooks, sandbox and code samples.
https://api.nfatoora.com/v1
Sandboxhttps://sandbox.api.nfatoora.com/v1
Settings → Developers in your dashboard. Start with a sandbox key (nf_test_).
Send your first invoice to the sandbox — it never reaches your VAT return.
Switch to a live key once your device is onboarded with ZATCA.
API overview
Base URL
| Environment | URL |
|---|---|
| Production | https://api.nfatoora.com/v1 |
| Sandbox | https://sandbox.api.nfatoora.com/v1 |
The sandbox talks to ZATCA's developer environment, so its invoices never affect your VAT returns.
Format
- All requests and responses are JSON, UTF-8.
- Dates are ISO 8601 in UTC.
- Amounts are decimal numbers in SAR.
Pagination
Lists return data, has_more and next_cursor. Send cursor to get the next page and limit (max 100).
Idempotency
Send an Idempotency-Key (any unique value) with POST requests. Retrying with the same key within 24 hours returns the original result instead of creating a new invoice.
Versioning
The current version is v1. We never make breaking changes within a version and announce new versions 6 months in advance.
Authentication
Create a key under Settings → Developers in your dashboard and send it in the Authorization header:
curl https://api.nfatoora.com/v1/account \
-H "Authorization: Bearer nf_live_xxxxxxxxxxxxxxxx"
| Prefix | Use |
|---|---|
nf_test_ |
Sandbox |
nf_live_ |
Production |
A key can issue invoices on behalf of your business. Never put it in a mobile app or browser code — keep it in server-side environment variables only.
Scopes
Restrict each key to scopes — invoices:write, invoices:read, customers:write, webhooks:write — and optionally to one branch.
Rotating keys
Create a new key, deploy it, then revoke the old one. Each key shows when it was last used.
Errors
The API uses standard HTTP status codes and returns a consistent error object:
{
"error": {
"type": "validation_error",
"code": "invalid_vat_number",
"message": "vat_number must be 15 digits starting and ending with 3",
"field": "customer.vat_number",
"request_id": "req_8Hn2…"
}
}
| Status | Type | Meaning |
|---|---|---|
| 400 | validation_error |
Missing or invalid data |
| 401 | authentication_error |
Missing or invalid key |
| 403 | permission_error |
Key lacks the required scope |
| 404 | not_found |
Resource doesn't exist |
| 409 | idempotency_error |
Key reused with a different request |
| 422 | zatca_rejected |
ZATCA rejected the invoice — see zatca.errors |
| 429 | rate_limit_error |
Too many requests |
| 5xx | api_error |
Something went wrong on our side — retry |
Include the request_id when you contact support.
Rate limits
| Plan | Requests per minute |
|---|---|
| Branches | 600 |
| Sandbox | 120 |
Every response includes RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. Over the limit you get 429 with Retry-After in seconds.
For bulk invoicing, send at most 10 concurrent requests with an
Idempotency-Keyper invoice.
Webhooks
We send a POST to your URL when these events happen:
| Event | When |
|---|---|
invoice.created |
An invoice is created |
invoice.cleared |
A standard invoice is cleared |
invoice.reported |
A simplified invoice is reported |
invoice.rejected |
ZATCA rejects an invoice |
invoice.paid |
A payment is recorded |
credit_note.created |
A credit note is issued |
csid.expiring |
A device certificate expires within 30 days |
Verifying signatures
Every request carries NFatoora-Signature: t=1763548200,v1=<hex> where v1 = HMAC-SHA256(secret, t + "." + body). Reject requests older than 5 minutes.
$payload = file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_NFATOORA_SIGNATURE']), $sig);
$expected = hash_hmac('sha256', $sig['t'] . '.' . $payload, getenv('NFATOORA_WEBHOOK_SECRET'));
if (!hash_equals($expected, $sig['v1']) || abs(time() - (int) $sig['t']) > 300) {
http_response_code(400); exit;
}
const crypto = require('crypto');
function verify(rawBody, header, secret) {
const p = Object.fromEntries(header.split(',').map(x => x.split('=')));
const expected = crypto.createHmac('sha256', secret).update(p.t + '.' + rawBody).digest('hex');
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(p.v1)) && Math.abs(Date.now() / 1000 - p.t) < 300;
}
Retries
Return a 2xx within 10 seconds. On failure we retry up to 8 times over 24 hours with increasing delays. An event may arrive more than once — use event.id to ignore duplicates.
API reference
Invoices
Create an invoice
/v1/invoicesCreates a tax invoice, calculates VAT, generates UBL 2.1 XML with the cryptographic stamp and QR code, then submits it to ZATCA for clearance (standard) or reporting (simplified).
Send an Idempotency-Key header to safely retry without creating duplicates.
Parameters
| Field | Type | Description |
|---|---|---|
type |
string | standard (B2B, cleared) or simplified (B2C, reported). Optional — detected from the customer when omitted. |
customer_id |
string | Existing customer ID. Or send customer inline. |
lines[] |
array | Line items: description, quantity, unit_price, optional vat_rate (15, 0) and vat_category (S, Z, E, O). |
issue_date |
datetime | ISO 8601. Defaults to now. |
branch_id |
string | Branch/device that issues the invoice (multi-branch accounts). |
notes |
string | Free text printed on the invoice. |
send_via |
array | whatsapp, email — deliver to the customer after clearance. |
If ZATCA rejects the invoice, the response has status
rejectedand azatca.errorslist with details.
curl -X POST "https://api.nfatoora.com/v1/invoices" \
-H "Authorization: Bearer $NFATOORA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"customer_id": "cus_7Hd3",
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350
}
],
"send_via": [
"whatsapp"
]
}'const res = await fetch('https://api.nfatoora.com/v1/invoices', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"customer_id": "cus_7Hd3",
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350
}
],
"send_via": [
"whatsapp"
]
}),
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/invoices');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY'), 'Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"customer_id": "cus_7Hd3",
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350
}
],
"send_via": [
"whatsapp"
]
}
JSON,
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.post(
"https://api.nfatoora.com/v1/invoices",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"customer_id": "cus_7Hd3",
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350
}
],
"send_via": [
"whatsapp"
]
},
)
data = res.json() {
"id": "inv_9Ks2LmQ4",
"number": "INV-1024",
"type": "standard",
"status": "cleared",
"currency": "SAR",
"issue_date": "2026-11-19T10:30:00Z",
"customer": {
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003"
},
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350,
"vat_rate": 15,
"line_total": 1400
}
],
"subtotal": 1400,
"vat_total": 210,
"total": 1610,
"zatca": {
"uuid": "8e6f2c1a-4b7d-4e1a-9f3c-2d5b7a91c41a",
"icv": 1024,
"clearance_status": "CLEARED",
"qr": "AQ1BbCBBbWFs..."
},
"pdf_url": "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf",
"created_at": "2026-11-19T10:30:00Z"
}
List invoices
/v1/invoicesReturns invoices, newest first. Filter with status, customer_id, from, to; paginate with limit (max 100) and cursor.
curl "https://api.nfatoora.com/v1/invoices?status=cleared&limit=20" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/invoices?status=cleared&limit=20', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/invoices?status=cleared&limit=20');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/invoices?status=cleared&limit=20",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"data": [
{
"id": "inv_9Ks2LmQ4",
"number": "INV-1024",
"type": "standard",
"status": "cleared",
"currency": "SAR",
"issue_date": "2026-11-19T10:30:00Z",
"customer": {
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003"
},
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350,
"vat_rate": 15,
"line_total": 1400
}
],
"subtotal": 1400,
"vat_total": 210,
"total": 1610,
"zatca": {
"uuid": "8e6f2c1a-4b7d-4e1a-9f3c-2d5b7a91c41a",
"icv": 1024,
"clearance_status": "CLEARED",
"qr": "AQ1BbCBBbWFs..."
},
"pdf_url": "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf",
"created_at": "2026-11-19T10:30:00Z"
}
],
"has_more": false,
"next_cursor": null
}
Retrieve an invoice
/v1/invoices/{id}Returns a single invoice including its ZATCA clearance/reporting status.
curl "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"id": "inv_9Ks2LmQ4",
"number": "INV-1024",
"type": "standard",
"status": "cleared",
"currency": "SAR",
"issue_date": "2026-11-19T10:30:00Z",
"customer": {
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003"
},
"lines": [
{
"description": "Split AC installation",
"quantity": 4,
"unit_price": 350,
"vat_rate": 15,
"line_total": 1400
}
],
"subtotal": 1400,
"vat_total": 210,
"total": 1610,
"zatca": {
"uuid": "8e6f2c1a-4b7d-4e1a-9f3c-2d5b7a91c41a",
"icv": 1024,
"clearance_status": "CLEARED",
"qr": "AQ1BbCBBbWFs..."
},
"pdf_url": "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf",
"created_at": "2026-11-19T10:30:00Z"
}
Download PDF
/v1/invoices/{id}/pdfReturns the bilingual PDF/A-3 with the XML embedded. Add ?lang=ar or ?lang=en for the primary language.
curl "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf?lang=ar" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf?lang=ar', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf?lang=ar');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/pdf?lang=ar",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="INV-1024.pdf"
Download XML
/v1/invoices/{id}/xmlReturns the signed UBL 2.1 XML exactly as submitted to ZATCA.
curl "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/xml" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/xml', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/xml');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/xml",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() <?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
<cbc:ProfileID>reporting:1.0</cbc:ProfileID>
<cbc:ID>INV-1024</cbc:ID>
<cbc:UUID>8e6f2c1a-4b7d-4e1a-9f3c-2d5b7a91c41a</cbc:UUID>
…
</Invoice>
Create a credit note
/v1/invoices/{id}/credit-notesCreates a credit note linked to the original invoice and submits it to ZATCA. reason is required by ZATCA. Use /debit-notes for a debit note.
curl -X POST "https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/credit-notes" \
-H "Authorization: Bearer $NFATOORA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"reason": "Returned one AC unit",
"lines": [
{
"description": "Split AC installation",
"quantity": 1,
"unit_price": 350
}
]
}'const res = await fetch('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/credit-notes', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"reason": "Returned one AC unit",
"lines": [
{
"description": "Split AC installation",
"quantity": 1,
"unit_price": 350
}
]
}),
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/credit-notes');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY'), 'Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"reason": "Returned one AC unit",
"lines": [
{
"description": "Split AC installation",
"quantity": 1,
"unit_price": 350
}
]
}
JSON,
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.post(
"https://api.nfatoora.com/v1/invoices/inv_9Ks2LmQ4/credit-notes",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"reason": "Returned one AC unit",
"lines": [
{
"description": "Split AC installation",
"quantity": 1,
"unit_price": 350
}
]
},
)
data = res.json() {
"id": "crn_3Fa1",
"number": "CRN-0042",
"type": "credit_note",
"status": "cleared",
"original_invoice": "inv_9Ks2LmQ4",
"total": -402.5
}
Customers
Create a customer
/v1/customersAdds a customer to your directory. The VAT number format is validated.
Parameters
| Field | Type | Description |
|---|---|---|
name |
string | Legal name. Required. |
vat_number |
string | 15-digit VAT number (starts and ends with 3). Required for standard invoices. |
cr_number |
string | Commercial registration number. |
email |
string | Invoice delivery email. |
phone |
string | WhatsApp number in E.164 format. |
address |
object | National address: building, street, district, city, postal_code, country. |
curl -X POST "https://api.nfatoora.com/v1/customers" \
-H "Authorization: Bearer $NFATOORA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
}
}'const res = await fetch('https://api.nfatoora.com/v1/customers', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
}
}),
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/customers');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY'), 'Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
}
}
JSON,
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.post(
"https://api.nfatoora.com/v1/customers",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
}
},
)
data = res.json() {
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
},
"created_at": "2026-11-01T08:00:00Z"
}
List customers
/v1/customersLists customers; search with q (name or VAT number).
curl "https://api.nfatoora.com/v1/customers?q=elite&limit=20" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/customers?q=elite&limit=20', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/customers?q=elite&limit=20');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/customers?q=elite&limit=20",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"data": [
{
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
},
"created_at": "2026-11-01T08:00:00Z"
}
],
"has_more": false,
"next_cursor": null
}
Retrieve a customer
/v1/customers/{id}Returns a single customer.
curl "https://api.nfatoora.com/v1/customers/cus_7Hd3" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/customers/cus_7Hd3', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/customers/cus_7Hd3');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/customers/cus_7Hd3",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"email": "ap@elite.sa",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
},
"created_at": "2026-11-01T08:00:00Z"
}
Update a customer
/v1/customers/{id}Updates only the fields you send. Previously issued invoices are not changed.
curl -X PATCH "https://api.nfatoora.com/v1/customers/cus_7Hd3" \
-H "Authorization: Bearer $NFATOORA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "finance@elite.sa"
}'const res = await fetch('https://api.nfatoora.com/v1/customers/cus_7Hd3', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"email": "finance@elite.sa"
}),
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/customers/cus_7Hd3');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"email": "finance@elite.sa"
}
JSON,
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.patch(
"https://api.nfatoora.com/v1/customers/cus_7Hd3",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
json={
"email": "finance@elite.sa"
},
)
data = res.json() {
"email": "finance@elite.sa",
"id": "cus_7Hd3",
"name": "Elite Contracting Co.",
"vat_number": "300456789100003",
"cr_number": "1010123456",
"phone": "+966551234567",
"address": {
"building": "7235",
"street": "King Fahd Rd",
"district": "Al Olaya",
"city": "Riyadh",
"postal_code": "12214",
"country": "SA"
},
"created_at": "2026-11-01T08:00:00Z"
}
Products
Create a product
/v1/productsSaves a product or service with its price and VAT category for invoices and voice messages.
curl -X POST "https://api.nfatoora.com/v1/products" \
-H "Authorization: Bearer $NFATOORA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "AC maintenance",
"name_ar": "صيانة مكيف",
"unit_price": 250,
"unit": "service",
"vat_category": "S",
"vat_rate": 15
}'const res = await fetch('https://api.nfatoora.com/v1/products', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"name": "AC maintenance",
"name_ar": "صيانة مكيف",
"unit_price": 250,
"unit": "service",
"vat_category": "S",
"vat_rate": 15
}),
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/products');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY'), 'Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"name": "AC maintenance",
"name_ar": "صيانة مكيف",
"unit_price": 250,
"unit": "service",
"vat_category": "S",
"vat_rate": 15
}
JSON,
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.post(
"https://api.nfatoora.com/v1/products",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"name": "AC maintenance",
"name_ar": "صيانة مكيف",
"unit_price": 250,
"unit": "service",
"vat_category": "S",
"vat_rate": 15
},
)
data = res.json() {
"id": "prd_2Qa9",
"name": "AC maintenance",
"name_ar": "صيانة مكيف",
"unit_price": 250,
"unit": "service",
"vat_category": "S",
"vat_rate": 15
}
List products
/v1/productsLists products and services.
curl "https://api.nfatoora.com/v1/products?limit=50" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/products?limit=50', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/products?limit=50');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/products?limit=50",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"data": [
{
"id": "prd_2Qa9",
"name": "AC maintenance",
"name_ar": "صيانة مكيف",
"unit_price": 250,
"unit": "service",
"vat_category": "S",
"vat_rate": 15
}
],
"has_more": false,
"next_cursor": null
}
Webhooks
Create a webhook endpoint
/v1/webhook-endpointsRegisters a URL to receive events. The secret is shown once — store it to verify signatures. See the webhooks guide.
curl -X POST "https://api.nfatoora.com/v1/webhook-endpoints" \
-H "Authorization: Bearer $NFATOORA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"url": "https://example.com/nfatoora/webhook",
"events": [
"invoice.cleared",
"invoice.rejected",
"invoice.paid"
]
}'const res = await fetch('https://api.nfatoora.com/v1/webhook-endpoints', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"url": "https://example.com/nfatoora/webhook",
"events": [
"invoice.cleared",
"invoice.rejected",
"invoice.paid"
]
}),
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/webhook-endpoints');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY'), 'Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"url": "https://example.com/nfatoora/webhook",
"events": [
"invoice.cleared",
"invoice.rejected",
"invoice.paid"
]
}
JSON,
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.post(
"https://api.nfatoora.com/v1/webhook-endpoints",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"url": "https://example.com/nfatoora/webhook",
"events": [
"invoice.cleared",
"invoice.rejected",
"invoice.paid"
]
},
)
data = res.json() {
"id": "whe_5Tz1",
"url": "https://example.com/nfatoora/webhook",
"events": [
"invoice.cleared",
"invoice.rejected",
"invoice.paid"
],
"secret": "whsec_…",
"active": true
}
List webhook endpoints
/v1/webhook-endpointsLists registered endpoints (secrets are not returned).
curl "https://api.nfatoora.com/v1/webhook-endpoints" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/webhook-endpoints', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/webhook-endpoints');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/webhook-endpoints",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"data": [
{
"id": "whe_5Tz1",
"url": "https://example.com/nfatoora/webhook",
"events": [
"invoice.cleared",
"invoice.rejected",
"invoice.paid"
],
"active": true
}
],
"has_more": false,
"next_cursor": null
}
Delete a webhook endpoint
/v1/webhook-endpoints/{id}Stops sending events to this endpoint.
curl -X DELETE "https://api.nfatoora.com/v1/webhook-endpoints/whe_5Tz1" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/webhook-endpoints/whe_5Tz1', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/webhook-endpoints/whe_5Tz1');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.delete(
"https://api.nfatoora.com/v1/webhook-endpoints/whe_5Tz1",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"id": "whe_5Tz1",
"deleted": true
}
Account
Account & compliance status
/v1/accountReturns your business details and the CSID status and expiry for each branch.
curl "https://api.nfatoora.com/v1/account" \
-H "Authorization: Bearer $NFATOORA_API_KEY"const res = await fetch('https://api.nfatoora.com/v1/account', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.NFATOORA_API_KEY}`,
},
});
const data = await res.json();$ch = curl_init('https://api.nfatoora.com/v1/account');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NFATOORA_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);import os, requests
res = requests.get(
"https://api.nfatoora.com/v1/account",
headers={"Authorization": f"Bearer {os.environ['NFATOORA_API_KEY']}"},
)
data = res.json() {
"business": {
"name": "Al Amal Cooling Est.",
"vat_number": "310123456700003"
},
"plan": "store",
"branches": [
{
"id": "br_main",
"name": "Riyadh HQ",
"csid_status": "active",
"csid_expires_at": "2027-11-01T00:00:00Z"
}
]
}
Need help integrating? Our engineers reply on WhatsApp and support tickets.