Generate a PDF
POST /generate?design=:designIdRenders one PDF from a design, substituting variable values, and returns a temporary presigned download URL. Costs 1 credit.
Query parameters
| Param | Type | Required | Notes |
|---|---|---|---|
design | string | yes | The design id to render. |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
data | object | no | Variable name → value. Omit for a design with no variables. |
curl -X POST "https://api.imaginepdf.com/api/v1/generate?design=design_abc123" \
-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"
}
}'Response 201 Created
{
"status": "success",
"data": {
"designId": "design_abc123",
"filename": "Invoice.pdf",
"downloadUrl": "https://storage.imaginepdf.com/....pdf?signature=...",
"expiresIn": 3600,
"status": "completed"
},
"error": null
}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
| HTTP | error.code | Meaning |
|---|---|---|
| 402 | INSUFFICIENT_CREDITS | Workspace is out of credits. |
| 404 | DESIGN_NOT_FOUND | No design with that id in the workspace. |
| 400 | VALIDATION_ERROR | Missing design query param or malformed body. |
See Errors for the full table, and Credits & plans for credit behavior.
Related
- Preview — render a page to PNG for free while iterating.
- Batch generation — one PDF per dataset row.
- Variables — how
datamaps onto the design.