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": {},
  "subject": "Hi {{ contact.first_name }}",
  "subject_preview": "Welcome {{ contact.first_name }}",
  "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>"
  }
}
'
{
  "success": true,
  "mjml": "<string>",
  "html": "<string>",
  "subject": "Hi Pierre",
  "subject_preview": "Welcome Pierre",
  "error": {
    "message": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.notifuse.com/llms.txt

Use this file to discover all available pages before exploring further.

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

subject
string

Optional email subject. When provided, it is rendered through the same Liquid engine the send path uses (with test_data) and the rendered result is returned as subject in the response. Liquid processing is skipped when preserve_liquid is true, channel is web, or test_data is empty.

Example:

"Hi {{ contact.first_name }}"

subject_preview
string

Optional inbox preview text (the snippet shown after the subject in most clients). Rendered through Liquid like subject and returned as subject_preview in the response.

Example:

"Welcome {{ contact.first_name }}"

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

subject
string

Rendered email subject. Present only when the request included a non-empty subject. Returned on both success and error paths so the caller can display the rendered subject alongside any compilation error.

Example:

"Hi Pierre"

subject_preview
string

Rendered inbox preview text. Present only when the request included a non-empty subject_preview. Returned on both success and error paths.

Example:

"Welcome Pierre"

error
object

MJML compilation error details, if any