Tags are unique identifiers you can add to your emails. They help associate emails with your application. They are passed in key/value pairs. After the email is sent, the tag is included in the webhook event. Tags can include ASCII letters, numbers, underscores, or dashes.

Some examples of when to use a tag:

  • Associate the email a “customer ID” from your application
  • Add a label from your database like “free” or “enterprise”
  • Note the category of email sent, like “welcome” or “password reset”

Here’s how you can add custom tags to your emails:

import { Resend } from 'resend';

const resend = new Resend('re_123456789');

await resend.emails.send({
  from: 'Acme <onboarding@resend.dev>',
  to: ['delivered@resend.dev'],
  subject: 'hello world',
  html: '<p>it works!</p>',
  tags: [
    {
      name: 'category',
      value: 'confirm_email',
    },
  ],
});