Render a PDF
Render a PDF. Pass `template` (one of 45 starter slugs: invoice, receipt, contract, certificate, nda, letter, report, quote, purchase-order, lease-agreement, resume, lab-report, boarding-pass, menu, bank-statement, etc.) or `html` (raw Handlebars HTML). Returns application/pdf bytes. $0.006 USDC per render, no API key, no signup. Full catalog: GET /v1/starters (free). Agent docs: https://pdfzen.site/docs/agents/tools
6000 (raw units)
price
1
calls / 30d
1
unique payers
2026-09-17
updated
Provider
api.pdfzen.site · discovered, not yet claimed by its owner
Payment (x402 accepts[])
[
{
"scheme": "exact",
"network": "eip155:8453",
"payTo": "0x2e6d9b578Dc402D8A7650b48AD3EE4FACb7c0978",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "6000",
"maxTimeoutSeconds": 60
}
]Output schema
{
"bazaar": {
"info": {
"input": {
"body": {
"data": {
"company": {
"address": "1 Market St, SF",
"name": "Acme Inc."
},
"currency": "USD",
"customer": {
"email": "[email protected]",
"name": "Globex Corp."
},
"invoice": {
"dueDate": "2026-06-14",
"issueDate": "2026-05-14",
"number": "INV-2026-001"
},
"items": [
{
"description": "Q2 consulting",
"qty": 40,
"rate": 150
},
{
"description": "Onsite training",
"qty": 1,
"rate": 1200
}
]
},
"template": "invoice"
},
"bodyType": "json",
"method": "POST",
"type": "http"
},
"output": {
"example": {
"bodyDescription": "PDF bytes (typically 8–40 KB).",
"contentType": "application/pdf",
"headers": {
"Content-Disposition": "inline; filename=\"<filename or default>\"",
"X-Document-Id": "doc_xxx (only when store: true)",
"X-Render-Mode": "stream",
"X-Render-Ms": "2300"
},
"statusCode": 200
},
"type": "json"
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"input": {
"additionalProperties": false,
"properties": {
"body": {
"properties": {
"data": {
"description": "Variables for the template's Handlebars context. Shape depends on the chosen template — call GET /v1/starters/:slug to fetch the expected `sampleData` for any starter.",
"type": "object"
},
"filename": {
"description": "Optional. Sets Content-Disposition filename on the response — useful when the PDF is delivered to a browser via an HTTP intermediary.",
"examples": [
"invoice-INV-2026-001.pdf"
],
"type": "string"
},
"html": {
"description": "Raw Handlebars-flavoured HTML. Use only when no starter fits (one-off bespoke layouts). Prefer `template` for consistency. Either `template` or `html` is required.",
"examples": [
"<h1>Hello, {{name}}</h1><p>Total: {{total}}</p>"
],
"type": "string"
},
"pageOptions": {
"description": "PDF page setup: format (A3/A4/A5/Letter/Legal/Tabloid), landscape, margin, scale, displayHeaderFooter. Most starters ship sensible defaults.",
"examples": [
{
"format": "A4"
},
{
"format": "Letter",
"landscape": true
}
],
"properties": {
"format": {
"enum": [
"A3",
"A4",
"A5",
"Letter",
"Legal",
"Tabloid"
],
"type": "string"
},
"landscape": {
"type": "boolean"
},
"margin": {
"type": "object"
}
},
"type": "object"
},
"store": {
"description": "When true, persist the PDF and return X-Document-Id response header for later retrieval via /v1/documents/:id/download. Default false.",
"type": "boolean"
},
"template": {
"description": "Slug of a built-in starter template. 45 available; GET /v1/starters lists them all (no auth, no payment). Either `template` or `html` is required.",
"examples": [
"invoice",
"receipt",
"certificate",
"contract",
"nda",
"letter",
"report",
"resume",
"boarding-pass",
"menu"
],
"type": "string"
}
},
"type": "object"
},
"bodyType": {
"enum": [
"json",
"form-data",
"text"
],
"type": "string"
},
"method": {
"enum": [
"POST"
],
"type": "string"
},
"type": {
"const": "http",
"type": "string"
}
},
"required": [
"type",
"method",
"bodyType",
"body"
],
"type": "object"
},
"output": {
"properties": {
"example": {
"type": "object"
},
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"required": [
"input"
],
"type": "object"
}
}
}Use it
curl
curl "https://api.pdfzen.site/v402/render/pdf" # -> 402 Payment Required, accepts[] lists how to pay # retry with a PAYMENT-SIGNATURE (or PAYMENT header) once paid
JavaScript
const res = await fetch("https://api.pdfzen.site/v402/render/pdf");
if (res.status === 402) {
const { accepts } = await res.json();
// pay one of accepts[] via an x402 client, then retry with the payment header
}Python
import httpx
res = httpx.get("https://api.pdfzen.site/v402/render/pdf")
if res.status_code == 402:
accepts = res.json()["accepts"]
# pay one of accepts[] via an x402 client, then retry with the payment headerMachine-readable
Everything on this page is also available as clean JSON at /resources/13476.json, and this resource appears in /discovery/resources and /discovery/search.