# Templates

> Handlebars and Markdown templates, and rendering one without sending.

URL: https://docs.workwae.com/reference/templates

Guides: [Templates](/guides/templates).

| Method | Path | Operation | Scope |
| --- | --- | --- | --- |
| `GET` | `/v1/templates` | [List templates](#list-templates) | `read` |
| `POST` | `/v1/templates` | [Create a template](#create-a-template) | `write` |
| `GET` | `/v1/templates/{templateId}` | [Get a template](#get-a-template) | `read` |
| `PATCH` | `/v1/templates/{templateId}` | [Update a template](#update-a-template) | `write` |
| `DELETE` | `/v1/templates/{templateId}` | [Delete a template](#delete-a-template) | `write` |
| `POST` | `/v1/template-renders` | [Render a template without sending](#render-a-template-without-sending) | `read` |

## List templates

`GET /v1/templates`

TypeScript SDK method: `workwae.templates.list()`

Newest first, without their content (GET /v1/templates/{templateId} has it). accountId lists those bound to that account; usableBy those the account may send with (the tenant's shared ones and its own); name the ones of that exact name, one per scope; query those whose name contains it, ignoring case.

Required scope: `read`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | 1 to 200. Default `50`. |
| `cursor` | query | string | no | 1 to 512 characters. Example `"eyJ0eG5pZCI6IjQyIiwiaWQiOjEwMDF9"`. |
| `accountId` | query | string (uuid) | no | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `usableBy` | query | string (uuid) | no | Example `"68cf9106-f69c-4aaf-bf6f-e38214cc7514"`. |
| `name` | query | string | no | At most 255 characters. |
| `query` | query | string | no | At most 255 characters. |

### Responses

- **200** OK (application/json, object)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | object[] | yes |  |
| `items[].id` | string (uuid) | yes | Example `"c4e6a8b0-1d3f-4a5c-8e7b-9d1f3a5c7e9b"`. |
| `items[].accountId` | string (uuid) \| null | yes | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `items[].name` | string | yes |  |
| `items[].description` | string \| null | yes | Example `"Production"`. |
| `items[].source` | "handlebars" \| "react-email" | yes |  |
| `items[].externalRef` | string \| null | yes | Example `"user_42"`. |
| `items[].createdAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `items[].updatedAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `nextCursor` | string \| null | yes | Example `"eyJ0eG5pZCI6IjQyIiwiaWQiOjEwMDF9"`. |

- **Errors**, by status and `code` (see [Errors](/guides/errors)):
  - 400: `invalid_input`, `invalid_idempotency_key`, `invalid_cursor`
  - 401: `unauthenticated`, `api_key_expired`
  - 403: `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden`, `mcp_only_key`, `plan_module_unavailable`
  - 409: `idempotency_key_in_progress`
  - 413: `payload_too_large`
  - 422: `idempotency_key_reused`
  - 429: `rate_limited`, `too_many_requests`
  - 500: `internal_error`
  - 503: `overloaded`

## Create a template

`POST /v1/templates`

TypeScript SDK method: `workwae.templates.create()`

Every field is checked to compile as Handlebars.

Required scope: `write`.

### Request body (required)

Content type `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | string (uuid) | no | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `name` | string | yes | 1 to 255 characters. |
| `description` | string | no | At most 1000 characters. Example `"Production"`. |
| `subject` | string | no | At most 2000 characters. Example `"Quarterly report"`. |
| `html` | string | no | At most 1000000 characters. |
| `text` | string | no | At most 1000000 characters. |
| `previewText` | string | no | At most 2000 characters. |
| `format` | "html" \| "markdown" | no | Default `"html"`. |
| `source` | "handlebars" \| "react-email" | no | Default `"handlebars"`. |
| `externalRef` | string | no | At most 255 characters. Example `"user_42"`. |

### Responses

- **201** OK (application/json, object)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | yes | Example `"c4e6a8b0-1d3f-4a5c-8e7b-9d1f3a5c7e9b"`. |
| `accountId` | string (uuid) \| null | yes | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `name` | string | yes |  |
| `description` | string \| null | yes | Example `"Production"`. |
| `source` | "handlebars" \| "react-email" | yes |  |
| `externalRef` | string \| null | yes | Example `"user_42"`. |
| `createdAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `updatedAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `subject` | string \| null | yes | Example `"Quarterly report"`. |
| `html` | string \| null | yes |  |
| `text` | string \| null | yes |  |
| `previewText` | string \| null | yes |  |
| `format` | "html" \| "markdown" | yes |  |

- **Errors**, by status and `code` (see [Errors](/guides/errors)):
  - 400: `invalid_input`, `invalid_idempotency_key`, `invalid_template`
  - 401: `unauthenticated`, `api_key_expired`
  - 403: `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden`, `mcp_only_key`, `plan_module_unavailable`
  - 409: `idempotency_key_in_progress`, `template_name_taken`
  - 413: `payload_too_large`
  - 422: `idempotency_key_reused`, `unknown_account`
  - 429: `rate_limited`, `too_many_requests`
  - 500: `internal_error`
  - 503: `overloaded`

## Get a template

`GET /v1/templates/{templateId}`

TypeScript SDK method: `workwae.templates.get()`

Required scope: `read`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `templateId` | path | string (uuid) | yes | Example `"c0e1bf1f-c03b-4b05-acbf-794066d1e730"`. |

### Responses

- **200** OK (application/json, object)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | yes | Example `"c4e6a8b0-1d3f-4a5c-8e7b-9d1f3a5c7e9b"`. |
| `accountId` | string (uuid) \| null | yes | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `name` | string | yes |  |
| `description` | string \| null | yes | Example `"Production"`. |
| `source` | "handlebars" \| "react-email" | yes |  |
| `externalRef` | string \| null | yes | Example `"user_42"`. |
| `createdAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `updatedAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `subject` | string \| null | yes | Example `"Quarterly report"`. |
| `html` | string \| null | yes |  |
| `text` | string \| null | yes |  |
| `previewText` | string \| null | yes |  |
| `format` | "html" \| "markdown" | yes |  |

- **Errors**, by status and `code` (see [Errors](/guides/errors)):
  - 400: `invalid_input`, `invalid_idempotency_key`
  - 401: `unauthenticated`, `api_key_expired`
  - 403: `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden`, `mcp_only_key`, `plan_module_unavailable`
  - 404: `template_not_found`
  - 409: `idempotency_key_in_progress`
  - 413: `payload_too_large`
  - 422: `idempotency_key_reused`
  - 429: `rate_limited`, `too_many_requests`
  - 500: `internal_error`
  - 503: `overloaded`

## Update a template

`PATCH /v1/templates/{templateId}`

TypeScript SDK method: `workwae.templates.update()`

Only the fields given change; queued sends keep what they were rendered with.

Required scope: `write`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `templateId` | path | string (uuid) | yes | Example `"c0e1bf1f-c03b-4b05-acbf-794066d1e730"`. |

### Request body

Content type `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | 1 to 255 characters. |
| `description` | string \| null | no | Example `"Production"`. |
| `subject` | string \| null | no | Example `"Quarterly report"`. |
| `html` | string \| null | no |  |
| `text` | string \| null | no |  |
| `previewText` | string \| null | no |  |
| `format` | "html" \| "markdown" | no |  |
| `source` | "handlebars" \| "react-email" | no |  |
| `externalRef` | string \| null | no | Example `"user_42"`. |

### Responses

- **200** OK (application/json, object)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | yes | Example `"c4e6a8b0-1d3f-4a5c-8e7b-9d1f3a5c7e9b"`. |
| `accountId` | string (uuid) \| null | yes | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `name` | string | yes |  |
| `description` | string \| null | yes | Example `"Production"`. |
| `source` | "handlebars" \| "react-email" | yes |  |
| `externalRef` | string \| null | yes | Example `"user_42"`. |
| `createdAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `updatedAt` | string (date-time) | yes | Example `"2026-05-04T09:30:00.000Z"`. |
| `subject` | string \| null | yes | Example `"Quarterly report"`. |
| `html` | string \| null | yes |  |
| `text` | string \| null | yes |  |
| `previewText` | string \| null | yes |  |
| `format` | "html" \| "markdown" | yes |  |

- **Errors**, by status and `code` (see [Errors](/guides/errors)):
  - 400: `invalid_input`, `invalid_idempotency_key`, `invalid_template`
  - 401: `unauthenticated`, `api_key_expired`
  - 403: `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden`, `mcp_only_key`, `plan_module_unavailable`
  - 404: `template_not_found`
  - 409: `idempotency_key_in_progress`, `template_name_taken`
  - 413: `payload_too_large`
  - 422: `idempotency_key_reused`
  - 429: `rate_limited`, `too_many_requests`
  - 500: `internal_error`
  - 503: `overloaded`

## Delete a template

`DELETE /v1/templates/{templateId}`

TypeScript SDK method: `workwae.templates.delete()`

Queued sends keep their rendered content.

Required scope: `write`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `templateId` | path | string (uuid) | yes | Example `"c0e1bf1f-c03b-4b05-acbf-794066d1e730"`. |

### Responses

- **204** OK (application/json, any)
- **Errors**, by status and `code` (see [Errors](/guides/errors)):
  - 400: `invalid_input`, `invalid_idempotency_key`
  - 401: `unauthenticated`, `api_key_expired`
  - 403: `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden`, `mcp_only_key`, `plan_module_unavailable`
  - 404: `template_not_found`
  - 409: `idempotency_key_in_progress`
  - 413: `payload_too_large`
  - 422: `idempotency_key_reused`
  - 429: `rate_limited`, `too_many_requests`
  - 500: `internal_error`
  - 503: `overloaded`

## Render a template without sending

`POST /v1/template-renders`

TypeScript SDK method: `workwae.templateRenders.create()`

Renders a stored template (templateId) or inline fields with params, as a send would. account.email and account.name come from accountId, else from the template's own account, else render empty.

Required scope: `read`.

### Request body (required)

Content type `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `templateId` | string (uuid) | no | Example `"c0e1bf1f-c03b-4b05-acbf-794066d1e730"`. |
| `accountId` | string (uuid) | no | Example `"6f1c2a4e-8b3d-4e5f-9a7b-1c2d3e4f5a6b"`. |
| `subject` | string | no | At most 2000 characters. Example `"Quarterly report"`. |
| `html` | string | no | At most 1000000 characters. |
| `text` | string | no | At most 1000000 characters. |
| `previewText` | string | no | At most 2000 characters. |
| `format` | "html" \| "markdown" | no |  |
| `params` | object | no | Default `{}`. |

### Responses

- **200** OK (application/json, object)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `subject` | string \| null | yes | Example `"Quarterly report"`. |
| `html` | string \| null | yes |  |
| `text` | string \| null | yes |  |
| `previewText` | string \| null | yes |  |

- **Errors**, by status and `code` (see [Errors](/guides/errors)):
  - 400: `invalid_input`, `invalid_idempotency_key`, `invalid_template`, `template_and_inline_fields`, `template_account_mismatch`, `params_too_large`, `template_render_failed`
  - 401: `unauthenticated`, `api_key_expired`
  - 403: `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden`, `mcp_only_key`, `plan_module_unavailable`
  - 409: `idempotency_key_in_progress`
  - 413: `payload_too_large`
  - 422: `idempotency_key_reused`, `unknown_account`, `unknown_template`
  - 429: `rate_limited`, `too_many_requests`
  - 500: `internal_error`
  - 503: `overloaded`
