Create Template
Create an email template from MJML or HTML. Provide mjml or content, not both. Use the returned template_id with Send Email.
Templates created with a test key are test-only (test_only: true) and cannot be sent with a production key until a production key updates (promotes) them. Templates created with a production key are production templates. The name is unique per domain โ you cannot have both a test and production template with the same name.
/templates
/templates
Body Parameters
A unique name for the template on this domain.
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.
Note
mjml,content, andsubjectcan have dynamic content using our template language
Example
curl -X POST https://api.mailcast.io/v1/templates \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d $'{
"name": "welcome",
"mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hello {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>",
"from": "hello@example.com",
"subject": "Welcome {{name}}"
}'
{
"template_id": "template_01k3tgwp77eyy9e3kwfmg30svh",
"name": "welcome",
"mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hello {{name}}</mj-text></mj-column></mj-section></mj-body></mjml>",
"from": "hello@example.com",
"to": null,
"subject": "Welcome {{name}}",
"test_only": false,
"created_at": "2025-08-29T12:00:00Z",
"updated_at": "2025-08-29T12:00:00Z"
}