Create and Manage Templates
Create, update, duplicate, and delete email templates via the API.
Create and Manage Templates
Templates are the core resource in Templated. This guide walks through the full CRUD lifecycle for templates.
A template's design lives in one of two fields depending on its editor mode:
craftState— the block-based document used by the visual editor, serialized as a JSON string. See the Template Document Reference for the full block model.htmlContent— raw HTML, used wheneditorModeishtml.
List all templates
Fetch all templates for an account:
curl -b cookies.txt \
https://app.templated.email/api/accounts/{slug}/templates{
"templates": [
{
"id": "0d9f1b2a-3c4d-4e5f-8a6b-7c8d9e0f1a2b",
"name": "Product Launch Email",
"description": null,
"status": "draft",
"thumbnailUrl": "https://cdn.templated.email/thumbs/0d9f1b2a.jpg",
"createdAt": "2026-07-01T09:30:00.000Z",
"updatedAt": "2026-07-14T16:02:11.000Z"
}
]
}List responses return summaries only — craftState and htmlContent are omitted. Fetch a single template to get the full document.
Create a template
curl -b cookies.txt -X POST \
https://app.templated.email/api/accounts/{slug}/templates \
-H "Content-Type: application/json" \
-d '{
"name": "Product Launch Email",
"source": "blank",
"editorMode": "html",
"htmlContent": "<html><body><h1>Launching Soon</h1><p>Get ready.</p></body></html>"
}'Request fields
All fields are optional — an empty body creates an "Untitled Template".
| Field | Type | Description |
|---|---|---|
name | string | Template name, max 255 chars. Defaults to "Untitled Template" |
description | string | null | Optional description |
source | enum | Where the template came from: blank, ai, import, or library. Defaults to blank |
editorMode | enum | visual (block editor, uses craftState) or html (raw HTML, uses htmlContent). Defaults to visual |
craftState | string | null | Serialized block document (reference). Mutually exclusive with librarySlug |
htmlContent | string | null | Raw HTML content |
templateSettings | string | null | JSON string of template-level settings |
librarySlug | string | Slug of a pre-built library template — the server fills in the craftState for you. Cannot be combined with craftState |
Response
{
"message": "Template created",
"template": {
"id": "0d9f1b2a-3c4d-4e5f-8a6b-7c8d9e0f1a2b",
"name": "Product Launch Email",
"status": "draft",
"source": "blank",
"editorMode": "html",
"htmlContent": "<html>...</html>",
"craftState": null,
"createdAt": "2026-07-21T10:00:00.000Z",
"updatedAt": "2026-07-21T10:00:00.000Z"
}
}Returns 201 on success, 400 for validation errors (including sending both librarySlug and craftState), and 403 when the account's template capacity is reached.
Get a single template
curl -b cookies.txt \
https://app.templated.email/api/accounts/{slug}/templates/{id}Returns { "template": { ... } } with the full document, including craftState and htmlContent.
Update a template
Updates use PATCH with a partial body — send only the fields you want to change:
curl -b cookies.txt -X PATCH \
https://app.templated.email/api/accounts/{slug}/templates/{id} \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Template Name",
"status": "exported"
}'Updatable fields: name, description, status (draft or exported), editorMode, craftState, htmlContent, templateSettings, and thumbnailUrl (valid URL, max 512 chars). Updating a template you didn't create requires the template:edit:any permission (Admin or Owner role).
Duplicate a template
Create a copy of an existing template:
curl -b cookies.txt -X POST \
https://app.templated.email/api/accounts/{slug}/templates/{id}/duplicateReturns 201 with the new template. The copy's name has (Copy) appended and counts against your plan's template capacity.
Delete a template
curl -b cookies.txt -X DELETE \
https://app.templated.email/api/accounts/{slug}/templates/{id}{ "message": "Template deleted" }Returns 200 on success. This action is irreversible. Deleting a template you didn't create requires the template:delete:any permission.
Import from HTML
To turn existing raw HTML into an editable block document, use the HTML import endpoint — it converts HTML into a craftState you can pass to the create endpoint. Alternatively, store the HTML as-is by creating a template with editorMode: "html" and htmlContent.
Next steps
- Template Document Reference — the full block model for
craftState - Import HTML — convert raw HTML into blocks
- Generate templates with AI instead of authoring by hand
- Test endpoints interactively in the API Reference