PDF4.dev
Render
POST
/api/v1/render

Authorization

AuthorizationRequiredBearer <token>

API key from Settings page. Keys start with p4_live_ prefix.

In: header

Request Body

application/jsonRequired
template_idstring

Template ID (tmpl_xxx) or slug. The template must belong to the authenticated user.

htmlstring

Raw HTML string. Supports Handlebars {{variables}} syntax. Use this for one-off renders without saving a template.

dataobject

Data to replace {{variables}} in the template. Supports strings, numbers, booleans, nested objects, and arrays (for {{#each}} blocks).

formatobject

Page format configuration. If omitted, defaults to A4 portrait with 20mm top/bottom and 15mm left/right margins.

curl -X POST "https://docs.pdf4.dev/api/proxy/api/v1/render" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "invoice",
    "data": {
      "company_name": "Acme Corp",
      "invoice_number": "INV-2025-001",
      "total": "$4,500.00"
    }
  }'

PDF generated successfully

"string"