Create Template
POST/template
Creates a new saved template for your account
- name - Required. Unique within the account, up to 256 characters.
- subject - Optional, up to 150 characters. Default subject for campaigns created from the template.
- previewText - Optional, up to 150 characters. Default preview text (preheader) for campaigns created from the template.
- html - Required. Full HTML of the email.
- css - Optional. Defaults to empty.
Templates created through the API open in the HTML editor in the app (editorType is always HTML).
Request
- application/json
Body
required
Possible values: <= 256 characters
Template name, unique within the account
Possible values: <= 150 characters
Default subject for campaigns created from this template
Possible values: <= 150 characters
Default preview text (preheader) for campaigns created from this template
Full HTML of the email
Optional CSS kept alongside the HTML. Defaults to empty.
Responses
- 201
- 412
Template created
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [DRAG_AND_DROP, HTML]
Editor the template opens in. Always HTML for templates created through the API.
Creation time in epoch milliseconds
Last update time in epoch milliseconds
{
"id": "8a6e0f6c-2b7d-4a8e-9a5e-6f1d2c3b4a59",
"name": "Welcome Email",
"subject": "Welcome!",
"previewText": "Thanks for joining us",
"html": "<html><body><h1>Welcome</h1></body></html>",
"css": "h1 { color: #333333; }",
"editorType": "HTML",
"createdAt": 1790848800000,
"updatedAt": 1790848800000
}
Precondition Failed. The template was not found in your account, or the request failed validation:
a duplicate name (errorCodes[0].errorCode = 4.4.001), a missing name or html, or a field over its maximum length.
- application/json
- Schema
- Example (from schema)
- Duplicate name
- Missing field
- Field too long
- Template not found
Schema
- Array [
- ]
errorCodes object[]
{
"message": "Some error message",
"messageDetails": "string",
"errorCodes": [
{
"errorCode": "string",
"errorMessage": "string"
}
]
}
{
"message": "Template with name 'Welcome Email' already exists for this account!",
"errorCodes": [
{
"errorCode": "4.4.001",
"errorMessage": "Template with name 'Welcome Email' already exists for this account!"
}
]
}
{
"message": "name must not be blank"
}
{
"message": "subject may not exceed 150 characters"
}
{
"message": "Template 8a6e0f6c-2b7d-4a8e-9a5e-6f1d2c3b4a59 not found"
}