Skip to main content
Templates in production require a workflow that lets you make changes safely without disrupting active emails. As you build your Template, your entire team can collaborate on the content and design in real-time with full version history.

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, this published version will be used to send emails until you publish again. You can continue to work on a template in draft state without affecting the published version and the editor will automaticalyl save your progress.
// Create template
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

await resend.templates.create({
  name: 'order-confirmation',
  from: 'Resend Store <store@resend.com>',
  subject: 'Thanks for your order!',
  html: "<p>Name: {{{PRODUCT}}}</p><p>Total: {{{PRICE}}}</p>",
  variables: [
    {
      key: 'PRODUCT',
      type: 'string',
      fallbackValue: 'item'
    },
    {
      key: 'PRICE',
      type: 'number',
      fallbackValue: 20
    }
  ]
});

// Publish template
await resend.templates.publish('template_id');

// Or create and publish a template in one step
await resend.templates.create({ ... }).publish();
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

As you work on a Template, your changes are saved as a draft, although you can also manually save drafts by pressing Cmd + S (Mac) or Ctrl + S (Windows). Only after publishing again will the changes be reflected in emails using the Template. 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.