Skip to content

Grow

Templates

Reusable content with variables, drafts and published versions.

Templates keep your email content in one place, with variables your app fills in. Edit them in Templates (visual, React or HTML) or with the Templates API, then send them by id or alias from the Emails API, broadcasts and automations.

Drafts and versions

  • Every change edits the template's draft. Sends always use the published version, so you can work on a draft safely.
  • Publishing (POST /templates/{id}/publish) saves the draft as a new version and makes it live.
  • A template that was never published cannot be sent: the API answers 422.

Variables

Variable syntax
SyntaxIn HTMLIn subject and text
{{name}}Inserted with HTML escapedInserted as is
{{{name}}}Inserted as is, for links and markup you trustInserted as is
  • Declare variables with a key, a type (string or number) and an optional fallback. Variables used in the content but not declared are added as strings.
  • A variable with no value uses its fallback. With neither, the send fails with 422 and lists the missing names.
  • Aliases are lowercase letters, digits and dashes, such as welcome-email, and unique in your team.

Send a template

Pass template instead of html and text. The template's sender, reply-to and subject apply unless the request sets its own.

curl -X POST https://isent.dev/api/v1/emails \
  -H "Authorization: Bearer $ISENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "maya@studio.design",
    "template": {
      "id": "welcome-email",
      "variables": {
        "first_name": "Maya",
        "plan": "Pro"
      }
    }
  }'