Messaging APISend transactional email

Send transactional email

Send reliable transactional mail with the Resent Email API

Use POST /emails to send transactional messages through Resent.

Prerequisites

  1. Create an API key
  2. Verify a sending domain

Send an email

curl -X POST 'https://api.resent.com/emails' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'User-Agent: my-app/1.0' \
-d '{
"from": "Acme <onboarding@yourdomain.com>",
"to": ["you@example.com"],
"subject": "hello world",
"html": "<p>it works!</p>"
}'
import { Resent } from 'resent';
const resent = new Resent(process.env.RESENT_API_KEY!);
const { data, error } = await resent.emails.send({
from: 'Acme <onboarding@yourdomain.com>',
to: ['you@example.com'],
subject: 'hello world',
html: '<p>it works!</p>',
});

A successful response returns an email id:

{
"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}

Next steps