Email Templates API Guide & Variable Substitution Syntax
Store an email once and send it by id. Templates hold a subject, html, and an optional plain-text alternative; {{TOKEN}} merge tags are replaced by the variables you pass at send time. A variable without a value stays visible in the rendered email instead of becoming blank copy. Every new workspace starts with three editable starters (welcome, password reset, receipt).
For the product overview, read the email templates guide.
Create a template
POST/api/v1/templates
const { template } = await notice.templates.create({
name: "Welcome",
subject: "Welcome to {{PRODUCT_NAME}}, {{FIRST_NAME}}",
html: "<p>Hi {{FIRST_NAME}}, your account is live.</p>",
});| Field | Type | Description |
|---|---|---|
namerequired | string | Unique per workspace. Used in the dashboard. |
subjectrequired | string | May contain {{TOKEN}} merge tags. |
html | string | HTML body, up to 1MB. Required unless you provide reactSource. |
text | string | null | Optional plain-text alternative. |
contentMode | "html" | "react" | Set react when you provide React Email source. |
reactSource | string | null | One static React Email component, up to 200KB. |
Paste React Email
Select React Email in the dashboard editor and paste one component. NoticeAPI parses static JSX and an allowlisted React Email component set. It does not run pasted JavaScript, load local modules, or make network requests. NoticeAPI stores the source and the rendered HTML and text.
import { Button, Html, Text } from "react-email";
export default function Email() {
return (
<Html>
<Text>{"Hi {{FIRST_NAME}}"}</Text>
<Button href="{{ACTION_URL}}">Open the app</Button>
</Html>
);
}Render data fetching, loops, hooks, and custom runtime logic in your application with the NoticeAPI React helper. Send or store the finished HTML when the template needs those features.
Send with a template
POST/api/v1/email/send
Pass templateId instead of content. Anything you do provide (subject, html, text) overrides that part of the template. Works in batch sends too; a batch that reuses one template only loads it once.
await notice.emails.send({
from: "Acme <hello@acme.com>",
to: "user@example.com",
templateId: template.id,
variables: { PRODUCT_NAME: "Acme", FIRST_NAME: "Sam" },
});| Field | Type | Description |
|---|---|---|
templateId | string | Id of a stored template. |
variables | object | Up to 50 string values for {{TOKEN}} tags. Also works on direct sends without a template. |
Manage templates
GET/api/v1/templates
PATCH/api/v1/templates/:id
DELETE/api/v1/templates/:id
The dashboard's template editor includes a live preview with sample variables; edit on the left, see the rendered email on the right.