Generate Invoice PDFs from JSON — One API Call, Zero Template HTML
The problem with "HTML to PDF" for invoices
Converting HTML to PDF is great — until you realize you still have to write and maintain the invoice HTML. Every tweak to the layout, every currency edge case, every "make the total bold" request means touching template strings in your backend.
There's a simpler model: send the data, not the markup.
Send JSON, get a PDF
The pdfmyhtml Document API exposes three ready-made document types — /v1/invoices, /v1/quotes, and /v1/receipts. You POST structured JSON (who's billing whom, the line items, the tax rate) and pick a style. The server renders a polished template and computes every total — you never send a precomputed subtotal or tax.
curl -X POST https://api.pdfmyhtml.com/v1/invoices \ -H "X-API-Key: YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "style": "modern", "number": "INV-2026-001", "taxRate": 10, "from": { "name": "Acme Corp", "address": "1 Market St\nSF, CA" }, "to": { "name": "Client Inc", "address": "9 Commerce Ave\nNY, NY" }, "items": [ { "description": "Design work", "quantity": 10, "rate": 150 }, { "description": "Hosting", "quantity": 12, "rate": 45 } ], "wait": true }'
The response is the same as every other endpoint: a download_url (with wait: true) or a job_id to poll.
{ "job_id": "…", "status": "COMPLETED", "download_url": "https://…signed…/output.pdf" }
Pick a style
Each document type ships multiple styles, so you can match your brand without writing CSS:
- Invoices —
modern,classic,minimal,brutalist,startup - Quotes / estimates —
modern,classic(plusvalidUntilandterms) - Receipts —
thermal,modern(withbusinessandcashier)
Try it without writing any code
Not ready to integrate yet? Build one in the browser first — the free generators run on the exact same engine as the API, so what you preview is what you'll ship:
When you're happy with the layout, the generator hands you the precise API call to reproduce it. One credit per document — the same pool as your HTML/URL conversions.
When to use this vs raw HTML→PDF
Use the Document API when you're generating a known document type (invoice/quote/receipt) and want to stop owning the template. Reach for /v1/html-to-pdf when you need full control over a bespoke layout. Same account, same credits, same reliability.
Get an API key (50 free credits) and generate your first invoice in two minutes.