Update Template
Update an existing email template. Changing mjml recompiles the stored HTML.
A test key cannot update a production template (403). A production key only updates production templates โ test templates are not found. To copy a test template into production, promote it.
/templates/:template_id
/templates/welcome
Path Parameters
The template TypeID or user_id.
Body Parameters
A name for the template. Unique per domain and mode.
A stable identifier you supply, unique per domain and mode.
MJML source. Compiled to HTML in the email. Required unless content is provided.
HTML (or plain text). Required unless mjml is provided. Do not send with mjml.
Default From address used when sending if the send request omits from.
Default recipients used when sending if the send request omits to.
Default subject used when sending if the send request omits subject. Placeholders such as {{name}} are filled from data at send time.
Note
mjml,content, andsubjectcan have dynamic content using our template language
Example
curl -X PATCH https://api.mailcast.io/v1/templates/:template_id \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d $'{
"name": "welcome-updated",
"mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hi {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>",
"subject": "Hi {{name}}"
}'
{
"template_id": "template_01k3tgwp77fcdtsekk1v9qf4rr",
"user_id": "welcome",
"name": "welcome-updated",
"mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hi {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>",
"from": "hello@example.com",
"to": null,
"subject": "Hi {{name}}",
"test_only": false,
"created_at": "2025-08-29T12:00:00Z",
"updated_at": "2025-08-29T13:30:00Z"
}