Quickstart

Generate your first PDF in under 5 minutes. You'll call the API, poll for the result, and download the file.

Prerequisites: a PDFox account and an API key. Create one here — it takes 30 seconds.

What you'll build

You'll send a template ID and a JSON data payload to the Generate PDF endpoint. PDFox renders the PDF asynchronously; once the job is complete you request a signed download URL. Replace the example templateId with the ID of one of your published templates.

Steps

1
Submit a generate job

Send templateId + data to POST /v1/generate. The 202 response contains only a jobId — generation is asynchronous.

2
Poll for completion

Call GET /v1/generate/jobs/:jobId every 1–2 seconds until status is completed or failed. On failure, the reason is in errorMessage.

3
Download the PDF

Call GET /v1/generate/jobs/:jobId/download to get a signed url. Fetch it directly or redirect your user to it — no auth header needed, and it expires after 1 hour.

4
(Optional) Set up a webhook

Instead of polling, pass a webhookUrl (or set an organisation default) and PDFox will POST a job.completed event with a ready-to-use downloadUrl. See Webhooks.

Next steps

curl https://api.pdf-fox.com/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "a3f1d2e4-1111-4562-b3fc-2c963f66afa6",
    "data": {
      "company": "Acme Corp",
      "invoiceNumber": "INV-001",
      "total": 1250.00
    }
  }'
# 202 Accepted
# { "jobId": "7c9e6679-7425-40de-944b-e07fc1f90ae7" }
curl https://api.pdf-fox.com/v1/generate/jobs/JOB_ID \
  -H "Authorization: Bearer YOUR_API_KEY"
# Get a signed URL (valid 1 hour)
curl https://api.pdf-fox.com/v1/generate/jobs/JOB_ID/download \
  -H "Authorization: Bearer YOUR_API_KEY"
# { "url": "https://api.pdf-fox.com/v1/generate/jobs/JOB_ID/file?token=...", "expiresIn": 3600 }

# Fetch it — no Authorization header needed
curl "DOWNLOAD_URL" -o invoice.pdf