Render a template
Render a creative template by ID to png, webp, svg, pdf, webm, mp4, gif, zip (frame sequence), or html5 (standalone ad ZIP), with variable overrides. Bearer API key with the `template.render` scope. `{{ brand.* }}` resolves against `brand` when given (another brand of the key's space, for this render only), else the template's brand, else the space default. Returns `{ url, creditsCharged, balanceAfter }` with the uploaded render (plus `credential` when the template has verified documents on); `raw: true` (or `?format=binary`) streams the bytes instead. Send an `Idempotency-Key` header to retry safely: the same key with the same request within 24 hours returns the first JSON answer again (header `Idempotent-Replayed: true`) without rendering or charging again.
/api/v1/templates/:id/renderQuery / Path parameters
| Name | In | Required | Description |
|---|---|---|---|
| id | path | Yes | Template ID |
| Idempotency-Key | header | No | Optional, 1-255 printable ASCII characters, kept 24 hours per space. A retry with the same key and the same request returns the first JSON answer without rendering or charging again. The same key with a different request, while the first is still running, or after a raw render is IDEMPOTENCY_CONFLICT (409, `data.reason`). |
Request body
| Property | Type | Required | Description |
|---|---|---|---|
| format | png | webp | svg | pdf | webm | mp4 | gif | zip | html5 | No | Output format. Default png. |
| clickUrl | string | No | Required for html5: HTTP(S) click-through URL. |
| loops | integer | No | HTML5 playback repetitions. Default 1. |
| network | generic | google-ads | dv360 | cm360 | amazon-dsp | adroll | No | HTML5 ad network preset the report is judged against. Default generic. |
| variables | object | No | Variable overrides by name. |
| scale | number | No | Resolution multiplier. Default 1. |
| fps | integer | No | Frames per second for video formats. Default 30. |
| quality | standard | high | No | Render quality tier. Default from the template, else high. |
| scene | integer | No | Still formats: scene index to render. Omit on a pdf of a still (non-animated) template to get every scene as a page. |
| frame | integer | No | Still formats: frame index within the scene. |
| nodeId | string | No | Still formats: render one layer instead of the artboard. |
| variation | string | No | Saved variation id to apply before rendering — or several, as a JSON array or a comma-separated string, stacked in order: later wins on the same property; at most one per single-select group (VARIATION_CONFLICT). |
| brandVariant | array | No | Brand campaign variant ids to render under. Replaces whatever the brand currently has active, so the result is deterministic. Accepts a single id or a comma-separated string too. |
| brandVariantMode | replace | add | No | How brandVariant combines with the brand's active set. Default replace. |
| brandTokens | object | No | Brand token values to render with, REPLACING the resolved brand. Use it to render exactly what a preview shows, unsaved edits included. Bounded in size and depth. Exclusive with `brand`. |
| brand | string | No | Render with another brand of the key's space for this render only — a brandId, brand name or the brand's website URL (matched, never fetched). The template keeps its own brand, so concurrent renders under different brands do not race. Another space's brand (public catalog included) is BRAND_NOT_FOUND; a name matching several brands is BRAND_AMBIGUOUS with `data.candidates`. |
| draft | boolean | No | Render the current (unpublished) document instead of the published version. Default false: a published template renders its published snapshot; a never-published one renders its draft. |
| size | string | No | Render at another size without changing the template: a size preset id (e.g. "og", "story", "leaderboard") or "WIDTHxHEIGHT" (16–8192 px a side, 64 MP max); an object { preset } or { width, height } is accepted too. The response echoes `size: { width, height, fit, preset?, from }`. |
| fit | reflow | scale | No | How the design adapts to `size`: reflow (layer constraints + auto-layout, default) or scale (uniform scale to fit, letterboxed). |
| pages | all | No | Every page of a still template as one still each — one page per scene, a scene repeated over data one page per item, resolved with this request's variables. Still formats only (png, webp, svg; a pdf already holds every page), exclusive with scene and nodeId, at most 50 pages (PAGE_LIMIT_EXCEEDED). Costs one still per page, reserved up front. The JSON answer is `{ pages: <count>, pageUrls: [{ index, name, url, fileId }], zipUrl }`; with `raw` the body is a ZIP (`application/zip`) of `01-<page name>.<ext>`, `02-…`. |
| dpi | integer | No | PDF only: print resolution. Page size = pixels × 72 / dpi points, so a 1200 × 1800 px label at 300 is a 4 × 6 in page. Default: the template's exportDefaults.dpi, else 300 on a print-size template (A4, Letter, business card, 4×6 label…), else 72 (1 px = 1 pt). Out of range is VALIDATION (422). |
| raw | boolean | No | Stream the file bytes instead of returning JSON. |
Responses
JSON { ok, templateId, format, url, timings, creditsCharged, balanceAfter, brand?, variation?, still?, pages? (pdf), size?, warnings? ([{ nodeId, name, reason }] — layers skipped or drawn as a fallback, SVG/PDF fallbacks, text caught mid-textAnimate, pagination and soundtrack notes) } — or the raw file when `raw`/binary is requested (then `x-credits-charged` / `x-credits-balance` headers carry the credits). With `pages: "all"`: { ok, templateId, format, pages (count), pageUrls: [{ index, name, url, fileId }], zipUrl, timings, creditsCharged, balanceAfter, … } — or, raw, a ZIP of the numbered stills (`x-page-count` header).
Missing or invalid API key, or the key lacks the template.render scope
The space's verified documents are suspended, so a template with them on cannot render (CREDENTIALS_SUSPENDED)
Template not found in the key's space, or `brand` names no brand of the key's space (BRAND_NOT_FOUND)
`brand` matches several brands of the space (BRAND_AMBIGUOUS, see data.candidates); or the `Idempotency-Key` was used with a different request, its first request is still running, or it belongs to a finished raw render (IDEMPOTENCY_CONFLICT, `data.reason`: payload-mismatch, in-flight, raw-completed)
`pages: "all"` with a pdf or video format, with scene/nodeId, or on an animated template, or `dpi` outside 72–1200 (VALIDATION); or the set is over 50 pages (PAGE_LIMIT_EXCEEDED)
curl -X POST "https://bannx.com/api/v1/templates/:id/render" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"format":"png","clickUrl":"string","loops":null,"network":"generic","variables":null}'// Binary image (image/png, image/svg+xml, or image/webp)
// Or data URL for inline format