REST API · v1
Generate invoices from your own code
Send JSON, get back a print-ready PDF or a UBL 2.1 XML e-invoice. The same engine that powers our editor, ready for your app, CRM or billing system.
Authentication
API access is included in the Pro plan. Generate a key on your account page. Send it as a bearer token with every request:
Authorization: Bearer YOUR_API_KEY
Endpoints
POST
https://www.invoicetemplategen.com/api/v1/documents/pdf/
Returns application/pdf — the rendered document.
curl -X POST https://www.invoicetemplategen.com/api/v1/documents/pdf/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @invoice.json -o invoice.pdf
POST
https://www.invoicetemplategen.com/api/v1/documents/ubl/
Returns application/xml — a UBL 2.1 Invoice (or CreditNote for credit-note types).
curl -X POST https://www.invoicetemplategen.com/api/v1/documents/ubl/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @invoice.json -o invoice.xml
POST
https://www.invoicetemplategen.com/api/v1/documents/totals/
Returns JSON with subtotal, discount, tax, shipping, total and balance due.
curl -X POST https://www.invoicetemplategen.com/api/v1/documents/totals/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @invoice.json
Request body
All fields are optional except type. Totals are always calculated for you.
| Field | Type | Description |
|---|---|---|
| type | string | Document type slug: invoice, quote, estimate, receipt, proforma-invoice, credit-note, purchase-order, sales-order, timesheet, work-order, account-statement, packing-slip |
| template | string | modern, classic or minimal |
| accent | string | Hex colour, e.g. #148a79 |
| currency | string | ISO 4217 code, e.g. USD, EUR, GBP |
| logo | string | Base64 data URI (PNG/JPG/WebP), max ~1 MB |
| from / bill_to / ship_to | string | Multi-line address blocks; the first line is the party name |
| number, po_number, payment_terms | string | Free text |
| date, due_date | date | YYYY-MM-DD |
| items[] | array | Objects with description, quantity, rate |
| discount, tax | number | Combined with discount_type / tax_type: percent (default) or flat |
| tax_label | string | e.g. VAT, GST, Sales Tax |
| shipping, amount_paid | number | Flat amounts |
| notes, terms | string | Footer text |
| labels | object | Override any label, e.g. {"title": "TAX INVOICE"} |
Example invoice.json
{
"type": "invoice",
"template": "modern",
"accent": "#148a79",
"currency": "USD",
"number": "INV-0042",
"date": "2026-10-19",
"due_date": "2026-11-18",
"payment_terms": "Net 30",
"from": "Acme Studio\n12 Market Street\nSpringfield",
"bill_to": "Globex Corp\n500 Industrial Way\nShelbyville",
"items": [
{
"description": "Website design",
"quantity": 1,
"rate": 2400
},
{
"description": "Hosting (12 months)",
"quantity": 12,
"rate": 25
}
],
"tax": 8.5,
"tax_label": "Sales Tax",
"discount": 10,
"discount_type": "percent",
"notes": "Thank you for your business!"
}
Errors & limits
- 401 — missing or invalid API key.
- 422 — validation failed; the response lists an
errorsobject keyed by field. - 429 — rate limit exceeded (60 requests per minute per key).