# Resend (/docs/v/0.4.0/adapters/resend)



The Resend adapter calls the Resend Email API directly. It does not add a runtime dependency.

<ProviderBadge adapter="resend" />

## Before live sends [#before-live-sends]

Create a Resend API key and verify the sender domain or sender address you plan to use in `from`. A dry run can validate the Email SDK message shape, but only a live send from your target environment proves the Resend account, sender, and recipient policy are ready.

```ts
import { createEmailClient } from "@opencoredev/email-sdk";
import { resend } from "@opencoredev/email-sdk/resend";

const email = createEmailClient({
  adapters: [resend({ apiKey: process.env.RESEND_API_KEY! })],
});
```

## Send [#send]

```ts
await email.send(
  {
    from: "Acme <hello@acme.com>",
    to: "user@example.com",
    subject: "Welcome",
    html: "<p>Your workspace is ready.</p>",
    tags: [{ name: "type", value: "welcome" }],
  },
  {
    idempotencyKey: "welcome:user_123",
  },
);
```

## Options [#options]

| Option    | Type                     | Required | Notes                                 |
| --------- | ------------------------ | -------- | ------------------------------------- |
| `apiKey`  | `string`                 | Yes      | Resend API key.                       |
| `baseUrl` | `string`                 | No       | Defaults to `https://api.resend.com`. |
| `fetch`   | `typeof fetch`           | No       | Useful for tests or custom runtimes.  |
| `headers` | `Record<string, string>` | No       | Extra request headers.                |

## Response [#response]

The adapter returns the Resend `id` as `id` and `messageId`.

## CLI smoke test [#cli-smoke-test]

```bash
RESEND_API_KEY="re_..." npx --yes --package @opencoredev/email-sdk email-sdk send \
  --adapter resend \
  --from "Acme <hello@acme.com>" \
  --to user@example.com \
  --subject "Resend test" \
  --text "It works"
```
