Test mode
Test mode runs every call through the real API without sending real email. Use it to build and check your integration before your account is approved or your domain is verified.
How test mode works
Your mode comes from the API key. Keys that start with sk_test_ work in test mode, keys that start with sk_live_ work in live mode. The endpoints, request bodies and responses are the same in both, so moving to live is a key swap. Every email object carries a mode field that says which one it belongs to.
With a test key:
- Nothing leaves Sendfern. No message is handed to a mail server and no recipient gets anything.
- You don't need an approved account or a verified domain. Any From address is accepted, so you can start before your DNS records are in place.
- Requests are validated exactly as in live mode. A missing subject, too many recipients or a bad attachment fails the same way it would for real. See Errors.
- Test emails never count toward your monthly quota or your bounce and complaint rates.
Create test keys in the dashboard: switch to test mode, then open API keys. See Authentication.
Simulate outcomes
A test email goes through the normal steps (queued, then sent) and then gets a simulated result for each recipient. The part of the address before the @ picks the result:
| Recipient starts with | What happens | Final status |
|---|---|---|
bounce | A permanent bounce | bounced |
complain | Delivered, then marked as spam by the recipient | complained |
| Anything else | Delivered | delivered |
The domain doesn't matter: bounce@example.com, bounce-1@example.com and bounced.user@acme.com all bounce. The rule applies to every recipient in to, cc and bcc, so one email can mix outcomes.
curl https://api.sendfern.com/v1/emails/batch \
-H "Authorization: Bearer $SENDFERN_API_KEY" \
-H "Content-Type: application/json" \
-d '[
{"from": "Acme <onboarding@acme.com>", "to": "delivered@example.com",
"subject": "Welcome", "text": "Hello"},
{"from": "Acme <onboarding@acme.com>", "to": "bounce@example.com",
"subject": "Welcome", "text": "Hello"},
{"from": "Acme <onboarding@acme.com>", "to": "complain@example.com",
"subject": "Welcome", "text": "Hello"}
]'Fetch one of the emails a moment later to see the simulated events in its timeline. Simulated events carry "simulated": true in their data.
{
"id": "em_2Xb9QmT4kLp8RvN1cY7hWd",
"object": "email",
"mode": "test",
"status": "bounced",
"to": ["bounce@example.com"],
"subject": "Welcome",
"events": [
{"type": "sent", "recipient": "", "data": {}, "occurred_at": "2026-11-28T10:19:04Z"},
{"type": "bounced", "recipient": "bounce@example.com",
"data": {"bounce_type": "Permanent", "simulated": true},
"occurred_at": "2026-11-28T10:19:04Z"}
],
...
}What is not simulated
- Opens and clicks. Test emails never get
openedorclickedevents. - Suppressions. Your suppression list isn't checked for test emails, and a simulated bounce or complaint doesn't add the address to it. See Suppressions.
Webhooks in test mode
Simulated events are sent to your webhook endpoints exactly like real ones, signed the same way. Each payload has a mode field. Endpoints are shared between modes, so one endpoint receives both live and test events: check mode before acting on an event, for example before you mark a customer's address as bad.
{
"id": "whevt_...",
"type": "email.bounced",
"mode": "test",
"created_at": "2026-11-28T10:19:04Z",
"data": {
"email_id": "em_2Xb9QmT4kLp8RvN1cY7hWd",
"from": "Acme <onboarding@acme.com>",
"to": ["bounce@example.com"],
"subject": "Welcome",
"recipient": "bounce@example.com",
"tags": {},
"broadcast_id": null,
"bounce_type": "Permanent",
"simulated": true
}
}A test key can also send a sample email.delivered event to an endpoint with POST /v1/webhooks/{id}/test. See Webhooks.
What test keys can see and change
Emails and broadcasts are separate
A test key sees and creates only test emails and test broadcasts. A live email or live broadcast isn't visible to it: fetching one by id returns 404 not_found, so a test key can never send a live broadcast. Lists, stats and the dashboard show only the mode you are in. A live key, in turn, sees only live emails and broadcasts.
Everything else is shared and read-only
Domains, suppressions, webhooks, audiences, contacts, templates and images are shared between modes. Live sends use the same objects, so a test key may read them but not change them. Any create, update or delete on them with a test key returns 403 permission_denied:
{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "Test keys can read domains but not change them. Use a live key."
}
}Two calls change nothing and are allowed with a test key:
POST /v1/templates/{id}/render, to preview a template with variables. See Templates.POST /v1/webhooks/{id}/test, to send a sample event.
To set up shared objects, use a live key or the dashboard. In the dashboard you can change them in either mode. Because test sends need no verified domain, you can test sending before you add one.
API keys follow the same idea: a test key lists and revokes only test keys and can never see a live key. See Authentication.
Next steps
When your code works in test mode, read Going live for what your account needs before live sending works.