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.

POST/api/v1/templates/:id/render

Query / Path parameters

NameInRequiredDescription
idpathYesTemplate ID
Idempotency-KeyheaderNoOptional, 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

PropertyTypeRequiredDescription
formatpng | webp | svg | pdf | webm | mp4 | gif | zip | html5NoOutput format. Default png.
clickUrlstringNoRequired for html5: HTTP(S) click-through URL.
loopsintegerNoHTML5 playback repetitions. Default 1.
networkgeneric | google-ads | dv360 | cm360 | amazon-dsp | adrollNoHTML5 ad network preset the report is judged against. Default generic.
variablesobjectNoVariable overrides by name.
scalenumberNoResolution multiplier. Default 1.
fpsintegerNoFrames per second for video formats. Default 30.
qualitystandard | highNoRender quality tier. Default from the template, else high.
sceneintegerNoStill formats: scene index to render. Omit on a pdf of a still (non-animated) template to get every scene as a page.
frameintegerNoStill formats: frame index within the scene.
nodeIdstringNoStill formats: render one layer instead of the artboard.
variationstringNoSaved 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).
brandVariantarrayNoBrand 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.
brandVariantModereplace | addNoHow brandVariant combines with the brand's active set. Default replace.
brandTokensobjectNoBrand 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`.
brandstringNoRender 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`.
draftbooleanNoRender 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.
sizestringNoRender 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 }`.
fitreflow | scaleNoHow the design adapts to `size`: reflow (layer constraints + auto-layout, default) or scale (uniform scale to fit, letterboxed).
pagesallNoEvery 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-…`.
dpiintegerNoPDF 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).
rawbooleanNoStream the file bytes instead of returning JSON.

Responses

200

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).

401

Missing or invalid API key, or the key lacks the template.render scope

403

The space's verified documents are suspended, so a template with them on cannot render (CREDENTIALS_SUSPENDED)

404

Template not found in the key's space, or `brand` names no brand of the key's space (BRAND_NOT_FOUND)

409

`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)

422

`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)

Request
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}'
Response
// Binary image (image/png, image/svg+xml, or image/webp)
// Or data URL for inline format