Templates
Create, update, publish, duplicate and delete templates.
Every endpoint that takes {id} accepts the template's ID or its alias. See Templates for a guide.
The template object
{
"object": "template",
"id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f",
"name": "Welcome",
"alias": "welcome",
"status": "published",
"published_at": "2026-10-11T08:05:00.000Z",
"has_unpublished_versions": false,
"created_at": "2026-10-11T08:00:00.000Z",
"updated_at": "2026-10-11T08:04:00.000Z",
"from": "Acme <[email protected]>",
"subject": "Welcome, {{{NAME}}}",
"reply_to": [],
"html": "<p>Hi {{{NAME}}}</p>",
"text": "Hi {{{NAME}}}",
"variables": [
{ "key": "NAME", "type": "string", "fallback_value": "there" }
]
}The content fields (from, subject, reply_to, html, text, variables) are the draft. Sends use the version saved by the last publish.
Create a template
POST /templates
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A name for your reference. |
html | string | Yes | The HTML body, with {{{KEY}}} placeholders. |
alias | string | No | Lowercase letters, digits, - and _, up to 64 characters. Unique in your organization. Cannot look like an ID. |
from | string | No | Default sender. |
subject | string | No | Default subject. A single line. |
reply_to | string | string[] | No | Default reply-to addresses. |
text | string | No | The plain-text body. |
variables | object[] | No | Up to 50 { "key", "type", "fallback_value" }. type is string or number. |
curl -X POST https://api.usend.et/templates \
-H "Authorization: Bearer us_123456789" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome",
"alias": "welcome",
"from": "Acme <[email protected]>",
"subject": "Welcome, {{{NAME}}}",
"html": "<p>Hi {{{NAME}}}</p>",
"variables": [{ "key": "NAME", "type": "string", "fallback_value": "there" }]
}'{ "object": "template", "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f" }An alias that is already used fails with 409 conflict.
Retrieve a template
GET /templates/{id}
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Template ID or alias (path). |
curl https://api.usend.et/templates/welcome \
-H "Authorization: Bearer us_123456789"Returns the template object.
List templates
GET /templates
Paginated with limit, after and before. Items omit the content fields.
curl https://api.usend.et/templates \
-H "Authorization: Bearer us_123456789"{
"object": "list",
"data": [
{
"object": "template",
"id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f",
"name": "Welcome",
"alias": "welcome",
"status": "published",
"published_at": "2026-10-11T08:05:00.000Z",
"created_at": "2026-10-11T08:00:00.000Z",
"updated_at": "2026-10-11T08:04:00.000Z"
}
],
"has_more": false
}Update a template
PATCH /templates/{id}
Updates the draft. Takes the same fields as create, all optional. Fields you leave out are unchanged. Send "alias": "" to remove the alias. Published sends are not affected until you publish again.
curl -X PATCH https://api.usend.et/templates/welcome \
-H "Authorization: Bearer us_123456789" \
-H "Content-Type: application/json" \
-d '{ "subject": "Welcome aboard, {{{NAME}}}" }'{ "object": "template", "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f" }Publish a template
POST /templates/{id}/publish
Makes the current draft the version used for sending. Fails with 422 when the template has no HTML or uses a placeholder that is not declared in variables.
curl -X POST https://api.usend.et/templates/welcome/publish \
-H "Authorization: Bearer us_123456789"{ "object": "template", "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f" }Duplicate a template
POST /templates/{id}/duplicate
Creates a new, unpublished copy named <name> (copy), without an alias.
curl -X POST https://api.usend.et/templates/welcome/duplicate \
-H "Authorization: Bearer us_123456789"{ "object": "template", "id": "0c7e3a59-8d2b-4f61-a1e4-6b9c2d8f5e37" }Delete a template
DELETE /templates/{id}
curl -X DELETE https://api.usend.et/templates/welcome \
-H "Authorization: Bearer us_123456789"{ "object": "template", "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", "deleted": true }