Preview a template
POST
/templates/preview
const url = 'https://mail.teamander.com/v1/templates/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"mjml_source":"<mjml><mj-body><mj-section><mj-column><mj-text>Hi {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>","subject_template":"Welcome, {{name}}!","data":{"name":"Jane"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://mail.teamander.com/v1/templates/preview \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "mjml_source": "<mjml><mj-body><mj-section><mj-column><mj-text>Hi {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>", "subject_template": "Welcome, {{name}}!", "data": { "name": "Jane" } }'Compiles MJML and interpolates data without saving anything. MJML and Handlebars problems come back in errors rather than as a failed request, so a partially written template still renders.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
object
mjml_source
string
design_json
object
schema_version
required
integer
theme
object
backgroundColor
required
string
contentBackgroundColor
required
string
fontFamily
required
string
linkColor
required
string
width
required
string
blocks
required
Array
One of:
object
id
required
string
type
required
string
html
required
string
align
required
string
color
string
object
id
required
string
type
required
string
label
required
string
href
required
string
align
required
string
backgroundColor
string
color
string
object
id
required
string
type
required
string
src
required
string
alt
required
string
href
string
width
string
align
required
string
object
id
required
string
type
required
string
color
string
object
id
required
string
type
required
string
height
required
integer
object
id
required
string
type
required
string
align
required
string
networks
required
Array<object>
object
name
required
string
href
required
string
object
id
required
string
type
required
string
html
required
string
unsubscribeUrl
string
object
id
required
string
type
required
string
columns
required
Array<object>
object
blocks
required
Array
One of:
object
id
required
string
type
required
string
html
required
string
align
required
string
color
string
object
id
required
string
type
required
string
label
required
string
href
required
string
align
required
string
backgroundColor
string
color
string
object
id
required
string
type
required
string
src
required
string
alt
required
string
href
string
width
string
align
required
string
object
id
required
string
type
required
string
color
string
object
id
required
string
type
required
string
height
required
integer
object
id
required
string
type
required
string
align
required
string
networks
required
Array<object>
object
name
required
string
href
required
string
object
id
required
string
type
required
string
html
required
string
unsubscribeUrl
string
html
string
subject_template
string
text_body
string
data
object
key
additional properties
Example
{ "mjml_source": "<mjml><mj-body><mj-section><mj-column><mj-text>Hi {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>", "subject_template": "Welcome, {{name}}!", "data": { "name": "Jane" }}Responses
Section titled “Responses”Rendered preview
Media typeapplication/json
object
html
required
string
subject
required
string
text
required
string
mjml_source
required
string
errors
required
Array<string>
variables
required
object
key
additional properties
string
Example
{ "html": "<!doctype html><html>…</html>", "subject": "Welcome, Jane!", "text": "Hi Jane", "mjml_source": "<mjml><mj-body>…</mj-body></mjml>", "errors": [], "variables": { "name": "string" }}Validation failed
Media typeapplication/json
object
error
required
string
details
object
key
additional properties
Example
{ "error": "Validation failed", "details": {}}Missing or invalid API key
Media typeapplication/json
object
error
required
string
message
string
Example
{ "error": "Invalid API key"}