Templates
Versioned transactional templates with variables, compatible with Resend's templates API. Guide: /docs/templates.
- POST /templates — Create a template
- GET /templates — List templates
- GET /templates/{id} — Retrieve a template
- PATCH /templates/{id} — Update a template
- DELETE /templates/{id} — Delete a template
- POST /templates/{id}/publish — Publish a template
- POST /templates/{id}/duplicate — Duplicate a template
- GET /templates/{id}/versions — List template versions
post/templates— Create a template
Same body and answer as Resend's POST /templates (resend.templates.create). The template starts as a draft (version 1): publish it before sending. Every tag must be a declared variable.
Keys: full_access
Body
| namerequired | string | |
| alias | string | Unique in the workspace; use it instead of the id (`/templates/order-receipt`). Letters, digits, `.`, `_`, `-`. |
| from | string | Default sender; the send's `from` wins. |
| subject | string | Default subject; the send's `subject` wins. May use variables. |
| reply_to | string | string[] | |
| htmlrequired | string | Variables as `{{{KEY}}}` or `{{KEY}}`; values are HTML-escaped. |
| text | string | Generated from the HTML when absent; `""` sends HTML only. |
| variables | object[] |
curl -X POST https://api.smartletter.ai/templates \
-H "Authorization: Bearer $SMARTLETTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Order receipt","alias":"order-receipt","from":"Acme <[email protected]>","subject":"Your order {{{ORDER_NUMBER}}}","html":"<p>Thanks! Order {{{ORDER_NUMBER}}} is on its way.</p>","variables":[{"key":"ORDER_NUMBER","type":"string"}]}'Response 201
{
"object": "template",
"id": "5b7d9f10-0000-4000-8000-000000000006"
}get/templates— List templates
Newest first, like Resend. Archived templates are included (archived: true).
Keys: full_access
Query parameters
| limit | integer | 1–100, default 20. |
| after | uuid | Id of the last item of the previous page (older items). |
| before | uuid | Id of the first item of the previous page (newer items). |
curl -X GET https://api.smartletter.ai/templates \
-H "Authorization: Bearer $SMARTLETTER_API_KEY"Response 200
{
"object": "list",
"has_more": false,
"data": [
{
"id": "5b7d9f10-0000-4000-8000-000000000006",
"name": "Order receipt",
"alias": "order-receipt",
"status": "published",
"published_at": "2026-10-18T09:30:00.000Z",
"archived": false,
"created_at": "2026-10-18T09:00:00.000Z",
"updated_at": "2026-10-18T09:30:00.000Z"
}
]
}get/templates/{id}— Retrieve a template
By id or alias. Content fields are the latest version's (the draft); published_version_id is what sends use.
Keys: full_access
curl -X GET https://api.smartletter.ai/templates/<id> \
-H "Authorization: Bearer $SMARTLETTER_API_KEY"Response 200
{
"object": "template",
"id": "5b7d9f10-0000-4000-8000-000000000006",
"current_version_id": "6c8e0a21-0000-4000-8000-000000000007",
"current_version_number": 3,
"published_version_id": "6c8e0a21-0000-4000-8000-000000000007",
"published_version_number": 3,
"alias": "order-receipt",
"name": "Order receipt",
"created_at": "2026-10-18T09:00:00.000Z",
"updated_at": "2026-10-18T09:30:00.000Z",
"status": "published",
"published_at": "2026-10-18T09:30:00.000Z",
"archived": false,
"from": "Acme <[email protected]>",
"subject": "Your order {{{ORDER_NUMBER}}}",
"reply_to": null,
"html": "<p>Thanks! Order {{{ORDER_NUMBER}}} is on its way.</p>",
"text": null,
"variables": [
{
"id": "order_number",
"key": "ORDER_NUMBER",
"type": "string",
"fallback_value": null,
"required": true,
"created_at": "2026-10-18T09:00:00.000Z",
"updated_at": "2026-10-18T09:00:00.000Z"
}
],
"has_unpublished_versions": false
}patch/templates/{id}— Update a template
By id or alias. A change of content (subject, from, reply_to, html, text, variables) saves a new version; the published one keeps sending until you publish again. name and alias change in place.
Keys: full_access
Body
| name | string | |
| alias | string | Unique in the workspace; use it instead of the id (`/templates/order-receipt`). Letters, digits, `.`, `_`, `-`. |
| from | string | Default sender; the send's `from` wins. |
| subject | string | Default subject; the send's `subject` wins. May use variables. |
| reply_to | string | string[] | |
| html | string | Variables as `{{{KEY}}}` or `{{KEY}}`; values are HTML-escaped. |
| text | string | Generated from the HTML when absent; `""` sends HTML only. |
| variables | object[] | |
| change_note | string | Saved with the new version (history). |
curl -X PATCH https://api.smartletter.ai/templates/<id> \
-H "Authorization: Bearer $SMARTLETTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"subject":"Order {{{ORDER_NUMBER}}} confirmed","change_note":"Clearer subject"}'Response 200
{
"object": "template",
"id": "5b7d9f10-0000-4000-8000-000000000006"
}delete/templates/{id}— Delete a template
By id or alias, with its versions. Emails already sent keep their content.
Keys: full_access
curl -X DELETE https://api.smartletter.ai/templates/<id> \
-H "Authorization: Bearer $SMARTLETTER_API_KEY"Response 200
{
"object": "template",
"id": "5b7d9f10-0000-4000-8000-000000000006",
"deleted": true
}post/templates/{id}/publish— Publish a template
Publishes the latest version (resend.templates.publish), or version_id to roll back to an older one.
Keys: full_access
Body
| version_id | uuid | Publish this version instead of the latest (rollback). |
curl -X POST https://api.smartletter.ai/templates/<id>/publish \
-H "Authorization: Bearer $SMARTLETTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Response 200
{
"object": "template",
"id": "5b7d9f10-0000-4000-8000-000000000006"
}post/templates/{id}/duplicate— Duplicate a template
Copies the latest version into a new draft template, without alias (resend.templates.duplicate).
Keys: full_access
curl -X POST https://api.smartletter.ai/templates/<id>/duplicate \
-H "Authorization: Bearer $SMARTLETTER_API_KEY"Response 200
{
"object": "template",
"id": "5b7d9f10-0000-4000-8000-000000000006"
}get/templates/{id}/versions— List template versions
Version history, newest first. Versions never change; publish one with POST /templates/{id}/publish.
Keys: full_access
Query parameters
| limit | integer | 1–100, default 20. |
| after | uuid | Id of the last item of the previous page (older items). |
| before | uuid | Id of the first item of the previous page (newer items). |
curl -X GET https://api.smartletter.ai/templates/<id>/versions \
-H "Authorization: Bearer $SMARTLETTER_API_KEY"Response 200
{
"object": "list",
"has_more": false,
"data": [
{
"object": "template_version",
"id": "6c8e0a21-0000-4000-8000-000000000007",
"number": 3,
"subject": "Your order {{{ORDER_NUMBER}}}",
"source": "html",
"change_note": "Shorter subject",
"created_via": "api",
"published": true,
"created_at": "2026-10-18T09:30:00.000Z"
}
]
}