Skip to content

Generating via the API

After saving a template, click the API example button (the </> icon in the header, next to the Generate button). The API Example modal shows ready-to-use code for rendering this specific template, pre-populated with its ID and variable names.

API Example modal

Copy the snippet into your codebase, replace the placeholder with a key from Settings → API Keys, and you’re rendering.

Authenticate with the X-Api-Key header and POST to the template’s generate endpoint. The response is the image itself (binary), which you save or stream onward:

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"
},
"format": "png",
"options": { "scale": 2 }
}'

The template ID is a UUID shown in the URL when the template is open in the Designer (e.g. …/templates/019463b8-1234-…) and in the API Example modal. You can also list templates via the API — see Templates & schema discovery.

The API Reference covers authentication, schema discovery, every render option, error handling, and quotas: