SLSmartletter API

Templates

Versioned transactional templates with variables, compatible with Resend's templates API. Guide: /docs/templates.

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

namerequiredstring
aliasstringUnique in the workspace; use it instead of the id (`/templates/order-receipt`). Letters, digits, `.`, `_`, `-`.
fromstringDefault sender; the send's `from` wins.
subjectstringDefault subject; the send's `subject` wins. May use variables.
reply_tostring | string[]
htmlrequiredstringVariables as `{{{KEY}}}` or `{{KEY}}`; values are HTML-escaped.
textstringGenerated from the HTML when absent; `""` sends HTML only.
variablesobject[]
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

limitinteger1–100, default 20.
afteruuidId of the last item of the previous page (older items).
beforeuuidId 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

namestring
aliasstringUnique in the workspace; use it instead of the id (`/templates/order-receipt`). Letters, digits, `.`, `_`, `-`.
fromstringDefault sender; the send's `from` wins.
subjectstringDefault subject; the send's `subject` wins. May use variables.
reply_tostring | string[]
htmlstringVariables as `{{{KEY}}}` or `{{KEY}}`; values are HTML-escaped.
textstringGenerated from the HTML when absent; `""` sends HTML only.
variablesobject[]
change_notestringSaved 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_iduuidPublish 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

limitinteger1–100, default 20.
afteruuidId of the last item of the previous page (older items).
beforeuuidId 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"
    }
  ]
}