The plain text body. When you leave it out, sends get a text version made from the rendered HTML.
Create a template
Store a template in the project, with Mustache-style variables.
/v1/templatesAPI keyCreates version 1 of a template stored in the project. Send it with template: "<name>" in Send an email. The syntax ({{name}}, {{{raw}}}, {{#if}}, {{#each}}) is described in Custom templates.
You can reuse the name of a built-in template. The stored template then wins over the built-in one for this project.
Body parameters
1 to 100 characters: lowercase letters, digits, - and _, starting with a letter or digit. Must be unique in the project.
1 to 998 characters. Variables are allowed, for example Welcome, {{first_name}}. Not HTML-escaped.
The HTML body. Values inserted with {{…}} are HTML-escaped; {{{…}}} inserts them as is.
The variables the template expects. A required variable must be present and not empty in data, or the send fails with 400 invalid_template_data.
Response
Status 201.
The template ID, for example tmpl_01K6B5A7C9E1G3J5L7N9Q1S3U5.
Always db for stored templates.
The project the template belongs to.
The template name.
The subject, unrendered.
The HTML, unrendered.
The text body, or null.
The declared variables.
1 for a new template.
ISO 8601 timestamp.
ISO 8601 timestamp.
Errors
| Status | Code | When |
|---|---|---|
| 400 | missing_body | The request has no body. |
| 400 | invalid_body | A field is missing or malformed, for example a name with capital letters. param names the field. |
| 400 | invalid_template | A syntax error, such as an unclosed {{#if}}. param is subject, html or text. |
| 409 | template_exists | The project already has a stored template with this name. |