Generate invoices from HTML, in one API call
invoice PDF API
Store your invoice layout once, POST the numbers, and get a print-perfect PDF back in ~400ms. An invoice is the one document your customer keeps, forwards to their accountant, and pays from — so it has to total correctly, read like your brand, and stay sharp whether it runs one line or forty.
No credit card · 25 free credits to start
OVERVIEW
What is the invoice PDF API?
The invoice PDF API is an HTTP endpoint that converts an HTML invoice into a PDF in one request. You store your invoice layout as a template, POST the invoice data as JSON to /v1/render, and receive print-ready PDF bytes back in about 400ms — VAT lines, multi-page tables, your fonts and logo intact.
An invoice is the one document your customer files, forwards to their accountant, and pays from — so it has to total correctly, read like your brand, and stay legible whether it runs one line or forty. That makes it a surprisingly demanding thing to generate: part layout engine, part tax math, part typography.
Generating invoices from HTML is the pragmatic answer. HTML and CSS are the most capable, best-documented layout system there is — you already know them, any designer can touch them, and they give you pixel-level control over tables, totals, fonts and page breaks. The hard part was never the design; it was turning that HTML into a faithful, multi-page PDF at scale. That is the one thing this API does.
You store your invoice layout once as a template, POST the numbers for each invoice, and get print-ready application/pdf bytes back in roughly 400 milliseconds — VAT lines, repeating table headers, your logo and web fonts intact. No headless-Chrome cluster to run, no PDF library to fight, and nothing of the document is kept on our side. When a refund or adjustment comes in, you can issue a matching credit note PDF from the same template family.
THE PROBLEM
Generating invoices in-house is a two-week project you'll maintain forever
Turning HTML into a clean PDF yourself means running headless Chrome and everything around it. Here's the work you skip.
- Running headless Chrome just to turn an HTML invoice into a PDF — and patching it forever.
- Hand-solving page breaks and repeating the table header when a long invoice spills onto page two.
- Getting the € glyph, web fonts and the 21% VAT line to render exactly like the screen.
- Building a queue because a synchronous render blocks the checkout request.
THE SOLUTION
From your data to a finished invoice, in one request
Store your invoices layout once, then POST the values to /v1/render and get print-ready application/pdfbytes back in roughly 400ms. Merge is plain{{ }} /{{{ }}} and dotted keys — no template loops to learn, so repeating rows are rendered to HTML and dropped in through one raw placeholder.
- VAT-ready, multi-page. Subtotal, tax and total lines lay out cleanly, and a long invoice repeats its table header and footer on every page.
- Your brand on every invoice. It is your own HTML/CSS — logo, fonts and accent colour read from data so one template covers every client.
- Render on the click. ~400ms synchronous renders mean you can generate the invoice on the request that creates the order, not in a background job.
curl https://api.pdfinvoiceapi.com/v1/render \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"template": "tpl_invoice",
"data": {
"number": "INV-1024",
"issued": "2026-06-24",
"billTo": { "name": "Globex LLC", "vat": "NL8201..." },
"rowsHtml": "<tr><td>Design retainer</td><td>€1,200.00</td></tr><tr><td>Edge hosting</td><td>€40.00</td></tr>",
"subtotal": "€1,240.00",
"vat": "€260.40",
"total": "€1,500.40"
},
"pdf": { "format": "A4", "margin": "18mm", "printBackground": true }
}' \
-o invoice.pdfHOW TO
How to generate invoices from HTML
- 01
Design the invoice in HTML
Build (or paste) your invoice as plain HTML and CSS — the same markup you would put on a web page. Mark the dynamic bits with {{ placeholders }}: the number, dates, bill-to block and totals.
- 02
Store it once as a template
Save the layout in the dashboard and get a tpl_ id back. From then on every invoice is just data — your requests stay tiny and the look never drifts between customers.
- 03
POST the data to /v1/render
Send the template id plus a JSON data object with your API key. For the line items, render the rows to HTML and pass them through one raw {{{ rowsHtml }}} placeholder — the merge engine is deliberately loop-free.
- 04
Stream the PDF back
The response body is the PDF. Attach it to the order email, drop it in your bucket, or return it straight to the browser — all in the request that created the invoice.
WHAT YOU GET
The features that matter for invoices
VAT-ready, multi-page
Subtotal, tax and total lines lay out cleanly, and a long invoice repeats its table header and footer on every page.
Your brand on every invoice
It is your own HTML/CSS — logo, fonts and accent colour read from data so one template covers every client.
Render on the click
~400ms synchronous renders mean you can generate the invoice on the request that creates the order, not in a background job.
FAQ
Invoices on PDFInvoiceAPI — common questions
- How do I generate an invoice PDF from HTML?
- Design the invoice as HTML/CSS with {{ placeholders }}, store it once as a template, then POST the template id and a JSON data object to /v1/render. You get application/pdf bytes back in one synchronous call — no SDK to install and no browser to run yourself.
- Can it handle multi-page invoices with many line items?
- Yes. A long invoice flows onto as many pages as it needs, and the table header and footer repeat on every page. Because the merge engine has no loops, you render the rows to HTML yourself and drop them in through a single raw {{{ }}} placeholder.
- Does it support VAT, tax lines and other currencies?
- It renders whatever your HTML contains — subtotal, VAT or sales tax, discounts and totals lay out exactly as they do on screen, and any currency symbol or glyph (the € sign, web fonts and all) renders faithfully. The tax math is yours; the pixel-perfect rendering is ours.
- Can I use my own logo, fonts and brand colours?
- Always — the PDF is your own HTML/CSS, so every pixel is yours. Drive the logo and accent colour from data so one template covers every client, or save a brand kit and {{brand.logo}} / {{brand.color}} fill in automatically.
- Are my invoices stored on your servers?
- No. Each PDF is streamed back in the response and discarded — the document content is processed transiently and never persisted on our side.
- How fast is invoice rendering?
- A typical invoice comes back in roughly 400 milliseconds — fast enough to generate it synchronously, on the same request that creates the order, instead of in a background job.
RELATED
Same API, more documents
The render call that makes invoices makes these too — one endpoint for everything your product hands a customer.
Receipts
Turn a successful payment into a branded PDF receipt the moment it clears.
View use case →Quotes & estimates
Send a branded, itemised quote or estimate PDF straight from your app.
View use case →Credit notes
Issue a branded, VAT-correct credit note that references the original invoice.
View use case →Render your first invoice PDF in the next five minutes
One endpoint, real PDFs, 25 free credits to start. No credit card to begin.
Cancel anytime · no long-term contract