Skip to content

Generating Images

The generate endpoint is the core of the API. You send variable values; it returns the rendered image bytes — or, with delivery: "link", a public URL for the render instead.

POST /api/v1/templates/{templateId}/generate

Each successful call consumes one render from your monthly quota. Identical requests are not deduplicated or cached server-side — every call re-renders and consumes quota, so deduplicate on your side if you may issue the same request twice. (Batch jobs are different: their submit endpoint supports an Idempotency-Key that makes retries safe.)

Path parameter: templateId (UUID) — the template to render.

Headers

HeaderRequiredDescription
X-Api-KeyyesYour API key
Content-Typeyesapplication/json

Body

FieldTypeRequiredDescription
variablesobjectyesMap of variable name → value. Names must match those from GET /templates/{id}. Values are strings.
formatstringnopng (default), jpeg, webp, or pdf
deliverystringnobinary (default) returns image bytes; link publishes the render and returns a JSON share link
optionsobjectnoRender options (below)

options object

FieldTypeRangeDescription
scaleinteger14Resolution multiplier for raster output
qualityinteger1100Compression quality for jpeg / webp
outputDpiinteger96, 150, 300DPI tier — use 300 for print/PDF
backgroundColorstringhexOverrides the template background, e.g. #ffffff
Terminal window
curl -X POST https://app.zandovi.com/api/v1/templates/$TEMPLATE_ID/generate \
-H "X-Api-Key: $ZANDOVI_API_KEY" \
-H "Content-Type: application/json" \
-o coupon.png \
-d '{
"variables": {
"first_name": "Sarah",
"discount_code": "VIP30",
"expires_at": "30 Jun 2026"
},
"format": "png",
"options": { "scale": 2, "quality": 90 }
}'

For JavaScript and Python examples, see the Quickstart.

On success the response is 200 OK. The body depends on delivery.

The raw image is the body — no JSON wrapper. The Content-Type matches the requested format:

formatContent-Type
pngimage/png
jpegimage/jpeg
webpimage/webp
pdfapplication/pdf

A Content-Disposition: attachment; filename=… header is included. Write the body straight to a file or pipe it onward.

The body is application/json describing a public share link:

{
"id": "019a4c31-8e2f-7b10-9c44-1d5e77b0a913",
"url": "https://img.zandovi.com/s/8f3c2ad9e1b74c05.png",
"mimeType": "image/png",
"fileSize": 41982,
"createdAt": "2026-08-24T09:00:00Z",
"expiresAt": "2026-09-23T09:00:00Z"
}

The link expires after a plan-dependent number of days, and anyone holding the URL can open it. See Share Links for the full field reference, listing and revocation, and the limits.

Either way the call consumes exactly one renderdelivery changes how the result is returned, not what it costs.

Response headers

HeaderDescription
X-Request-IdUnique ID for this request — include it in support requests
X-Template-IdTemplate used for the render
X-TimestampISO 8601 UTC time the response was produced
X-Quota-LimitMonthly render ceiling for the workspace
X-Quota-RemainingRenders left this billing period
X-Quota-ResetISO 8601 UTC time the quota resets
  • Supply every required variable. Missing required variables return 400 with an application/problem+json body naming the offending variable.
  • Values are sent as strings, including number, date, phone, and url types — they are validated against the template’s rules server-side.
  • qrcode and barcode variables take the data to encode; image variables take an image URL.
  • Variables you omit fall back to their defaultValue if the template defines one; otherwise an optional variable simply renders empty.
CodeCause
400Missing required variable or a value failed validation
401Missing or invalid API key
403delivery: "link" requested but share links aren’t on this plan, or the active-link cap is reached
404Template not found or not accessible to this key
429Monthly quota or short-term rate limit exceeded
502 / 503Rendering service errored or is temporarily unavailable — retry with backoff. With delivery: "link", also covers share storage being unavailable or the upload failing

See Errors, quotas & rate limits for response bodies and retry guidance.