# Coming from Resend

Keep the code and the keys you have. Point the Resend SDK at this API, bring the account over with one request, and move each domain when you are ready.

## Point your code here

This API 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 the code stays as it is.

```ts
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>',
})
```

Or leave the code alone and set the address in the environment:

```bash
RESEND_BASE_URL=https://api.opensend.sh/v1/resend
```

| SDK | Setting | Ends in a slash |
| --- | --- | --- |
| Node.js | `RESEND_BASE_URL`, or `baseUrl` | No |
| Python | `RESEND_API_URL`, or `resend.api_url` | No |
| Go, PHP, Ruby | `RESEND_BASE_URL` | Yes |

Emails, batches, received emails, domains, API keys, templates, broadcasts, segments, contacts with their segments and topics, topics, contact properties, webhooks and suppressions are answered. A call that is not answers `404` with `not_found` and says so, and a field that is not supported is refused by name. Nothing is dropped in silence.

## Keep your keys

Resend shows a key once, so no import can copy one. Enroll the keys your programs hold instead: each is checked with Resend, kept here as a hash and works from then on, with the access it has there.

cURL:

```bash
curl -X POST "$OPENSEND_API_URL/v1/api-keys/enroll" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Billing service",
  "token": "re_full_access_sample_key"
}'
```

TypeScript:

```ts
await opensend.apiKeys.enroll({
  name: 'Billing service',
  token: 're_full_access_sample_key',
})
```

CLI:

```bash
opensend api-keys enroll \
  --name 'Billing service' \
  --token re_full_access_sample_key
```

MCP:

```json
{
  "name": "api_keys_enroll",
  "arguments": {
    "name": "Billing service",
    "token": "re_full_access_sample_key"
  }
}
```

- A key that only sends at Resend only sends here. A key with full access can be narrowed with `access`.
- An enrolled key still works at Resend until you delete it there. The address your program calls decides who sends.
- In the dashboard: API keys, the three dots, Enroll a Resend key.

## Bring the account over

An import reads a Resend account with a key of full access and makes the same things here. Look first: `imports.inspect` counts what is there and says what comes over.

cURL:

```bash
curl -X POST "$OPENSEND_API_URL/v1/imports/inspect" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "apiKey": "re_full_access_sample_key"
}'
```

TypeScript:

```ts
await opensend.imports.inspect({
  apiKey: 're_full_access_sample_key',
})
```

CLI:

```bash
opensend imports inspect --api-key re_full_access_sample_key
```

MCP:

```json
{
  "name": "imports_inspect",
  "arguments": {
    "apiKey": "re_full_access_sample_key"
  }
}
```

Each kind of thing comes back with a count and a note that says how it arrives, or why it stays behind. Then start the import. Name what to bring in `resources`, or leave it out to bring everything. It runs in the background, and `imports.get` shows how far it is.

cURL:

```bash
curl -X POST "$OPENSEND_API_URL/v1/imports" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "apiKey": "re_full_access_sample_key",
  "resources": [
    "templates"
  ]
}'
```

TypeScript:

```ts
await opensend.imports.create({
  apiKey: 're_full_access_sample_key',
  resources: ['templates'],
})
```

CLI:

```bash
opensend imports create \
  --api-key re_full_access_sample_key \
  --resources templates
```

MCP:

```json
{
  "name": "imports_create",
  "arguments": {
    "apiKey": "re_full_access_sample_key",
    "resources": [
      "templates"
    ]
  }
}
```

imports.get:

```json
{
  "object": "import",
  "id": "imp_01",
  "source": "resend",
  "status": "completed",
  "resources": [
    "templates"
  ],
  "step": null,
  "report": [
    {
      "resource": "templates",
      "found": 2,
      "created": 2,
      "reused": 0,
      "skipped": 0,
      "notes": [
        {
          "name": "Password reset",
          "reason": "{{{user.link}}} has no equivalent here and was left as written."
        },
        {
          "name": "Password reset",
          "reason": "The alias password-reset was taken, so it got password-reset-resend. Sends that name the old alias reach the other template."
        }
      ]
    }
  ],
  "error": null,
  "createdAt": "2026-11-27T09:30:00.000Z",
  "finishedAt": "2026-11-27T09:30:00.000Z"
}
```

| At Resend | Here |
| --- | --- |
| Domains | The same domains, waiting for their DNS records |
| Suppression list | The same addresses on the list here |
| Segments | Audiences with the same names |
| Contacts | The same people, once each, subscribed or not, in the audience of each segment |
| Contact properties | The same properties with their types and fallbacks, and what each contact holds |
| Topics | The same topics, and what each contact chose |
| Templates | The same templates, published when they were, under the same alias |
| Broadcasts | The drafts. Sent ones stay at Resend |
| Webhooks | The same endpoints with the signing secret they already check |
| API keys | Their names, so you know which to enroll |

- Nothing arrives in a state that sends: a broadcast comes as a draft, and no contact starts an automation.
- It reads politely. Resend limits a whole team to ten requests a second, so an import takes a few a second and waits when asked to.
- The key is sealed while the import runs and wiped when it ends.
- Run it again whenever you like. What is already here is left alone, what is new is added, and a contact who unsubscribed at Resend since is unsubscribed here.
- The id something had at Resend keeps working in the calls above: a template, a segment, a domain, a contact, a topic.
- What a contact holds and what they chose for a topic take one request for each contact, about four a second, so those two parts of a large account take hours. Leave them out with `resources` to finish sooner, and run the import again later for them.

> Automations and events are counted by `imports.inspect` and are not brought over yet.

## Webhooks that keep verifying

An endpoint brought over by an import, or made through the calls above, is in the `resend` format: it gets the `svix-id`, `svix-timestamp` and `svix-signature` headers and the body Resend sends, signed with the secret it already has. The code that checks it does not change.

```ts
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,
})
```

It is only told about mail sent from here, so it never hears of one email twice. [Webhooks](https://opensend.sh/docs/webhooks) describes the format of this API, which a new endpoint gets unless you ask for `resend`.

## Move a domain

A domain is verified by records in its DNS, and those are different here. That is the one step nobody can take for you.

1. Open the domain here and publish its records beside the ones you have. Your programs still call Resend, so mail goes on leaving from there meanwhile.
2. Verify the domain. It turns `verified` when every record is found.
3. Switch the address your programs use. From then on mail from that domain leaves from here.
4. Take the old records out when you are sure.

[Domains](https://opensend.sh/docs/domains) has every record explained.

## What is different

- Mail you send here leaves from here, never through Resend. A domain sends once its records here are verified.
- A value you pass for a template variable is escaped in HTML here. Resend puts it in as written.
- A contact whose address exists already is refused when you create it again. Add that contact to a segment instead.
- `topic_id` on a single email, an inline image by `content_id`, more than one `reply_to` and `send: true` on a new broadcast are refused with the name of the field. A broadcast takes `topic_id`.
- 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.
