POST/api/templates/{id}/renderauth required
Render template
Render an email template with variable substitution. Returns the interpolated HTML, text, and subject.
Parameters
| Name | In | Type | Required | Description |
|---|
| id | path | string | required | Template ID. |
Request Bodyrequired
| Field | Type | Required | Description |
|---|
| variables | object | optional | |
Responses
200Rendered template output.
| Field | Type | Required | Description |
|---|
| html | any | required | |
| text | any | required | |
| subject | string | required | |
500Internal server error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
PUT/api/templates/{id}auth required
Update template
Update an existing email template. All fields are optional. The template version is incremented automatically.
Parameters
| Name | In | Type | Required | Description |
|---|
| id | path | string | required | Template ID. |
Request Bodyrequired
| Field | Type | Required | Description |
|---|
| name | string | optional | |
| subject | string | optional | |
| htmlTemplate | string | optional | |
| textTemplate | string | optional | |
| variables | object[] | optional | |
| category | string | optional | |
Responses
200Template updated successfully.
| Field | Type | Required | Description |
|---|
| id | string | required | |
| projectId | any | required | |
| name | string | required | |
| subject | string | required | |
| htmlTemplate | any | required | |
| textTemplate | any | required | |
| variables | any | required | |
| category | any | required | |
| version | any | required | |
| isActive | any | required | |
| syncStatus | any | required | |
| providerTemplateRef | any | required | |
| createdAt | string | required | |
| updatedAt | string | required | |
400Validation error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
500Internal server error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
POST/api/templates/{id}/validateauth required
Validate template
Check a template for variable declaration mismatches. Returns errors when a {{variable}} is used but not declared, and warnings when a variable is declared but never referenced.
Parameters
| Name | In | Type | Required | Description |
|---|
| id | path | string | required | Template ID. |
Responses
200Validation result with errors, warnings, and discovered variables.
| Field | Type | Required | Description |
|---|
| valid | boolean | required | |
| errors | string[] | required | |
| warnings | string[] | required | |
| variables | string[] | required | |
500Internal server error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
GET/api/templatesauth required
List templates
Retrieve all email templates. Supports filtering by category, active status, and search term, as well as pagination.
Parameters
| Name | In | Type | Required | Description |
|---|
| category | query | string | optional | Filter templates by category. |
| isActive | query | string | optional | Filter by active status ("true" or "false"). |
| search | query | string | optional | Search templates by name (partial match). |
| projectId | query | string (uuid) | optional | Only this project's templates, plus org-wide templates that have no project. |
| page | query | integer | optional | Page number (1-based). |
| limit | query | integer | optional | Number of items per page. |
Responses
200Paginated list of templates.
400Validation error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
500Internal server error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
POST/api/templatesauth required
Create template
Create a new email template with optional HTML/text bodies and variable declarations. The template belongs to `projectId`, a project you can open. Omitted, it belongs to the organization's only project; with several projects, omitting it is 400 PROJECT_REQUIRED, and with none, 422 NO_PROJECT.
Request Bodyrequired
| Field | Type | Required | Description |
|---|
| name | string | required | |
| subject | string | required | |
| htmlTemplate | string | optional | |
| textTemplate | string | optional | |
| variables | object[] | optional | |
| category | string | optional | |
| projectId | string (uuid) | optional | |
Responses
200Template created successfully.
| Field | Type | Required | Description |
|---|
| id | string | required | |
| projectId | any | required | |
| name | string | required | |
| subject | string | required | |
| htmlTemplate | any | required | |
| textTemplate | any | required | |
| variables | any | required | |
| category | any | required | |
| version | any | required | |
| isActive | any | required | |
| syncStatus | any | required | |
| providerTemplateRef | any | required | |
| createdAt | string | required | |
| updatedAt | string | required | |
400Validation error.
| Field | Type | Required | Description |
|---|
| error | string | required | |
404The named project does not exist or you cannot open it.
| Field | Type | Required | Description |
|---|
| error | string | required | |
422NO_PROJECT: the organization has no project to put the template in.
| Field | Type | Required | Description |
|---|
| error | string | required | |
500Internal server error.
| Field | Type | Required | Description |
|---|
| error | string | required | |