{"uid":"cap_fU4uL_0JUsuKX5iLL4mo_","slug":"pdfzen-render-html-to-pdf-with-starter-templates-c36b22c9","name":"PDFZen Render — HTML-to-PDF with Starter Templates","description":"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","url":"https://api.pdfzen.site/v402/render/pdf?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"data":{"type":"object","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."},"html":{"type":"string","examples":["<h1>Hello, {{name}}</h1><p>Total: {{total}}</p>"],"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."},"store":{"type":"boolean","description":"When true, persist the PDF and return X-Document-Id response header for later retrieval via /v1/documents/:id/download. Default false."},"filename":{"type":"string","examples":["invoice-INV-2026-001.pdf"],"description":"Optional. Sets Content-Disposition filename on the response — useful when the PDF is delivered to a browser via an HTTP intermediary."},"template":{"type":"string","examples":["invoice","receipt","certificate","contract","nda","letter","report","resume","boarding-pass","menu"],"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."},"pageOptions":{"type":"object","examples":[{"format":"A4"},{"format":"Letter","landscape":true}],"properties":{"format":{"enum":["A3","A4","A5","Letter","Legal","Tabloid"],"type":"string"},"margin":{"type":"object"},"landscape":{"type":"boolean"}},"description":"PDF page setup: format (A3/A4/A5/Letter/Legal/Tabloid), landscape, margin, scale, displayHeaderFooter. Most starters ship sensible defaults."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.006","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.006/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.006","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.006","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_9_i1xtFnlUlPt-uWo8n1T","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.006","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Renders a PDF from a Handlebars HTML template or one of 45 built-in starter templates (invoice, receipt, contract, certificate, etc.) for $0.006 USDC per call.","exampleAgentPrompt":"Generate a PDF invoice using the built-in 'invoice' template with customer name 'Acme Corp', invoice number 'INV-2026-042', and a total of $1,250.00 — save it and name the file invoice-INV-2026-042.pdf.","exampleUseCases":[{"title":"Automated invoice generation for SaaS billing","prompt":"Create a PDF invoice for my customer 'Riverside Studios', invoice number INV-2026-007, due date March 31 2026, line items for 5 Pro seats at $49 each — use the built-in invoice template and name the file invoice-INV-2026-007.pdf."},{"title":"Certificate of completion for online course","prompt":"Render a PDF certificate of completion for a student named 'Maria Gonzalez' who finished the 'Advanced Python' course on January 15 2026 — use the certificate starter template in A4 landscape format."},{"title":"Custom NDA from bespoke HTML layout","prompt":"Generate a PDF NDA document from this HTML I've written — it has Handlebars placeholders for party names, so fill in 'BlueSky Ventures' and 'Initech LLC' as the two parties, and store the resulting PDF so I can retrieve it later."}],"resultDescription":"Returns a rendered PDF binary as the response body. If `store` is true, also returns an X-Document-Id response header pointing to the stored document for later retrieval via /v1/documents/:id/download. Content-Disposition is set to the filename if provided.","failureModes":["Missing both `template` and `html` fields — returns 400 validation error","Invalid template slug (not in the 45 available starters) — returns 404 or 400","Malformed Handlebars syntax in custom HTML — render fails with template error","Payment failure (insufficient USDC balance via x402) — returns 402 Payment Required","Invalid pageOptions format value — returns 400 schema validation error","Template data variables missing required fields — PDF may render with empty placeholders"],"whenToPreferThis":"Choose this endpoint when you need to programmatically generate a polished PDF document — especially when a pre-built business template (invoice, receipt, contract, certificate, NDA, report, resume) fits your use case, saving layout work. It is ideal for AI agents that need to produce client-facing documents on the fly, charge per-render with micropayments, and optionally persist the result. Prefer it over general-purpose headless browser approaches when low latency, predictable cost ($0.006/render), and template consistency matter.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T00:33:43.119Z","isFirstParty":false,"canonicalSlug":"pdfzen-render-html-to-pdf-with-starter-templates-c36b22c9"}