Docs
Templates

Create Template

Create a draft template. Variables use {{{NAME}}}.

POST/templates

Body Parameters

namestringrequired
Internal name.
aliasstring
Unique name you can send by instead of the ID.
fromstring
Default sender.
subjectstring
Default subject (can use variables).
htmlstringrequired
HTML with {{{VARIABLES}}}.
textstring
Plain-text version.
variables{ key, type, fallback_value? }[]
Declared variables. Without a fallback a variable is required when sending.
import { Resend } from 'resend';

const client = new Resend('pw_xxxxxxxxx');

const { data, error } = await client.templates.create({
  name: 'Welcome',
  alias: 'welcome',
  from: 'Acme <hello@yourdomain.com>',
  subject: 'Welcome, {{{NAME}}}',
  html: '<p>Hi {{{NAME}}}</p>',
  variables: [{ key: 'NAME', type: 'string', fallbackValue: 'there' }],
});
Try itPOST/templates

No key yet? Create one in the dashboard.