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>"
>}'
1import { Resent } from 'resent';
2
3const resent = new Resent(process.env.RESENT_API_KEY!);
4
5const { data, error } = await resent.emails.send({
6 from: 'Acme <onboarding@yourdomain.com>',
7 to: ['you@example.com'],
8 subject: 'hello world',
9 html: '<p>it works!</p>',
10});

A successful response returns an email id:

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

Next steps