POST /v1/templates/preview
To render a template you’ve already saved, use POST /v1/templates//render instead, which references it by id.
Body parameters
All fields are optional — send the draft fields you want to render.string
Draft subject line with merge variables.
string
Draft HTML body.
string
Draft plain-text body.
object
Merge variables to substitute. HTML values are escaped before insertion into the
html field.Request
Response
string
The rendered subject.
string | null
The rendered HTML, or
null when not supplied or on a syntax error.string | null
The rendered text, or
null.string[]
Referenced variables absent from
data.string
Present only when a draft field has a template syntax error. The request still returns
200 OK so the editor can show the message inline.200 OK
Syntax error
A malformed block (e.g. an unclosed{{#if}}) returns 200 with an error string rather than a 4xx, so a live editor can surface it without treating it as a failed request.
200 OK · with error
HTML escaping. Values in
data are HTML-escaped before substitution into html. Use the triple-brace {{{raw}}} form only for values you trust to be safe markup.