Skip to main content
POST
/
templates
curl --request POST \
  --url https://app.lettr.com/api/templates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Welcome Email",
  "json": "{\"tagName\":\"mj-container\",\"children\":[{\"tagName\":\"mj-text\",\"content\":\"Hello {{FIRST_NAME}}!\"}]}"
}
'
{
  "message": "Template created successfully.",
  "data": {
    "id": 123,
    "name": "Welcome Email",
    "slug": "welcome-email",
    "project_id": 5,
    "folder_id": 10,
    "active_version": 1,
    "merge_tags": [
      {
        "key": "FIRST_NAME",
        "required": true
      }
    ],
    "created_at": "2026-01-28T12:00:00+00:00"
  }
}
Creates a new email template with either HTML or JSON content. Provide html for raw HTML templates or json for visual editor (Topol) templates — these fields are mutually exclusive. The template is automatically assigned a URL-friendly slug based on its name. You can optionally assign it to a specific project and folder using project_id and folder_id. If omitted, the template is added to your team’s default project.

Authorizations

Authorization
string
header
required

API key for authentication

Body

application/json

Request to create a new email template. Provide either html for custom HTML templates or json for Topol visual editor templates.

name
string
required

Name of the template

Maximum string length: 255
Example:

"Welcome Email"

project_id
integer

Project ID to create the template in. If not provided, uses the team's default project.

Required range: x >= 1
Example:

5

folder_id
integer

Folder ID to create the template in. If not provided, uses the first folder in the project.

Required range: x >= 1
Example:

10

html
string

HTML content for custom HTML templates. Required if json is not provided. Mutually exclusive with json.

Example:

"<html><body><p>Hello {{NAME}}!</p></body></html>"

json
string

JSON content for Topol visual editor templates. Required if html is not provided. Mutually exclusive with html.

Example:

"{\"tagName\":\"mj-container\",\"children\":[{\"tagName\":\"mj-text\",\"content\":\"Hello {{FIRST_NAME}}!\"}]}"

Response

Template created successfully

Response after successfully creating a template

message
string
required

Human-readable response message

Example:

"Template created successfully."

data
object
required

View of a newly created template