Skip to content
DocumentationAPI referenceBuild something worth sending.

Guides

Migrate from Resend

Migration path for existing resend code. New projects should use @sendpanda/sdk. RESEND_BASE_URL keeps emails.send and batch.send.

This is a migration path for code that already calls emails.send or batch.send on the official resend npm package. A new project should install @sendpanda/sdk and follow the quickstart instead of depending on the resend package.

For an existing integration, the resend package reads RESEND_BASE_URL and posts to /emails and /emails/batch on that origin. SendPanda accepts those two requests when the bearer token is a SendPanda API key. Tested with resend SDK versions 6.13.0–6.39.0, which read RESEND_BASE_URL when the client is constructed. A weekly check also installs the latest resend release. Extra request fields are ignored. A feature SendPanda cannot honour, such as scheduled_at, returns an error and is not sent.

1. Change one environment variable

RESEND_BASE_URL=https://api.sendpanda.email
SENDPANDA_API_KEY=sp_live_your_key
import { Resend } from "resend";

const resend = new Resend(process.env.SENDPANDA_API_KEY);
const { data, error } = await resend.emails.send({
  from: "Your app <hello@your-verified-domain.com>",
  to: ["person@example.com"],
  subject: "Welcome",
  html: "<p>Welcome</p>",
});

Do not pass a Resend key. from must be on a domain you verified in the same SendPanda project. A success response is { id } with HTTP 200, which is the shape the resend package reads. SendPanda's own POST /v1/emails is separate: it returns HTTP 202 and { id, status }, and queued means accepted, not delivered.

2. Fields that map

  • from, including a display name. to, cc and bcc as one address or an array of plain addresses.
  • subject, html, text, and one replyTo.
  • tags of { name, value }. Names are 1–64 characters and values 1–128, using letters, numbers, underscores and dashes. sendpanda_id is reserved.
  • Attachments as base64 content plus filename and an optional content type. Up to 10 files, 10 MB in total. Program and script files are rejected.
  • template: { id, variables } when id is a template published in SendPanda. A Resend template id is not a SendPanda template id.
  • In-Reply-To and References headers, stored as in_reply_to and references. An OTP-Token header, one Structured Fields item "<code>"; origin="<origin>", stored as otp_token.
  • Idempotency-Key. Keys of 1–128 printable characters are stored as sent. A longer key, up to 256 characters, is stored as its SHA-256. On a batch, each message uses key#index.

3. Fields that return an error

The request is rejected and nothing is accepted when it includes scheduledAt, a Resend topic, a header other than In-Reply-To, References, or OTP-Token, an attachment path URL, an inline contentId, more than one reply-to address, or a display name on to, cc or bcc. The error body is { name, message, statusCode }, which is what the resend package returns as error. The HTTP status is SendPanda's, for example 422 for an invalid field and 401 for a bad key.

Batch sends accept up to 100 messages. The default x-batch-validation: strict accepts nothing if any message is invalid. permissive returns data aligned with the request, with null where a message was not accepted, and errors: [{ index, message }]. SendPanda also accepts base64 attachments on a batch; Resend's own batch API does not.

If a later message fails after earlier ones were accepted, the error names those ids. Retry the same request with the same Idempotency-Key to continue without duplicating them. Without that key, do not resend the accepted messages.

4. What this switch does not cover

  • Any other Resend API: domains, contacts, broadcasts, receiving, webhooks and the rest. Use SendPanda's API or SDK for those.
  • SMTP. SendPanda does not run an SMTP server.
  • The Auth.js Resend provider. It posts to a hardcoded https://api.resend.com/emails, so RESEND_BASE_URL does not redirect it. Use the Auth.js guide.

For a new integration, call @sendpanda/sdk directly. The quickstart is the short path. npx @sendpanda/cli init writes this guidance into AGENTS.md, a Cursor rule and a Claude skill.

↑↓ to navigate↵ to openesc to close