Image APIs
API reference › Pdfs

Make a PDF from a template, HTML or a public URL

POST/v1/pdfs

POST/v1/pdfs

Make a PDF from a template, HTML or a public URL

Costs one unit per page. A template without format prints at its own pixel size, one page; HTML and URLs paginate at the paper size you pick.

REQUEST BODY · APPLICATION/JSON · REQUIRED
{
  "html": "<h1>Invoice #1042</h1><p>Total due: $420.00</p>",
  "format": "A4",
  "margin": "20mm"
}
In the full reference
REQUEST
curl -X POST "https://api.imageapis.com/v1/pdfs" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "html": "<h1>Invoice #1042</h1><p>Total due: $420.00</p>",
  "format": "A4",
  "margin": "20mm"
}'
RESPONSE
200With response=binary: the file itself, with X-Image-Id and X-Image-Url headers
201Created
{
  "id": "pdf_2wq9tkz7hvbx4nmc8rde",
  "object": "pdf",
  "status": "completed",
  "url": "https://img.imageapis.com/i/pdf_2wq9tkz7hvbx4nmc8rde.pdf",
  "format": "pdf",
  "pages": 2,
  "bytes": 90412,
  "units": 2,
  "created": "2026-10-10T18:10:40Z",
  "completed": "2026-10-10T18:10:42Z",
  "expires": "2026-11-09T18:10:40Z"
}
202Accepted: rendering in the background; the record has status pending and the webhook gets the finished one
{
  "id": "pdf_2wq9tkz7hvbx4nmc8rde",
  "object": "pdf",
  "status": "completed",
  "url": "https://img.imageapis.com/i/pdf_2wq9tkz7hvbx4nmc8rde.pdf",
  "format": "pdf",
  "pages": 2,
  "bytes": 90412,
  "units": 2,
  "created": "2026-10-10T18:10:40Z",
  "completed": "2026-10-10T18:10:42Z",
  "expires": "2026-11-09T18:10:40Z"
}
Try it — sign in first
Runs on a sandbox key: 200 requests a month. Your real key is for production.