Compile template
Compiles an MJML template with provided data, returning the rendered HTML. When subject and/or subject_preview are provided, they are rendered through the same Liquid engine used at send time and returned alongside the HTML so callers do not need to run a separate Liquid pass to preview the subject line. Useful for previewing templates before saving.
post/api/templates.compile
Request body
Example request
{
"workspace_id": "ws_1234567890",
"message_id": "msg_abc123",
"subject": "Hi {{ contact.first_name }}",
"subject_preview": "Welcome {{ contact.first_name }}",
"test_data": {
"user_name": "John Doe",
"action_url": "https://example.com/action"
}
}Response
Template compiled successfully
Example response
{
"subject": "Hi Pierre",
"subject_preview": "Welcome Pierre"
}