Skip to main content
Email templates allow you to create reusable email designs with dynamic variables. This guide covers the complete template workflow.

Create a Template

1

Create a basic template

Start by creating a simple template without variables:
2

Add dynamic variables

Create a template with variables for personalization:
All variables used in your HTML (e.g., {{{NAME}}}, {{{AGE}}}) must be declared in the Variables array. Otherwise, the API will return an error:Variable 'NAME' is used in the template but not defined in the variables list
3

Create with all options

Use all available template fields:

Variable Types

Resend supports two variable types:

Update a Template

Modify an existing template:

Publish a Template

Templates must be published before they can be used to send emails:
Only published templates can be used to send emails. Draft templates will result in an error.

Send Email with Template

Once published, use your template to send emails:

Retrieve Template Details

Get information about a template:

List Templates

Retrieve all templates with pagination:

Duplicate a Template

Create a copy of an existing template:

Delete a Template

Permanently remove a template:
Deleting a template is permanent and cannot be undone. Any emails currently using this template will fail.

Complete Example

Here’s a complete workflow from examples/send_email_with_template.go:
examples/send_email_with_template.go

Next Steps

Basic Usage

Learn the fundamentals of sending emails

Error Handling

Handle rate limits and validation errors

Templates API

View complete Templates API reference

Batch Emails

Send multiple emails efficiently