Templates
7 endpoints
POST
/api/templates/{id}/renderauth requiredRender 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 |
GET
/api/templates/{id}auth requiredGet template
Retrieve a single email template by its ID.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string | required | Template ID. |
Responses
200Template details.
| 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 |
500Internal server error.
| Field | Type | Required | Description |
|---|---|---|---|
| error | string | required |
PUT
/api/templates/{id}auth requiredUpdate 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 |
DELETE
/api/templates/{id}auth requiredDelete template
Delete an email template by its ID.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string | required | Template ID. |
Responses
200Template deleted successfully.
| Field | Type | Required | Description |
|---|---|---|---|
| deleted | boolean | required |
500Internal server error.
| Field | Type | Required | Description |
|---|---|---|---|
| error | string | required |
POST
/api/templates/{id}/validateauth requiredValidate 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 requiredList 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). |
| page | query | integer | optional | Page number (1-based). |
| limit | query | integer | optional | Number of items per page. |
Responses
200Paginated list of templates.
500Internal server error.
| Field | Type | Required | Description |
|---|---|---|---|
| error | string | required |
POST
/api/templatesauth requiredCreate template
Create a new email template with optional HTML/text bodies and variable declarations.
Request Bodyrequired
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | required | |
| subject | string | required | |
| htmlTemplate | string | optional | |
| textTemplate | string | optional | |
| variables | object[] | optional | |
| category | string | 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 |
500Internal server error.
| Field | Type | Required | Description |
|---|---|---|---|
| error | string | required |