curl --request POST \
--url https://{notifuseDomain}/api/templates.create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"email": {
"subject": "Welcome, {{user_name}}!",
"compiled_preview": "<string>",
"visual_editor_tree": {
"type": "mjml",
"children": []
},
"sender_id": "sender_123",
"reply_to": "[email protected]",
"subject_preview": "Get started with your account",
"text": "<string>"
},
"web": {
"content": {},
"html": "<string>",
"plain_text": "<string>"
},
"template_macro_id": "<string>",
"test_data": {},
"settings": {}
}
'{
"template": {
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"version": 1,
"email": {
"subject": "Welcome, {{user_name}}!",
"compiled_preview": "<string>",
"visual_editor_tree": {
"type": "mjml",
"children": []
},
"sender_id": "sender_123",
"reply_to": "[email protected]",
"subject_preview": "Get started with your account",
"text": "<string>"
},
"web": {
"content": {},
"html": "<string>",
"plain_text": "<string>"
},
"template_macro_id": "<string>",
"integration_id": "<string>",
"test_data": {
"user_name": "John Doe",
"action_url": "https://example.com/action"
},
"settings": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Creates a new template. Each template must have a channel (email or web) with corresponding channel-specific content.
curl --request POST \
--url https://{notifuseDomain}/api/templates.create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"email": {
"subject": "Welcome, {{user_name}}!",
"compiled_preview": "<string>",
"visual_editor_tree": {
"type": "mjml",
"children": []
},
"sender_id": "sender_123",
"reply_to": "[email protected]",
"subject_preview": "Get started with your account",
"text": "<string>"
},
"web": {
"content": {},
"html": "<string>",
"plain_text": "<string>"
},
"template_macro_id": "<string>",
"test_data": {},
"settings": {}
}
'{
"template": {
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"version": 1,
"email": {
"subject": "Welcome, {{user_name}}!",
"compiled_preview": "<string>",
"visual_editor_tree": {
"type": "mjml",
"children": []
},
"sender_id": "sender_123",
"reply_to": "[email protected]",
"subject_preview": "Get started with your account",
"text": "<string>"
},
"web": {
"content": {},
"html": "<string>",
"plain_text": "<string>"
},
"template_macro_id": "<string>",
"integration_id": "<string>",
"test_data": {
"user_name": "John Doe",
"action_url": "https://example.com/action"
},
"settings": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}API token for authentication
The ID of the workspace
"ws_1234567890"
Unique identifier for the template (alphanumeric, underscores, and hyphens only)
32"welcome_email"
Name of the template
32"Welcome Email"
Communication channel
email, web "email"
Template category
marketing, transactional, welcome, opt_in, unsubscribe, bounce, blocklist, blog, other "transactional"
Show child attributes
Email subject line (supports Liquid templating)
"Welcome, {{user_name}}!"
Compiled HTML preview of the email
MJML visual editor tree structure
{ "type": "mjml", "children": [] }ID of the sender configuration to use
"sender_123"
Reply-To email address
Preview text shown in email clients
"Get started with your account"
Plain text version of the email
ID of the template macro (layout) to use
Test data for template preview
Channel-specific settings
Template created successfully
Show child attributes
Unique identifier for the template (alphanumeric, underscores, and hyphens only)
32"welcome_email"
Name of the template
32"Welcome Email"
Communication channel
email, web "email"
Template category
marketing, transactional, welcome, opt_in, unsubscribe, bounce, blocklist, blog, other 20"transactional"
Version number of the template
1
Show child attributes
Email subject line (supports Liquid templating)
"Welcome, {{user_name}}!"
Compiled HTML preview of the email
MJML visual editor tree structure
{ "type": "mjml", "children": [] }ID of the sender configuration to use
"sender_123"
Reply-To email address
Preview text shown in email clients
"Get started with your account"
Plain text version of the email
ID of the template macro (layout) to use
ID of the integration managing this template (e.g., Supabase)
Test data for template preview
{
"user_name": "John Doe",
"action_url": "https://example.com/action"
}Channel-specific third-party settings
When the template was created
When the template was last updated
When the template was deleted (null if active)