Templates
Reusable email content with {{variable}} placeholders. Dashboard-session endpoints.
Create a template
POST /templates
| Field | Type | Description |
|---|---|---|
| namerequired | string | Internal name shown in the dashboard. |
| subject | string | Subject line; may contain {{variables}}. |
| html | string | HTML body; may contain {{variables}}. |
| text | string | Plain-text body. |
Response
{"id": "tpl_...", "name": "Welcome", "subject": "Hi {{first_name}}",
"html": "...", "text": "...", "created_at": "...", "updated_at": "..."}List / retrieve / update / delete
GET /templates
GET /templates/:id
PUT /templates/:id
DELETE /templates/:id
PUT replaces all four fields. Use a template in a send by passing template_id + template_data to POST /emails.
Version history
GET /templates/:id/versions
GET /templates/:id/versions/:version
POST /templates/:id/versions/:version/restore
Every content-changing PUTsaves the previous content as a numbered version. Restoring applies a version's content to the template — and snapshots the replaced state first, so a restore is always undoable.
GET /templates/:id/versions
[{"version": 2, "name": "Welcome", "subject": "Hi {{first_name}}", "created_at": "..."},
{"version": 1, "name": "Welcome", "subject": "Hello", "created_at": "..."}]