PPDFInvoiceAPI
DOCS/ POST /v1/render

API REFERENCE

POST /v1/render

The one endpoint. Send HTML (or a template plus data) as JSON and get application/pdf back.

Request

POST https://api.pdfinvoiceapi.com/v1/render with aBearer API key and a JSON body. Provide either html or a template (with optional data). The body is application/json; each success costs one credit.

{
  "template": "<h1>Invoice {{number}}</h1><p>Bill to: {{billTo.name}}</p><p>Total: {{total}}</p>",
  "data": {
    "number": "INV-1024",
    "billTo": { "name": "Globex LLC" },
    "total": "€1,240.00"
  },
  "pdf": { "format": "A4", "printBackground": true }
}

Body parameters

FieldTypeDescription
htmlstringRaw HTML to render. Provide this OR template.
templatestringEither an inline HTML string with {{placeholders}}, OR a stored template id (tpl_…) you own. Inline: {{x}} is HTML-escaped, {{{x}}} is raw; dotted paths like {{user.name}} work. Stored: save once in the dashboard, render by id.
dataobjectValues merged into the template (inline or stored). Ignored if html is sent.
pdfobjectPrint options: format ("A4", "Letter"…), landscape, printBackground, margin, scale, etc. Defaults to A4 with backgrounds on.

See the PDF options reference for every field in the pdf object.

Response

On success: 200 with the rawapplication/pdf bytes as the body — stream them to a file, a browser, or storage. Notable response headers:

HeaderValue
content-typeapplication/pdf
content-dispositioninline; filename="render.pdf"
x-pdf-enginecloudflare-browser-rendering
x-pdf-brandingon (Trial) · off (paid)

On failure you get a JSON error body instead of a PDF — seeErrors for every code, andRate limits & credits for throttling.