Synchronously render a template and stream the file back in the response. The request blocks until the render finishes (typically 2–15 seconds).
/v1/renderAuth requiredBody parameters
template_idrequiredactionrequiredpdfpreviewformatpdfpngwebpdatarequiredscale1sizewidthheightform_schema_idwatermarksave_to_rendersfalseuse_sample_datafalseExample request
curl -X POST https://api.pixldocs.com/v1/render \
-H "Authorization: Bearer pxd_YOUR_KEY" \
-H "Content-Type: application/json" \
--output invoice.pdf \
-d '{
"template_id": "d8a4c9f2-1b3e-4a1f-9c0b-1234567890ab",
"format": "pdf",
"data": {
"customerName": "Acme Corp",
"amount": 1250.00,
"items": [
{ "description": "Design retainer", "qty": 1, "unit_price": 1000 },
{ "description": "Print production", "qty": 5, "unit_price": 50 }
]
}
}'Response — default (raw bytes)
The Content-Type header matches the requested format (application/pdf, image/png, or image/webp). Every response also carries:
Content-Type: application/pdf
X-Pixldocs-Request-Id: 4c5d0b23-8c8e-4c8a-9d7d-2a1c31e5b0a7On an HTML template, any declared field you did not supply is named back to you, so a blank in the document is never a surprise:
X-Pixldocs-Unsupplied-Fields: purchase_order_no,delivery_notesMulti-page raster renders return JSON with base64 data URLs instead of raw bytes:
{
"id": "4c5d0b23-8c8e-4c8a-9d7d-2a1c31e5b0a7",
"page_count": 3,
"width": 1080,
"height": 1350,
"pages": ["data:image/png;base64,iVBOR...", "..."]
}Rendering at another size
Pass size (a saved size id) or an explicit width + height and the design reflows to that box — one template, every format. Both dimensions are required together and must be between 16 and 8000 px; anything else returns 400 invalid_size and costs no credits. An unsupported format returns 400 invalid_format rather than quietly falling back to PNG. Custom sizes need a live key.
{
"template_id": "d8a4c9f2-1b3e-4a1f-9c0b-1234567890ab",
"format": "webp",
"width": 1080,
"height": 1920,
"data": { "headline": "Season Sale" }
}Response — with save_to_renders: true
{
"id": "d1e2f3a4-5b6c-7d8e-9f0a-b1c2d3e4f5a6",
"url": "https://cdn.pixldocs.com/renders/...",
"file_size": 184320,
"width": 1080,
"height": 1350,
"page_count": 2
}If the render is still processing when the sync window elapses, you get a 202 with the render id — poll GET /v1/renders/:id or watch the Renders page.
202 and the job continues in the background. For very heavy renders, prefer POST /v1/renders.