Templates
Reusable, versioned email bodies rendered with Mustache syntax (`{{ name }}`). Organize them into folders. Campaigns and emails pin a specific version, so editing a template never changes past sends.
Create a template folder
/template-foldersAuthorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
Body ยท application/json
namecurl https://api.mailcraft.host/v1/template-folders \
-X POST \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{ "name": "Onboarding" }'{
"data": { "id": 2, "name": "Onboarding", "created_at": "2026-09-22T14:14:00.000000Z" }
}List template folders
/template-foldersAuthorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/template-folders \
-H 'Authorization: Bearer sk_live_...'{
"data": [{ "id": 2, "name": "Onboarding" }]
}Delete a template folder
/template-folders/{folder}Authorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/template-folders/2 \
-X DELETE \
-H 'Authorization: Bearer sk_live_...'(empty body)Create a template
/templatesAuthorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
Body ยท application/json
nametemplate_folder_idsubjecthtml_bodyvariablescurl https://api.mailcraft.host/v1/templates \
-X POST \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{
"name": "Welcome email",
"template_folder_id": 2,
"subject": "Welcome, {{ first_name }}!",
"html_body": "<p>Hi {{ first_name }}, thanks for joining.</p>",
"variables": { "first_name": "string" }
}'{
"data": {
"id": 9,
"template_folder_id": 2,
"name": "Welcome email",
"slug": "welcome-email",
"subject": "Welcome, {{ first_name }}!",
"html_body": "<p>Hi {{ first_name }}, thanks for joining.</p>",
"text_body": null,
"variables": { "first_name": "string" },
"current_version": 1,
"created_at": "2026-09-22T14:15:00.000000Z",
"updated_at": "2026-09-22T14:15:00.000000Z"
}
}List templates
/templatesAuthorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/templates \
-H 'Authorization: Bearer sk_live_...'{
"data": [
{ "id": 9, "name": "Welcome email", "slug": "welcome-email", "current_version": 1 }
]
}Get a template
/templates/{template}Authorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/templates/9 \
-H 'Authorization: Bearer sk_live_...'{
"data": {
"id": 9,
"template_folder_id": 2,
"name": "Welcome email",
"slug": "welcome-email",
"subject": "Welcome, {{ first_name }}!",
"html_body": "<p>Hi {{ first_name }}, thanks for joining.</p>",
"text_body": null,
"variables": { "first_name": "string" },
"current_version": 1,
"created_at": "2026-09-22T14:15:00.000000Z",
"updated_at": "2026-09-22T14:15:00.000000Z"
}
}Update a template
Saves a new version. Past emails and campaigns keep rendering from the version they were pinned to.
/templates/{template}Authorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
Body ยท application/json
subjectcurl https://api.mailcraft.host/v1/templates/9 \
-X PATCH \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{ "subject": "Welcome aboard, {{ first_name }}!" }'{
"data": {
"id": 9,
"subject": "Welcome aboard, {{ first_name }}!",
"current_version": 2,
"updated_at": "2026-09-22T16:00:00.000000Z"
}
}Delete a template
/templates/{template}Authorizations
Authorization API key for your workspace, scoped to templates:manage. Pass it as a Bearer token in the Authorization header.
curl https://api.mailcraft.host/v1/templates/9 \
-X DELETE \
-H 'Authorization: Bearer sk_live_...'(empty body)