JSON to PDF API
Generate a PDF from JSON
Turn structured data into a finished document. Pair your JSON with a saved template and the API fills it in, or build HTML from your JSON and render that. Either way you go from a data object to a polished PDF in one request.
Send JSON, get a PDF
The cleanest path is a template plus data: store the layout once, then post your JSON. The API maps values into the template and returns the document.
// JSON data + a saved template -> a finished PDF
const res = await fetch("https://api.pdfpipe.xyz/v1/pdf", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PDFPIPE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
template_id: "tmpl_invoice",
data: { customer: "Acme Inc", items: [{ name: "Plan", total: "$99" }] },
}),
});Two ways to go from JSON to PDF
Template plus data
Save an HTML template with placeholders, then send only the JSON. Best for repeatable documents like invoices and reports.
Build HTML, then render
Generate HTML from your JSON in code (map over arrays, format numbers), then send the HTML. Best for fully custom layouts.
Good for structured documents
- Invoices and receipts from order JSON.
- Reports and statements from analytics payloads.
- Certificates from a record of completion.
- Any data model you can lay out in HTML and CSS.
Frequently asked
How do I generate a PDF from JSON?
Pair your JSON with a saved template: POST the template id and a data object, and the API fills the template and returns the PDF. Alternatively, build HTML from your JSON and send the HTML.
Is there a direct JSON to PDF endpoint?
The render endpoint accepts either a template id plus a data object, or an HTML string. For JSON, the template-plus-data flow maps your fields into a layout without you assembling markup.
Can I format numbers and dates?
Yes. Format values in your code before sending, or include the formatted strings in your JSON, then place them with template placeholders.
Does it handle arrays and nested data?
Templates resolve nested values, and for repeating rows you can build the HTML from your JSON and render that for full control.
Which PDF API do you need?
These pages cover related search intents. Pick the one that matches what you are building.
500 free documents a month, flat pricing after that, and a live playground you can try without signing up.