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>',
});# export RESEND_API_URL=http://localhost:3000/
import resend
resend.api_key = "re_local_dev_key"
resend.Emails.send({
"from": "Acme <onboarding@resend.dev>",
"to": ["delivered@resend.dev"],
"subject": "It works",
"html": "<p>Captured by Pretend</p>",
})<?php
// export RESEND_BASE_URL=http://localhost:3000/
$resend = Resend::client('re_local_dev_key');
$resend->emails->send([
'from' => 'Acme <onboarding@resend.dev>',
'to' => ['delivered@resend.dev'],
'subject' => 'It works',
'html' => '<p>Captured by Pretend</p>',
]);# export RESEND_BASE_URL=http://localhost:3000/
require "resend"
Resend.api_key = "re_local_dev_key"
Resend::Emails.send({
from: "Acme <onboarding@resend.dev>",
to: ["delivered@resend.dev"],
subject: "It works",
html: "<p>Captured by Pretend</p>"
})// export RESEND_BASE_URL=http://localhost:3000/
package main
import "github.com/resend/resend-go/v2"
func main() {
client := resend.NewClient("re_local_dev_key")
client.Emails.Send(&resend.SendEmailRequest{
From: "Acme <onboarding@resend.dev>",
To: []string{"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:
RESEND_BASE_URL=http://localhost:3000/
RESEND_API_KEY=re_local_dev_keywarning
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:
| Recipient | Outcome |
|---|---|
delivered@resend.dev | Delivered |
bounced@resend.dev | Bounced |
complained@resend.dev | Delivered, then a spam complaint |
suppressed@resend.dev | Suppressed |
Labels work on all but suppressed, such as bounced+signup@resend.dev. Any other recipient is treated as delivered.