Baytelmal e-invoice API

API docs

Base URL https://baytelmal.com. JSON in, JSON out. No key is needed on the free tier (100 calls a day per IP address, reset at 00:00 UTC). Machine-readable: openapi.json.

Quick start

curl -s https://baytelmal.com/v1/samples/ksa \
  | curl -s -X POST https://baytelmal.com/v1/ksa/check \
      -H "Content-Type: application/json" --data-binary @-

Endpoints

Method and pathWhat it does
POST /v1/ksa/invoiceBuilds an unsigned ZATCA UBL 2.1 invoice, credit note, debit note or prepayment invoice. Returns xml, invoiceHash, qrPayload (TLV tags 1 to 6, base64), counterValue (ICV), previousHash (PIH), subtype, warnings, notes.
POST /v1/uae/invoiceBuilds a PINT-AE UBL invoice or credit note (customization urn:peppol:pint:billing-1@ae-1). Returns xml, documentHash, warnings, notes.
POST /v1/ksa/check
POST /v1/uae/check
Pre-flight check of the invoice data. Returns passed, errors, warnings, notes, checksRun and scope.
POST /v1/ksa/qr/decodeBody {"qr": "<base64>"}. Returns the decoded fields, the phase and any problems.
POST /v1/ksa/qr/encodeBody with sellerName, vatNumber, timestamp, totalWithVat, vatTotal and optional invoiceHash. Returns qrPayload (tags 1 to 5, or 1 to 6).
GET /v1/tax-number?country=SA&value=…Format check for a Saudi VAT number (SA) or UAE TRN (AE). Not a registry lookup.
GET /v1/uae/deadline?revenue_aed=…The UAE provider-appointment date and mandatory date for a business of that size.
GET /v1/samples/ksa
GET /v1/samples/uae
A complete sample invoice to start from (does not count against the limit).
POST /mcpMCP server (Streamable HTTP, JSON responses). See MCP server.
GET /healthService status.

The invoice JSON

Amounts are decimal strings ("46200.00") or numbers, with no more decimals than the currency allows. Dates are YYYY-MM-DD, times HH:MM:SS.

FieldRequiredNotes
invoiceNumberyesYour invoice number.
uuidrecommendedRFC 4122 UUID. Generated if missing (store it).
typeCodenoinvoice (default), credit_note, debit_note, prepayment.
transactionTypenob2b (default), b2c, b2g, export. In Saudi Arabia B2C gives a simplified invoice.
issueDate, issueTimeyesdueDate optional.
currencyyesFor example SAR, AED.
supplier, customeryeslegalNameEn, address {street, city, countryCode, optional buildingNumber, postalCode, district, additionalNumber, province}; optional legalNameAr, taxRegistrationNumber, registrationNumber, networkId (UAE Peppol ID).
lines[]yesdescriptionEn, quantity, unitPrice, netAmount, taxCategory (standard, zero_rated, exempt, out_of_scope, reverse_charge), taxRate, taxAmount; optional discountAmount, unitCode (default PCE), taxExemptionReasonCode, taxExemptionReasonText, itemCode, descriptionAr.
totalNet, totalTax, totalGrossyesprepaidAmount optional.
counterValue, previousDocumentHashSaudiYour running invoice counter (ICV) and the previous invoice's hash (PIH). Defaults: 1 and the hash of "0".
correctedInvoiceNumber, correctionReasoncredit/debit notesThe original invoice and why it is corrected.

Errors and limits

Questions or a field you need: [email protected] (English).