Create a template
Creates a new template. Each template must have a channel (email or web) with corresponding channel-specific content.
post/api/templates.create
Request body
Example request
{
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"email": {
"sender_id": "sender_123",
"reply_to": "support@example.com",
"subject": "Welcome, {{user_name}}!",
"subject_preview": "Get started with your account",
"visual_editor_tree": {
"type": "mjml",
"children": []
}
},
"category": "transactional"
}Response
Template created successfully
Example response
{
"template": {
"id": "welcome_email",
"name": "Welcome Email",
"version": 1,
"channel": "email",
"email": {
"sender_id": "sender_123",
"reply_to": "support@example.com",
"subject": "Welcome, {{user_name}}!",
"subject_preview": "Get started with your account",
"visual_editor_tree": {
"type": "mjml",
"children": []
}
},
"category": "transactional",
"test_data": {
"user_name": "John Doe",
"action_url": "https://example.com/action"
}
}
}