Skip to Content
sesameSend

Templates

Versioned email templates with typed variables.

A template stores a from, subject, html, text and a list of variables. It has versions: edits go to a draft, and publishing makes the current version the one that sends.

curl -X POST "$SESAMESEND_URL/templates" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "welcome",
    "from": "Acme <hello@yourdomain.com>",
    "subject": "Welcome, {{{NAME}}}",
    "html": "<p>Hi {{{NAME|there}}}</p>",
    "variables": [{ "key": "NAME", "type": "string", "fallback_value": "there" }]
  }'

curl -X POST "$SESAMESEND_URL/templates/<id>/publish" -H "Authorization: Bearer $OPENSEND_API_KEY"

Variables

  • Write {{{KEY}}} for a raw value, {{KEY}} for an HTML-escaped one, and {{{KEY|fallback}}} for a fallback when the value is missing or empty.
  • Types are string, number, boolean, object and list. A fallback must match the type.
  • Keys use letters, numbers and underscores, up to 50 characters, and at most 50 variables per template.
  • FIRST_NAME, LAST_NAME, EMAIL, RESEND_UNSUBSCRIBE_URL, UNSUBSCRIBE_URL, CONTACT and THIS are reserved. Broadcasts and automations fill them in.

Send with a template

Publish first. An unpublished template returns 422 validation_error. Then pass the template instead of html and text:

{ "from": "Acme <hello@yourdomain.com>", "to": ["delivered@resend.dev"], "template": { "id": "<id or alias>", "variables": { "NAME": "Ada" } } }

alias is a handle you set (letters, numbers, underscores, dashes, up to 100). GET /templates/{id} shows the current draft, and has_unpublished_versions tells you whether it differs from what sends. POST /templates/{id}/duplicate copies one.