Skip to Content
API ReferenceGenerate a PDF

Generate a PDF

POST/api/v1/designs/:designId/generate

Renders one PDF from a design, substituting variable values, and returns a temporary presigned download URL. Costs 1 credit.

Path parameters

ParamTypeRequiredNotes
designIdstringyesThe design id to render.

Body

FieldTypeRequiredNotes
dataobjectnoVariable name → value. Omit for a design with no variables.
pdfProfilestringnoCompliance output: accessible (tagged PDF/UA-1 — screen-reader structure, reading order, alt text) or pdf-a (archival PDF/A-3b, also tagged). Omit or standard for regular output. Same credit cost. Validating with an accessibility checker (axesCheck, PAC, verapdf --flavour ua1)? Use accessiblepdf-a targets archival validation (veraPDF 3b) and does not claim PDF/UA.
curl -X POST "https://api.imaginepdf.com/api/v1/designs/design_abc123/generate" \ -H "X-API-Key: $IMAGINEPDF_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "data": { "invoice_number": "INV-001", "customer_name": "Acme Corp", "amount": "$1,000.00" }, "pdfProfile": "accessible" }'

Response 201 Created

{ "status": "success", "data": { "generationId": "gen_abc123", "designId": "design_abc123", "filename": "Invoice.pdf", "downloadUrl": "https://storage.googleapis.com/...output.pdf?X-Goog-Signature=...", "expiresIn": 3600, "status": "completed" }, "error": null }
  • generationId — stable identifier for this render. The PDF bytes expire, but this id does not — store it to correlate a document with the run that made it.
  • downloadUrl — presigned URL to the rendered PDF.
  • expiresIn — seconds the URL stays valid (3600 = one hour).
  • filename — suggested filename, derived from the design name.

Download it:

curl -L -o invoice.pdf "<downloadUrl>"

The download URL expires after expiresIn seconds. Fetch and store the PDF promptly rather than passing the URL around long-term.

Errors

HTTPerror.codeMeaning
402INSUFFICIENT_CREDITSWorkspace is out of credits.
404DESIGN_NOT_FOUNDNo design with that id in the workspace.
400VALIDATION_ERRORMalformed body.

See Errors for the full table, and Credits & plans for credit behavior.

Last updated on