Skip to main content
POST
/
api
/
templates.compile
Compile template
curl --request POST \
  --url https://{notifuseDomain}/api/templates.compile \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspace_id": "ws_1234567890",
  "message_id": "msg_abc123",
  "visual_editor_tree": {},
  "test_data": {
    "user_name": "John Doe",
    "action_url": "https://example.com/action"
  },
  "tracking_settings": {
    "enable_tracking": true,
    "endpoint": "<string>",
    "utm_source": "<string>",
    "utm_medium": "<string>",
    "utm_campaign": "<string>",
    "utm_content": "<string>",
    "utm_term": "<string>",
    "workspace_id": "<string>",
    "message_id": "<string>"
  },
  "channel": "email"
}
'
{
  "success": true,
  "mjml": "<string>",
  "html": "<string>",
  "error": {
    "message": "<string>"
  }
}

Authorizations

Authorization
string
header
required

API token for authentication

Body

application/json
workspace_id
string
required

The ID of the workspace

Example:

"ws_1234567890"

message_id
string
required

Unique message ID for tracking

Example:

"msg_abc123"

visual_editor_tree
object
required

MJML visual editor tree structure (must have type 'mjml')

test_data
object

Data to use for Liquid templating

Example:
{
"user_name": "John Doe",
"action_url": "https://example.com/action"
}
tracking_settings
object
channel
enum<string>

Channel filter for block visibility

Available options:
email,
web

Response

Template compiled successfully

success
boolean

Whether compilation was successful

mjml
string

Generated MJML markup

html
string

Compiled HTML output

error
object

MJML compilation error details, if any