INTEGRATION / V1

Your first PDF request.

A template, an API key and JSON. This guide uses the same fictional data as the homepage preview.

01 / Create your template

Open the Console, save the example HTML as a template and copy its template_id. Create an API key for the same account. Keep the key on your server in SYSINVOICE_API_KEY; never embed it in browser code.

Console

The example template

This minimal A4 example supports one line item with quantity 1. Calculate totals in your application for more complex invoices. CSS is embedded; no remote assets or scripts are needed.

Download HTML template
The example template
<!doctype html>
<html lang="en"><head><meta charset="utf-8">
<style>
@page { size: A4; margin: 0; }
* { box-sizing: border-box; }
body { margin: 0; padding: 64px; color: #15223b; font: 15px Arial, sans-serif; }
header { display: flex; justify-content: space-between; border-bottom: 3px solid #0891b2; padding-bottom: 32px; }
h1 { font-size: 38px; margin: 0 0 10px; letter-spacing: -1px; }
h2 { font-size: 16px; margin: 0 0 8px; }
p { line-height: 1.7; }
.muted { color: #526078; font-size: 12px; }
.meta { margin: 38px 0; display: flex; justify-content: space-between; }
table { width: 100%; border-collapse: collapse; margin-top: 42px; }
th { padding: 14px 8px; text-align: left; background: #f1f5f9; color: #526078; font-size: 11px; }
td { padding: 22px 8px; border-bottom: 1px solid #dbe2eb; }
.right { text-align: right; }
.total { display: flex; justify-content: space-between; margin-top: 30px; padding: 24px 8px; background: #ecfeff; font-weight: bold; font-size: 20px; }
footer { margin-top: 180px; padding-top: 20px; border-top: 1px solid #dbe2eb; }
</style></head><body>
<header><div><h2>NORTHSTAR / STUDIO</h2><span class="muted">Digital products &amp; engineering</span></div><span class="muted">INVOICE</span></header>
<div class="meta"><div><h1>{{ .invoice_number }}</h1><span class="muted">Issued {{ .issued_at }}</span></div><div><span class="muted">BILL TO</span><p>Acme Labs<br>Sample account</p></div></div>
<table><thead><tr><th>DESCRIPTION</th><th class="right">QTY</th><th class="right">AMOUNT</th></tr></thead><tbody>
{{ range .line_items }}<tr><td>{{ .description }}</td><td class="right">{{ .qty }}</td><td class="right">{{ .amount }} {{ $.currency }}</td></tr>{{ end }}
</tbody></table>
<div class="total"><span>Total</span><span>{{ .total }} {{ .currency }}</span></div>
<p class="muted">Thank you for building with us.</p>
<footer class="muted">SysInvoice / Fictional example / One line item, quantity 1 / 01</footer>
</body></html>

02 / Make the request

Replace tpl_your_invoice_template with the ID returned by the Console. The JSON body accepts template_id and document_data, with a maximum size of 2 MiB. The sample is illustrative and does not call the API from this site.

Request
curl --fail-with-body --request POST \  https://api.sysinvoice.com/v1/invoices/generate \  --header "Authorization: Bearer $SYSINVOICE_API_KEY" \  --header 'Content-Type: application/json' \  --header 'Accept: application/pdf' \  --data '{  "template_id": "tpl_your_invoice_template",  "document_data": {    "invoice_number": "INV-2026-001",    "issued_at": "2026-11-10",    "currency": "EUR",    "line_items": [      {        "description": "API integration",        "qty": 1,        "price": 240,        "amount": "240.00"      }    ],    "total": "240.00"  }}' \  --output invoice.pdf
Example only: set your API key and replace template_id with your saved template ID.

03 / Handle the response

A successful request returns HTTP 200 and application/pdf bytes, with Cache-Control: no-store and an X-Request-Id for diagnostics. Save or stream the response in your application.

Open sample PDF

Handle failures explicitly

Malformed JSON returns 400; invalid credentials 401; an unknown template 404; invalid data 422. For 429, respect Retry-After. With --fail-with-body, cURL exits unsuccessfully for HTTP errors: inspect the response before treating the output as a PDF.