Generate a PDF

Submit a generation job by POSTing a template ID and data payload. Generation is asynchronous — you receive a jobId to poll or pass to a webhook.

Endpoint

POST /v1/generate

Body parameters

FieldTypeRequiredDescription
templateId string required ID of the saved template to render (format: tpl_xxxxxxxx)
data object required JSON data passed to Handlebars during rendering
webhookUrl string optional URL to POST a job.completed event to. Overrides the org default. Pass an empty string to suppress delivery for this job only.
meta.filename string optional Custom filename without .pdf. Duplicates get a numeric suffix automatically.
meta.retentionSeconds integer optional Seconds to keep the file. Cannot exceed your plan maximum. Defaults to plan max. Common values: 300, 1800, 3600, 86400.

Response

Returns 202 Accepted with the job ID and initial status. Generation continues asynchronously.

Use webhooks to avoid polling entirely — PDFox will POST to your endpoint when the PDF is ready.

Related guides

curl -X POST https://api.pdfox.com/v1/generate \
  -H "Authorization: Bearer pdfs_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "tpl_8f3e2a1b",
    "data": {
      "customer": { "name": "Acme Ltd", "address": "123 High Street, London" },
      "invoice":  { "number": "INV-0042", "date": "2026-05-17", "total": 3200.00, "isPaid": true }
    },
    "meta": { "filename": "invoice-INV-0042", "retentionSeconds": 3600 }
  }'
HTTP/1.1 202 Accepted
{
  "jobId":  "job_7c9d2e3f",
  "status": "queued"
}