Templates & variables
Templates are the platform's core contract: HTML lives here, in one place, and applications only ever reference a slug. Each project manages its own set.
Anatomy of a template
| Field | Meaning |
|---|---|
name | Human label shown in the dashboard. |
slug | The identifier applications send - kebab-case, unique per project (e.g. welcome-email). |
subject | Email subject line. May contain variables. |
html | The HTML body. May contain variables. |
text | Optional plain-text alternative. |
variables | Declared variable names, used for preview forms and documentation. |
enabled | Disabled templates reject sends with TEMPLATE_DISABLED. |
Variables
Use {{name}}anywhere in the subject, HTML, or text. At send time the platform replaces each occurrence with the value from the request's variables object:
Subject: {{amount}} charged at {{merchant}}
<p>Hi {{name}},</p>
<p>Your card was charged <strong>{{amount}}</strong> at {{merchant}}.</p>await mail.send({
template: "transaction-alert",
to: "m.tanaka@example.com",
variables: { name: "Mia", amount: "$42.10", merchant: "Blue Bottle" },
});Unknown variables are left as-is in the output - a visible {{placeholder}} in a delivered email is a bug you can see, not a silent blank.
Preview and test send
The template editor renders a live preview against sample variables. Test send delivers a real email through the configured provider and writes a log row, so you can verify the whole pipeline before an application ever calls it.
Lifecycle operations
- Duplicate - copies a template with a
-copyslug; useful for iterating safely. - Disable - stops sends without deleting history.
- Delete - permanent; past logs keep the slug for reference.
Editing templates requires the OWNER or DEVELOPER role on the project - see API keys & access.