List Templates
Retrieve a list of all published templates in your Emailit account. Only templates with published_at set are returned. Content (html/text) is excluded from list view.
/templatesQuery Parameters
per_pageintegerItems per page (1-100). Default: 25.
pageintegerPage number (minimum: 1). Default: 1.
filter[name]stringFilter by name (partial match).
filter[alias]stringFilter by alias (exact match).
filter[editor]stringFilter by editor type: html, tiptap, or dragit.
sortstringSort field: name, alias, created_at, updated_at, or published_at. Default: created_at.
orderstringSort order: asc or desc. Default: desc.
{
"data": [
{
"id": "tem_47TaFwzJx6mD7NeJYvLjFxVwbgT",
"name": "Welcome Email",
"alias": "welcome-email",
"from": "Support <support@company.com>",
"subject": "Welcome to our service!",
"reply_to": ["support@company.com"],
"editor": "html",
"published_at": "2025-12-24T10:30:00.000000Z",
"preview_url": "https://cdn.company.com/previews/welcome.png",
"total_versions": 3,
"created_at": "2025-12-24T09:00:00.000000Z",
"updated_at": "2025-12-24T10:30:00.000000Z"
}
],
"total_records": 10,
"per_page": 25,
"current_page": 1,
"total_pages": 1
} {
"message": "Unauthorized"
} Get Template
Retrieve a template by ID with full content and all other versions (templates with the same alias).
/templates/:idPath Parameters
idstringRequiredTemplate ID (e.g., tem_47TaFwzJx6mD7NeJYvLjFxVwbgT).
{
"data": {
"id": "tem_47TaFwzJx6mD7NeJYvLjFxVwbgT",
"name": "Welcome Email v1",
"alias": "welcome-email",
"from": "Support <support@company.com>",
"subject": "Welcome!",
"reply_to": ["support@company.com"],
"html": "<h1>Welcome!</h1>",
"text": "Welcome!",
"editor": "html",
"published_at": "2025-12-24T10:30:00.000000Z",
"preview_url": "https://cdn.company.com/previews/welcome.png",
"created_at": "2025-12-24T09:00:00.000000Z",
"updated_at": "2025-12-24T10:30:00.000000Z",
"versions": [
{
"id": "tem_anotherOidHere123456789",
"name": "Welcome Email v2",
"published_at": null,
"created_at": "2025-12-24T11:00:00.000000Z",
"updated_at": "2025-12-24T11:00:00.000000Z"
}
]
}
} {
"message": "Template not found"
} Key Concepts
Alias Grouping
Templates with the same alias are versions of the same template. When you fetch a template by ID, the versions array includes all other templates that share the same alias.
Publishing
Only one template per alias can be published at any time. The published template has a non-null published_at timestamp. Draft templates have published_at set to null.
Create Template
Create a new template through the Emailit API. Templates are automatically published if the alias doesn’t exist yet; otherwise, they remain as drafts.
/templatesRequest Body
namestringRequiredTemplate name. Maximum 191 characters.
aliasstringRequiredTemplate alias for grouping versions. Must contain only lowercase letters (a-z), numbers (0-9), underscores (_), and hyphens (-). Pattern: ^[a-z0-9_-]+$. Maximum 191 characters.
fromstringFrom email address in RFC format (e.g., Name <email@domain.com>). Maximum 191 characters.
subjectstringEmail subject line. Maximum 191 characters.
reply_tostring | string[]Single email or array of email addresses for reply-to.
htmlstringHTML content for the email template.
textstringPlain text content for the email template.
editorstringEditor type: html (default), tiptap, or dragit.
{
"data": {
"id": "tem_47TaFwzJx6mD7NeJYvLjFxVwbgT",
"name": "Welcome Email",
"alias": "welcome-email",
"from": "Support <support@company.com>",
"subject": "Welcome to our service!",
"reply_to": ["support@company.com"],
"html": "<h1>Welcome!</h1><p>Thanks for joining us.</p>",
"text": "Welcome! Thanks for joining us.",
"editor": "html",
"published_at": "2025-12-24T10:30:00.000000Z",
"preview_url": null,
"created_at": "2025-12-24T10:30:00.000000Z",
"updated_at": "2025-12-24T10:30:00.000000Z"
},
"message": "Template was successfully created."
} {
"message": "Validation failed",
"errors": {
"name": ["Name is required"],
"alias": ["Alias must contain only lowercase letters (a-z), numbers (0-9), underscores (_), and hyphens (-)"]
}
} Auto-Publishing Behavior
- New alias: When you create a template with an alias that doesn’t exist yet, the template is automatically published (
published_atis set). - Existing alias: When you create a template with an alias that already has templates, the new template is saved as a draft (
published_atisnull). You can publish it later using the Publish Template endpoint.
Validation Rules
| Field | Rules |
|---|---|
name | Required, max 191 characters |
alias | Required, max 191 characters, pattern: ^[a-z0-9_-]+$ |
from | Optional, max 191 characters |
subject | Optional, max 191 characters |
reply_to | Optional, must be valid email(s) |
editor | Optional, must be html, tiptap, or dragit |
Update Template
Update an existing template through the Emailit API. All fields are optional. This endpoint does not change the published_at status.
/templates/:idPath Parameters
idstringRequiredTemplate ID (e.g., tem_47TaFwzJx6mD7NeJYvLjFxVwbgT).
Request Body (all optional)
namestringTemplate name. Maximum 191 characters.
aliasstringTemplate alias. Must be unique if changing. Must contain only lowercase letters (a-z), numbers (0-9), underscores (_), and hyphens (-). Maximum 191 characters.
fromstringFrom email address in RFC format. Maximum 191 characters.
subjectstringEmail subject line. Maximum 191 characters.
reply_tostring | string[]Reply-to email address(es).
htmlstringHTML content for the email template.
textstringPlain text content for the email template.
editorstringEditor type: html, tiptap, or dragit.
{
"data": {
"id": "tem_47TaFwzJx6mD7NeJYvLjFxVwbgT",
"name": "Welcome Email - Updated",
"alias": "welcome-email",
"from": "Support <support@company.com>",
"subject": "Welcome! We are glad you are here",
"reply_to": ["support@company.com"],
"html": "<h1>Welcome!</h1>",
"text": "Welcome!",
"editor": "html",
"published_at": "2025-12-24T10:30:00.000000Z",
"preview_url": null,
"created_at": "2025-12-24T10:30:00.000000Z",
"updated_at": "2025-12-24T12:00:00.000000Z"
},
"message": "Template was successfully updated."
} {
"message": "Validation failed",
"errors": {
"alias": ["Alias already exists"]
}
} {
"message": "Template not found"
} Important Notes
- Updating a template does not change its
published_atstatus. A published template remains published, and a draft remains a draft. - If you change the
aliasto one that already exists, you’ll receive a validation error. - To publish a draft template, use the Publish Template endpoint.
Delete Template
Delete a template from your Emailit account.
/templates/:idPath Parameters
idstringRequiredTemplate ID (e.g., tem_47TaFwzJx6mD7NeJYvLjFxVwbgT).
{
"data": null,
"message": "Template was successfully deleted."
} {
"message": "Template not found"
} Important Notes
- Deleting a published template: If you delete the published template for an alias, no template will be published for that alias until you publish another version using the Publish Template endpoint.
- Deleting a draft: Deleting a draft template has no effect on the currently published template for that alias.
- This action is irreversible. The template and its content will be permanently deleted.
Publish Template
Publish a template and automatically unpublish all other templates with the same alias. Only one template per alias can be published at any time.
/templates/:id/publishPath Parameters
idstringRequiredTemplate ID (e.g., tem_47TaFwzJx6mD7NeJYvLjFxVwbgT).
Request Body
Empty body (no parameters required).
{
"data": {
"id": "tem_anotherOidHere123456789",
"name": "Welcome Email v2",
"alias": "welcome-email",
"from": "Support <support@company.com>",
"subject": "Welcome! Updated version",
"reply_to": ["support@company.com"],
"html": "<h1>Welcome v2!</h1>",
"text": "Welcome v2!",
"editor": "html",
"published_at": "2025-12-24T13:00:00.000000Z",
"preview_url": null,
"created_at": "2025-12-24T11:00:00.000000Z",
"updated_at": "2025-12-24T13:00:00.000000Z"
},
"message": "Template was successfully published."
} {
"message": "Template not found"
} How Publishing Works
When you publish a template:
- The target template gets its
published_attimestamp set to the current time. - All other templates with the same alias have their
published_atset tonull(unpublished).
This ensures that only one template per alias is ever published, making it easy to manage template versions and switch between them.
Use Cases
- A/B Testing: Create multiple versions of a template and publish different versions to test performance.
- Rollback: Quickly revert to a previous version by publishing an older template.
- Staging: Create new versions as drafts, test them, and publish when ready.