About this endpoint
What it does
Creates an invoice PDF in Arabic, English or both from the invoice data you send. It returns the PDF with the subtotal, tax and total worked out from your line items.
Request Body
| Parameter | Type | Description |
|---|---|---|
| number | String | Required. Invoice number. 1 to 60 characters. |
| date | String | Required. Invoice date, printed as sent. 1 to 40 characters. |
| currency | String | Required. Currency code or label printed next to amounts, for example SAR. 1 to 10 characters. |
| seller | Object | Required. Seller details printed on the invoice. |
| seller.name | String | Required. Seller name. 1 to 200 characters. |
| seller.name_en | String | Seller name in English, used in bilingual layouts. 1 to 200 characters. |
| seller.email | String | Seller email. 1 to 200 characters. |
| seller.phone | String | Seller phone number. 1 to 40 characters. |
| seller.address | String | Seller address. 1 to 500 characters. |
| seller.cr_number | String | Seller commercial registration (CR) number. 1 to 40 characters. |
| seller.tax_number | String | Seller tax or VAT number. 1 to 40 characters. |
| buyer | Object | Buyer details printed on the invoice. If you send it, buyer.name is required. Same fields as seller. |
| lines | Object Array | Required. Invoice line items. Min 1 item. Max 500 items. |
| lines[].description | String | Required. Line description. 1 to 500 characters. |
| lines[].description_en | String | Line description in English, used in bilingual layouts. 1 to 500 characters. |
| lines[].quantity | Number | Required. Quantity. Minimum: 0. |
| lines[].unit_price | Number | Required. Price per unit. Minimum: 0. |
| lines[].discount | Number | Flat discount amount in the invoice currency, not a percent. Minimum: 0. Must not be more than quantity × unit_price. |
| lines[].tax_percent | Number | Tax rate for this line in percent. Range: 0 to 100. |
| title | String | Heading printed on the invoice. 1 to 100 characters. |
| due_date | String | Payment due date, printed as sent. 1 to 40 characters. |
| notes | String | Free-text notes printed near the bottom. 1 to 2,000 characters. |
| amount_in_words | String | Total in words, printed as sent. The API does not write it for you. 1 to 500 characters. |
| qr_text | String | Text to encode in a QR code on the invoice. 1 to 2,000 characters. |
| language | ENUM | Language of the labels. Allowed values: ar, en, bilingual. |
| direction | ENUM | Text direction. Allowed values: auto, rtl, ltr. Default: auto (right-to-left when the content has Arabic). |
| font | ENUM | Font family. Allowed values: naskh, kufi, sans, amiri. Default: naskh. |
| format | ENUM | Page size. Allowed values: A4, A5, Letter, Legal, receipt-80mm, receipt-58mm. Default: A4. |
| landscape | Boolean | Render the page in landscape. |
| margin_mm | Number | Page margin in millimetres. Range: 0 to 40. |
| page_numbers | Boolean | Print page numbers. |
| decimals | Integer | Number of decimal places for amounts. Range: 0 to 3. |
| accent_color | String | Accent colour as a hex value, for example #0F766E. |
| logo_url | String | Logo as an http(s) URL or a data:image/ URI. Up to 2,000,000 characters. |
| header_html | String | Custom HTML for the page header. 1 to 20,000 characters. |
| footer_html | String | Custom HTML for the page footer. 1 to 20,000 characters. |
| filename | String | File name for the PDF. Letters, digits, spaces, dots, dashes and underscores, up to 100 characters. |
| output | ENUM | Allowed values: base64, binary. Default: base64. binary returns the PDF file itself. |
Response
Returns a JSON object with data and meta (status 201). data holds the PDF as base64 and the totals. When output is binary, the response is the PDF file itself (status 200, application/pdf).
| Parameter | Type | Description |
|---|---|---|
| data.pdf_base64 | String | The invoice PDF, base64-encoded. |
| data.bytes | Integer | Size of the PDF in bytes. |
| data.pages | Integer | Number of pages in the PDF. |
| data.totals.subtotal | Number | Sum of quantity × unit_price minus discounts. |
| data.totals.tax | Number | Total tax across all lines. |
| data.totals.total | Number | subtotal + tax. |
| meta.request_id | String | Request identifier. |
| meta.version | String | API version, for example v1. |
Notes
- Long invoices flow onto more pages.
- Errors return status
422witherror.code,error.message,error.fieldanderror.detail.validation_errormeans a field is missing or invalid.invalid_discountmeans a line discount is more than the line amount. - The API does not submit invoices to a tax authority.



