Documentation

Update Template

Update an existing email template. Changing mjml recompiles the stored HTML.

A production key updating a test-only template promotes it (test_only becomes false). A test key cannot update a production template (403).

PATCH /templates/:template_id
Example: /templates/template_01k3tgwp77eh6by9v79627fjsm

Path Parameters

template_id string required

The ID of the template to update.

Body Parameters

name string

A unique name for the template on this domain.

mjml string

MJML source. Compiled to HTML in the email. Required unless content is provided.

content string

HTML (or plain text). Required unless mjml is provided. Do not send with mjml.

from string

Default From address used when sending if the send request omits from.

to array

Default recipients used when sending if the send request omits to.

subject string

Default subject used when sending if the send request omits subject.

Note

mjml, content, and subject can 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}}"
}'
Response 200
{
  "template_id": "template_01k3tgwp77fq3avde371cyk598",
  "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"
}