usend Docs
API endpoints

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

JSON
{
  "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

NameTypeRequiredDescription
namestringYesA name for your reference.
htmlstringYesThe HTML body, with {{{KEY}}} placeholders.
aliasstringNoLowercase letters, digits, - and _, up to 64 characters. Unique in your organization. Cannot look like an ID.
fromstringNoDefault sender.
subjectstringNoDefault subject. A single line.
reply_tostring | string[]NoDefault reply-to addresses.
textstringNoThe plain-text body.
variablesobject[]NoUp to 50 { "key", "type", "fallback_value" }. type is string or number.
cURL
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" }]
  }'
Response
{ "object": "template", "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f" }

An alias that is already used fails with 409 conflict.

Retrieve a template

GET /templates/{id}

NameTypeRequiredDescription
idstringYesTemplate ID or alias (path).
cURL
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
curl https://api.usend.et/templates \
  -H "Authorization: Bearer us_123456789"
Response
{
  "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
curl -X PATCH https://api.usend.et/templates/welcome \
  -H "Authorization: Bearer us_123456789" \
  -H "Content-Type: application/json" \
  -d '{ "subject": "Welcome aboard, {{{NAME}}}" }'
Response
{ "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
curl -X POST https://api.usend.et/templates/welcome/publish \
  -H "Authorization: Bearer us_123456789"
Response
{ "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
curl -X POST https://api.usend.et/templates/welcome/duplicate \
  -H "Authorization: Bearer us_123456789"
Response
{ "object": "template", "id": "0c7e3a59-8d2b-4f61-a1e4-6b9c2d8f5e37" }

Delete a template

DELETE /templates/{id}

cURL
curl -X DELETE https://api.usend.et/templates/welcome \
  -H "Authorization: Bearer us_123456789"
Response
{ "object": "template", "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", "deleted": true }