Explainers

Resend, but open source: what works today

An open source Resend has to do more than send. Here is the list we worked from, and where OpenSend stands on each point, call by call.

4 min read

In short

  • Sending is the small part of an open source Resend. The rest is the API, the SDK behaviour, the webhooks, the marketing side and a dashboard, with the code published.
  • OpenSend answers the calls of the Resend API under /v1/resend, with the same paths, the same fields and the same errors.
  • The official Resend SDKs take another address, so an app changes one setting and keeps its code.
  • A call that is not answered says so by name. Nothing is dropped in silence.
  • It is an independent project, not a copy and not affiliated with Resend. Six things behave differently, and they are listed below.

What an open source Resend has to do

People ask for "Resend, but open source" and mean different things by it. This is the list we worked from. Miss one of these and a team still has to rewrite something to move.

  • The same API: the paths, the fields and the errors a program already handles.
  • The SDKs people already installed keep working, with nothing but a new address.
  • The keys programs already hold keep working.
  • Webhooks arrive in the format an endpoint already verifies.
  • The marketing side comes along: broadcasts, segments, contacts and topics.
  • There is a dashboard, because someone has to look at a bounce at some point.
  • The code is published, and it runs on a server of your own.

The same calls

OpenSend answers the calls of the Resend API under /v1/resend. The official Resend SDK is told one thing, the address, and the rest of the code stays as it is:

TypeScript
import { Resend } from 'resend' const resend = new Resend(process.env.RESEND_API_KEY, {  baseUrl: 'https://api.opensend.sh/v1/resend',}) await resend.emails.send({  from: 'Acme <hello@mail.example.com>',  to: 'ada@example.com',  subject: 'Your receipt',  html: '<p>Thanks for your order.</p>',})
Area
Sending
Calls
Emails, batches and templates
Area
Receiving
Calls
Received emails
Area
Marketing
Calls
Broadcasts, segments, contacts, topics and contact properties
Area
Operations
Calls
Domains, API keys, webhooks and suppressions

A call that is not answered gets 404 with not_found and says so. A field that is not supported is refused by name. The docs list both, so there is no guessing.

The keys you already have

Resend shows a key once, so nothing can copy one. A key is enrolled instead: it is checked with Resend, kept here as a hash, and works from then on with the access it has there.

  • A key that only sends at Resend only sends here.
  • An enrolled key still works at Resend until you delete it there. The address a program calls decides who sends.

Webhooks that keep verifying

An endpoint that came over gets the svix-id, svix-timestamp and svix-signature headers and the body Resend sends, signed with the secret it already has. So the code that checks a webhook does not change either:

TypeScript
const event = resend.webhooks.verify({  payload: await request.text(),  headers: {    id: request.headers.get('svix-id'),    timestamp: request.headers.get('svix-timestamp'),    signature: request.headers.get('svix-signature'),  },  webhookSecret: process.env.RESEND_WEBHOOK_SECRET,})

An endpoint is only told about mail sent from here, so it never hears of one email twice. A new endpoint gets the format of this API unless you ask for the other.

What it adds

Being compatible is the floor. These are the parts that are our own.

What is different, on purpose

Six things behave differently. Better to read them here than to meet them in production.

  • Mail you send here leaves from here, through Nextmail, and never through Resend. A domain sends once its records here are verified.
  • A value you pass for a template variable is escaped in HTML. Resend puts it in as written.
  • Creating a contact whose address exists already is refused. Add that contact to a segment instead.
  • A topic on a single email, an inline image by content id, more than one reply address and sending a new broadcast in the same call are each refused by the name of the field.
  • A webhook is never read again with its secret. Make a new one to get a new secret.
  • Opens, clicks and the history of mail sent before the move stay at Resend.

What it is not

OpenSend is an independent project. It is not made by Resend, not affiliated with it, and Resend is a trademark of its owner. We answer its API because that is the kindest thing to do for a team with working code.

If you are happy at Resend, stay. If you want to move, the migration guide takes you through it step by step.

More from the blog

Send your first email in a few minutes.

Create a key and send, or clone the repository and run it yourself.