Template Modules API
Create, retrieve, update, and delete reusable email content modules. Modules are blocks of email content (stored as JSON) that can be inserted into any template via the visual editor.
For a user guide on using modules in the visual editor, see Saved Modules.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/template-modules | List modules |
POST | /v1/template-modules | Create a module |
GET | /v1/template-modules/{id} | Get a module |
PUT | /v1/template-modules/{id} | Update a module |
DELETE | /v1/template-modules/{id} | Delete a module |
Authentication
All endpoints require a JWT bearer token:
| Operation | Required permission |
|---|---|
| List, Get | templates:read |
| Create, Update, Delete | templates:write |
Missing permission returns:
Module Object
Fields
| Field | Type | Description |
|---|---|---|
id | UUID | Module identifier |
name | string | Unique name within the workspace (1--255 characters) |
description | string or null | Optional description |
category | string | One of: header, footer, cta, content, custom |
tags | string[] | Optional tags for filtering and organization |
blocks_json | array | Array of email block objects (the module's content) |
thumbnail_url | string or null | Optional preview image URL |
is_synced | boolean | Whether this module syncs updates to templates that use it |
created_by | string or null | Member ID of the creator |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
List Modules
Query Parameters
| Parameter | Type | Description |
|---|---|---|
category | string | Filter by category: header, footer, cta, content, custom |
Response (200 OK)
Returns an array of module objects, ordered by updated_at descending (most recently modified first).
Create a Module
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Module name (1--255 characters, must be unique) |
description | string | No | Description |
category | string | No | header, footer, cta, content, or custom (default: custom) |
tags | string[] | No | Tags (default: empty array) |
blocks_json | array | Yes | Array of email block objects |
Response (201 Created)
Returns the full module object.
Module names must be unique within your workspace. Creating a module with a duplicate name returns 409 Conflict.
Get a Module
Returns the full module object, or 404 if not found.
Update a Module
All fields are optional. Only the fields you include are updated.
Request Body
| Field | Type | Description |
|---|---|---|
name | string | New name (1--255 characters, must be unique) |
description | string | New description |
category | string | New category |
tags | string[] | New tags |
blocks_json | array | New block content |
Response (200 OK)
Returns the updated module object. If the new name conflicts with an existing module, returns 409 Conflict.
Delete a Module
Returns 204 No Content on success. Deleting a module does not affect templates that already contain copies of its blocks.
Error Codes
| Status | Description |
|---|---|
| 403 | Missing templates:read or templates:write permission |
| 404 | Module not found |
| 409 | Module name already exists in this workspace |
| 422 | Validation error (e.g., name too long, invalid category) |