Skip to main content
POST
/
templates
curl --request POST \
  --url https://api.autosend.com/v1/templates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "templateName": "Welcome Email",
  "description": "Welcome email for new users",
  "subject": "Welcome to {{companyName}}, {{firstName}}!",
  "previewText": "We are glad to have you on board",
  "emailTemplate": "<h1>Welcome, {{firstName}}!</h1><p>Thanks for joining {{companyName}}.</p>",
  "templateType": "transactional",
  "builderType": "code"
}'
{
  "success": true,
  "data": {
    "templateId": "A-abc123def456ghi789jk",
    "templateName": "Welcome Email",
    "description": "Welcome email for new users",
    "subject": "Welcome to {{companyName}}, {{firstName}}!",
    "previewText": "We are glad to have you on board",
    "emailTemplate": "<h1>Welcome, {{firstName}}!</h1><p>Thanks for joining {{companyName}}.</p>",
    "templateType": "transactional",
    "builderType": "code",
    "createdAt": "2026-03-17T10:30:00.000Z",
    "updatedAt": "2026-03-17T10:30:00.000Z"
  }
}
curl --request POST \
  --url https://api.autosend.com/v1/templates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "templateName": "Welcome Email",
  "description": "Welcome email for new users",
  "subject": "Welcome to {{companyName}}, {{firstName}}!",
  "previewText": "We are glad to have you on board",
  "emailTemplate": "<h1>Welcome, {{firstName}}!</h1><p>Thanks for joining {{companyName}}.</p>",
  "templateType": "transactional",
  "builderType": "code"
}'
{
  "success": true,
  "data": {
    "templateId": "A-abc123def456ghi789jk",
    "templateName": "Welcome Email",
    "description": "Welcome email for new users",
    "subject": "Welcome to {{companyName}}, {{firstName}}!",
    "previewText": "We are glad to have you on board",
    "emailTemplate": "<h1>Welcome, {{firstName}}!</h1><p>Thanks for joining {{companyName}}.</p>",
    "templateType": "transactional",
    "builderType": "code",
    "createdAt": "2026-03-17T10:30:00.000Z",
    "updatedAt": "2026-03-17T10:30:00.000Z"
  }
}

Authorizations

Authorizations
string | header
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

Template data for creating a new email template
templateName
string
required
Name of the template (max 90 characters).Maximum length: 90Example: "Welcome Email"
subject
string
required
Email subject line (max 988 characters). Supports Handlebars template variables.Maximum length: 988Example: "Welcome to {{companyName}}, {{firstName}}!"
description
string
Short description of the template (max 140 characters).Maximum length: 140Example: "Welcome email for new users"
previewText
string
Email preview text / preheader (max 140 characters). This text is shown in email clients before the email is opened.Maximum length: 140Example: "We are glad to have you on board"
emailTemplate
string
HTML content of the email template. Supports Handlebars syntax for dynamic variables.Handlebars Template Variables:Use Handlebars syntax for template variables in your HTML. Variables are wrapped in double curly braces: {{variableName}}.Example:
<h1>Welcome, {{firstName}}!</h1>
<p>Thanks for joining {{companyName}}.</p>
Provide the values for these variables in the dynamicData field when sending emails using this template.
templateType
string
Type of the template.Allowed values: transactional, marketingDefault: "transactional"Example: "transactional"
builderType
string
Builder type used to create the template.Allowed values: code, visualDefault: "code"Example: "code"
dynamicVariables
object
Dynamic variables configuration for the template.Example:
{
  "firstName": "string",
  "companyName": "string"
}
senderId
string
ID of the sender to associate with this template. The sender must belong to the same project.Example: "60d5ec49f1b2c72d9c8b4567"

Response

Template created successfully
success
boolean
Indicates if the request was successfulExample: true
data
object
The created template object