Docs

Templates

Create reusable HTML/text email templates with named variables and Resend-style triple-brace substitution. Every create or update appends an immutable version.

POST/templatesCreate a template

name and html are required. variables is up to 50 { key, type: "string" | "number", fallback_value? } declarations — a key can't be one of the reserved names (FIRST_NAME, LAST_NAME, EMAIL, UNSUBSCRIBE_URL, RESEND_UNSUBSCRIBE_URL, contact, this), reserved for contact-derived substitutions. A new template starts as draft — it can't be used to send until POST /templates/:id/publish.

curl -X POST https://api.irisend.com/templates \
  -H "Authorization: Bearer $IRISEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome",
    "from": "[email protected]",
    "subject": "Welcome, {{{CUSTOMER_NAME}}}!",
    "html": "<p>Hi {{{CUSTOMER_NAME}}}, thanks for joining!</p>",
    "variables": [
      {
        "key": "CUSTOMER_NAME",
        "type": "string",
        "fallback_value": "there"
      }
    ]
  }'
ResponseJSON
{
  "object": "template",
  "id": "d58da373-e335-4140-8edd-fe7d680e915b",
  "alias": null,
  "status": "draft",
  "name": "Welcome",
  "subject": "Welcome, {{{CUSTOMER_NAME}}}!",
  "from": "[email protected]",
  "reply_to": null,
  "html": "<p>Hi {{{CUSTOMER_NAME}}}, thanks for joining!</p>",
  "text": null,
  "variables": [{ "key": "CUSTOMER_NAME", "type": "string", "fallback_value": "there" }],
  "version": 1,
  "created_at": "2026-09-25T09:00:12.481Z",
  "updated_at": "2026-09-25T09:00:12.481Z"
}
POST/templates/:id/publishPublish a template

Points published at the current draft version. Required before template: { id } on POST /emails will render it. Once published, status never reverts to draft, even after further unpublished edits.

curl -X POST https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b/publish \
  -H "Authorization: Bearer $IRISEND_API_KEY"
ResponseJSON
{ "object": "template", "id": "d58da373-e335-4140-8edd-fe7d680e915b" }
GET/templatesList templates
curl https://api.irisend.com/templates \
  -H "Authorization: Bearer $IRISEND_API_KEY"
GET/templates/:idRetrieve a template

:id accepts the UUID or the alias you set at creation.

curl https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b \
  -H "Authorization: Bearer $IRISEND_API_KEY"
PATCH/templates/:idUpdate a template

Same fields as create, all optional — an omitted field carries over from the current version unchanged. Appends a new version and returns its number; it does not touch published.

curl -X PATCH https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b \
  -H "Authorization: Bearer $IRISEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<p>Hi {{{CUSTOMER_NAME}}}, thanks for trying Irisend!</p>"
  }'
ResponseJSON
{ "object": "template", "id": "d58da373-e335-4140-8edd-fe7d680e915b", "version": 2 }
POST/templates/:id/duplicateDuplicate a template

Creates a brand-new template (new id, fresh draft status) seeded from the source's current draft content. name/alias are optional.

curl -X POST https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b/duplicate \
  -H "Authorization: Bearer $IRISEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Welcome (copy)" }'
GET/templates/:id/versionsList version history
curl https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b/versions \
  -H "Authorization: Bearer $IRISEND_API_KEY"
ResponseJSON
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "template_version",
      "id": "f0451a59-e134-43b7-b1b3-2c07c27cbdf4",
      "template_id": "d58da373-e335-4140-8edd-fe7d680e915b",
      "version": 2,
      "name": "Welcome",
      "subject": "Welcome, {{{CUSTOMER_NAME}}}!",
      "from": "[email protected]",
      "reply_to": null,
      "html": "<p>Hi {{{CUSTOMER_NAME}}}, thanks for trying Irisend!</p>",
      "text": null,
      "variables": [{ "key": "CUSTOMER_NAME", "type": "string", "fallback_value": "there" }],
      "created_at": "2026-09-25T10:14:02.009Z"
    }
  ]
}
POST/templates/:id/versions/:version_id/rollbackRoll back to a version

History is append-only — a rollback copies the target version's content into a new version rather than rewriting history. Publishing the rolled-back draft is still a separate publish call.

curl -X POST https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b/versions/f0451a59-e134-43b7-b1b3-2c07c27cbdf4/rollback \
  -H "Authorization: Bearer $IRISEND_API_KEY"
ResponseJSON
{ "object": "template", "id": "d58da373-e335-4140-8edd-fe7d680e915b" }
DELETE/templates/:idDelete a template
curl -X DELETE https://api.irisend.com/templates/d58da373-e335-4140-8edd-fe7d680e915b \
  -H "Authorization: Bearer $IRISEND_API_KEY"
ResponseJSON
{ "object": "template", "id": "d58da373-e335-4140-8edd-fe7d680e915b", "deleted": true }