POST/templates

Create a template

Creates a new email template from its name and HTML content. Supply name and html; you can also set sender details, reply-to addresses, plain-text content, and template variables.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

8 body fields

Template details; name and html are required.

namestringrequired
The name of the template.
aliasstringoptional
The alias of the template.
fromstringoptional
Sender email address. To include a friendly name, use the format "Your Name <sender@domain.com>".
subjectstringoptional
Email subject.
reply_toarray<string>optional
Reply-to email addresses.
htmlstringrequired
The HTML version of the template.
textstringoptional
The plain text version of the template.
variablesarray<object>optional
Template variable definitions; each variable must include a `key` and a `type` of `string`, `number`, `boolean`, `object`, or `list`.

1 status code
201Returns the created template's identifier and the response object type.
idstringoptional
The ID of the template.
objectstringoptional
The object type of the response.

Error handling

name and html are required. Each variable must include key and type, and type must be one of string, number, boolean, object, or list.