Skip to main content
Templates are currently in private beta and only available to a limited number of users. APIs might change before GA.To use the methods on this page, you must upgrade your Resend SDK:
npm install resend@6.3.0-canary.4
Get in touch if you’re interested in testing this feature.
Templates in production require a workflow that lets you make changes safely without disrupting active emails.

Draft vs Published

Templates start in a draft state and must be published before they can be used to send emails. This separation allows you to:
  • Test templates thoroughly before going live
  • Make changes without affecting active emails
  • Maintain version control over your email content
Once you publish a template, the most recent draft becomes the published version. This version will be used to send emails until you publish again.
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

// Create a template in draft state
const template = await resend.templates.create({
  name: 'welcome-email',
  html: '<h1>Welcome {{{FIRST_NAME}}}!</h1>',
  variables: [
    {
      key: 'FIRST_NAME',
      type: 'string',
      fallbackValue: 'there',
    },
  ],
});

// Publish the template when ready for production
await resend.templates.publish(template.id);
After you publish a template, you can freely work on it through the editor or via the API without affecting the published version. This allows you to test and validate new edits before sending them to users.

Version History

Each template contains a version history that helps you track changes your team has made over time. You can view the version history by clicking the three dots in the top right corner of the template editor and selecting Version History. Through the version history, you can preview each version, who made them, and when they were made. You can also revert to a previous version if needed. Reverting creates a new draft based on the selected version’s content, without affecting the published template.

Iterating on a template

You can work on a new draft version of your published template, update the design and messaging, then test it thoroughly before publishing it again. Your email sending will continue to use the current published version until you’re ready to make the switch, without the need to create a new separate template or risk leaking your new logo. This behavior is also useful to avoid breaking changes when you need to edit a template that’s in production. Add or remove variables, update the design, and more without affecting your existing emails or raising validation errors.