Skip to content

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.

Note

For a user guide on using modules in the visual editor, see Saved Modules.


Endpoints

MethodPathDescription
GET/v1/template-modulesList modules
POST/v1/template-modulesCreate 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:

bash
curl "https://synapse-api.pyrx.tech/v1/template-modules" \
-H "Authorization: Bearer eyJhbGciOiJS..."
OperationRequired permission
List, Gettemplates:read
Create, Update, Deletetemplates:write

Missing permission returns:

json
{
"detail": "Missing permission: templates:read"
}

Module Object

json
{
"id": "m1o2d3u4-l5e6-7890-abcd-ef1234567890",
"name": "Standard Footer",
"description": "Company footer with social links and unsubscribe",
"category": "footer",
"tags": ["footer", "social", "unsubscribe"],
"blocks_json": [
{
"id": "blk-1",
"type": "divider",
"props": { "style": "solid", "color": "#e5e7eb", "thickness": "1px" },
"styles": { "paddingTop": "24px", "paddingBottom": "16px" }
},
{
"id": "blk-2",
"type": "paragraph",
"props": { "text": "You received this email because you signed up at example.com." },
"styles": { "fontSize": "12px", "color": "#6b7280", "textAlign": "center" }
}
],
"thumbnail_url": null,
"is_synced": false,
"created_by": "mem_abc123",
"created_at": "2026-04-10T08:00:00Z",
"updated_at": "2026-04-15T14:30:00Z"
}

Fields

FieldTypeDescription
idUUIDModule identifier
namestringUnique name within the workspace (1--255 characters)
descriptionstring or nullOptional description
categorystringOne of: header, footer, cta, content, custom
tagsstring[]Optional tags for filtering and organization
blocks_jsonarrayArray of email block objects (the module's content)
thumbnail_urlstring or nullOptional preview image URL
is_syncedbooleanWhether this module syncs updates to templates that use it
created_bystring or nullMember ID of the creator
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp

List Modules

bash
curl "https://synapse-api.pyrx.tech/v1/template-modules" \
-H "Authorization: Bearer eyJhbGciOiJS..."

Query Parameters

ParameterTypeDescription
categorystringFilter 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).

json
[
{
"id": "m1o2d3u4-l5e6-7890-abcd-ef1234567890",
"name": "Standard Footer",
"description": "Company footer with social links and unsubscribe",
"category": "footer",
"tags": ["footer", "social"],
"blocks_json": [ "..." ],
"thumbnail_url": null,
"is_synced": false,
"created_by": "mem_abc123",
"created_at": "2026-04-10T08:00:00Z",
"updated_at": "2026-04-15T14:30:00Z"
}
]

Create a Module

bash
curl -X POST "https://synapse-api.pyrx.tech/v1/template-modules" \
-H "Authorization: Bearer eyJhbGciOiJS..." \
-H "Content-Type: application/json" \
-d '{
"name": "Hero Section",
"description": "Full-width hero with image and CTA button",
"category": "content",
"tags": ["hero", "featured"],
"blocks_json": [
{
"id": "blk-img",
"type": "image",
"props": { "src": "https://cdn.example.com/hero.jpg", "alt": "Hero image", "width": "600px" },
"styles": { "paddingBottom": "16px" }
},
{
"id": "blk-btn",
"type": "button",
"props": { "text": "Get Started", "url": "https://example.com/signup", "buttonColor": "#1D9E75", "textColor": "#ffffff", "borderRadius": "8px", "align": "center" },
"styles": {}
}
]
}'

Request Body

FieldTypeRequiredDescription
namestringYesModule name (1--255 characters, must be unique)
descriptionstringNoDescription
categorystringNoheader, footer, cta, content, or custom (default: custom)
tagsstring[]NoTags (default: empty array)
blocks_jsonarrayYesArray of email block objects

Response (201 Created)

Returns the full module object.

Note

Module names must be unique within your workspace. Creating a module with a duplicate name returns 409 Conflict.


Get a Module

bash
curl "https://synapse-api.pyrx.tech/v1/template-modules/m1o2d3u4-l5e6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer eyJhbGciOiJS..."

Returns the full module object, or 404 if not found.


Update a Module

bash
curl -X PUT "https://synapse-api.pyrx.tech/v1/template-modules/m1o2d3u4-l5e6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer eyJhbGciOiJS..." \
-H "Content-Type: application/json" \
-d '{
"name": "Hero Section v2",
"tags": ["hero", "featured", "v2"]
}'

All fields are optional. Only the fields you include are updated.

Request Body

FieldTypeDescription
namestringNew name (1--255 characters, must be unique)
descriptionstringNew description
categorystringNew category
tagsstring[]New tags
blocks_jsonarrayNew 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

bash
curl -X DELETE "https://synapse-api.pyrx.tech/v1/template-modules/m1o2d3u4-l5e6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer eyJhbGciOiJS..."

Returns 204 No Content on success. Deleting a module does not affect templates that already contain copies of its blocks.


Error Codes

StatusDescription
403Missing templates:read or templates:write permission
404Module not found
409Module name already exists in this workspace
422Validation error (e.g., name too long, invalid category)