Create
Create a new template using the default context.Parameters
*CreateTemplateRequest
required
The template creation parameters.
Returns
Returns a*CreateTemplateResponse containing the created template ID.
Example
CreateWithContext
Create a new template with a custom context.Parameters
context.Context
required
Context for the request, useful for timeouts and cancellation.
*CreateTemplateRequest
required
The template creation parameters.
Returns
Returns a*CreateTemplateResponse containing the created template ID.
Example
Types
CreateTemplateRequest
Request payload for creating a template.string
required
The name of the template.
string
A unique alias for the template. Can be used instead of the ID to reference the template.
string
The sender email address. Can be a plain email or formatted as “Name <email@example.com>”.
string
The email subject line. Can include template variables like
{{{variable_name}}}.any
Reply-to email address. Can be a string or array of strings.
string
required
The HTML content of the email template. Use
{{{variable_name}}} syntax for variables.Important: All variables referenced in Html must be declared in the Variables array, or the API will return a validation error.string
Plain text version of the email template.
[]*TemplateVariable
Array of variable declarations used in the template. All variables referenced in Html or Subject must be declared here.
CreateTemplateResponse
Response from creating a template.string
The unique identifier of the created template.
string
The object type, always “template”.
TemplateVariable
Represents a variable in a template.string
required
The variable name (without the curly braces). For example, for
{{{name}}}, use “name”.VariableType
required
The type of the variable. Can be
VariableTypeString or VariableTypeNumber.any
Default value to use if the variable is not provided when sending an email.