Templates

Create reusable email templates with {{variable}} placeholders, then send with POST /emails using template: { id, variables }.

Base URL: https://api.supersendtx.com


Authentication

Authorization: Bearer stx_…

Requires a full-scope API key (or dashboard session). Sending-scoped keys cannot manage templates.


Model

Field Notes
name Required; unique per account
alias Optional unique handle (not empty, not starting with stx_)
status draft (default) or published
subject / html / text Support {{var}} placeholders
variables Optional hint array of variable names
warnings Non-blocking deliverability hints for html (e.g. SVG logos)

Placeholders in HTML bodies are HTML-escaped when interpolated. Subject and text are not.

Images in HTML

Use PNG or JPG logos at public https:// URLs in <img src="…"> tags. Many inboxes (including Gmail) do not render SVG images. SuperSend TX returns advisory warnings on template create/get/list when HTML may not render reliably — sends are not blocked.

<img src="https://yourdomain.com/assets/logo.png" alt="Your product" width="36" height="36" />

List

GET /templates

Query: limit, cursor, optional status=draft|published.

{
  "data": [
    {
      "id": "…",
      "name": "Welcome",
      "alias": "welcome",
      "status": "published",
      "subject": "Hello {{name}}",
      "html": "<p>Hi {{name}}</p>",
      "text": "Hi {{name}}",
      "variables": ["name"],
      "published_at": "2026-07-26T12:00:00.000Z",
      "created_at": "2026-07-26T11:00:00.000Z",
      "updated_at": "2026-07-26T12:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Create

POST /templates201

{
  "name": "Welcome",
  "alias": "welcome",
  "subject": "Hello {{name}}",
  "html": "<p>Hi {{name}}</p>",
  "text": "Hi {{name}}",
  "variables": ["name"]
}

Creates a draft. Publish before sending.


Retrieve / update / delete

  • GET /templates/{id} — UUID or alias
  • PATCH /templates/{id} — update fields
  • DELETE /templates/{id}

Publish / duplicate

POST /templates/{id}

{ "action": "publish" }
{ "action": "duplicate", "name": "Welcome (copy)" }

Duplicate creates a new draft (alias cleared). name is optional (defaults to … (copy)).


Send with a template

POST /emails

{
  "from": "you@yourdomain.com",
  "to": "user@example.com",
  "template": {
    "id": "welcome",
    "variables": { "name": "Ada" }
  }
}

template is mutually exclusive with html / text. Subject comes from the template unless you pass subject to override. Only published templates can be used.


SDK

import { SuperSendTX } from 'supersendtx'

const client = new SuperSendTX(process.env.SUPERSENDTX_API_KEY!)

const { template } = await client.templates.create({
  name: 'Welcome',
  alias: 'welcome',
  subject: 'Hello {{name}}',
  html: '<p>Hi {{name}}</p>',
})
await client.templates.publish(template.id)

await client.emails.send({
  from: 'you@yourdomain.com',
  to: 'user@example.com',
  template: { id: 'welcome', variables: { name: 'Ada' } },
})

React Email (optional peer)

Install @react-email/render (and react) to pass a React element:

npm install @react-email/render react
await client.emails.send({
  from: 'you@yourdomain.com',
  to: 'user@example.com',
  subject: 'Hello',
  react: EmailComponent({ name: 'Ada' }),
})

The SDK compiles react to HTML before POST /emails. Mutually exclusive with html / text / template.


CLI

supersendtx templates list
supersendtx templates create --name Welcome --subject "Hi {{name}}" --html "<p>Hi {{name}}</p>" --alias welcome

OpenAPI

openapi/supersendtx.yaml