Guides

Connect an SDK

Point any official Resend SDK at Pretend by changing its base URL.

The base URL

Every official SDK uses the same base URL: http://localhost:3000/, with the scheme and the trailing slash. Most SDKs read it from RESEND_BASE_URL; the Python SDK reads RESEND_API_URL.

Set the API key to Pretend's key: RESEND_API_KEY if you set one, otherwise re_local_dev_key.

Examples

import { Resend } from 'resend';

const resend = new Resend('re_local_dev_key', {
  baseUrl: 'http://localhost:3000/',
});

await resend.emails.send({
  from: 'Acme <onboarding@resend.dev>',
  to: ['delivered@resend.dev'],
  subject: 'It works',
  html: '<p>Captured by Pretend</p>',
});

Switching per environment

Read the base URL from the environment, so production uses Resend and development uses Pretend with no code change:

.env.development
RESEND_BASE_URL=http://localhost:3000/
RESEND_API_KEY=re_local_dev_key

warning

Include the scheme and the trailing slash. The SDKs join request paths onto this URL, and http://localhost:3000/ is the form every SDK accepts.

Test recipients

Pretend simulates delivery the way Resend does for its test addresses on resend.dev:

RecipientOutcome
delivered@resend.devDelivered
bounced@resend.devBounced
complained@resend.devDelivered, then a spam complaint
suppressed@resend.devSuppressed

Labels work on all but suppressed, such as bounced+signup@resend.dev. Any other recipient is treated as delivered.