Test keys
A test key is a full sandbox — build and test your integration with realistic responses, but nothing real happens and nothing is charged.
Test keys (sandbox)
A key created in test mode (afn_test_…) is a sandbox. Sends and verifications behave exactly like production — same responses, same message IDs, same webhooks — but no real email is sent, no SMTP probe runs, and nothing is charged. Use it to build your whole integration with confidence before switching to a live key.
Free monthly limits
Test traffic never touches your paid quota or verification credits. Instead each account has a free, capped monthly allowance (staff can raise it):
| Parameter | Type | Required | Description |
|---|---|---|---|
Test sends | 10,000 / month | Optional | Simulated sends from test keys. No real email leaves. |
Test verifications | 100 / month | Optional | Simulated verifications from test keys. No SMTP probe runs. |
When an allowance is exhausted the API returns 429 — switch to a live key for production volume.
Choosing outcomes
When you create a test key you set an outcome mix — the odds of each simulated result. Every request rolls the mix and fires the matching webhook.
{
"name": "sandbox",
"env": "test",
"test_outcomes": {
"send": { "delivered": 90, "bounce": 8, "complaint": 2, "opened": 25, "clicked": 3 },
"verify": { "valid": 70, "invalid": 20, "catch_all": 5, "unknown": 5 }
}
}Magic addresses
To force a specific result (overriding the mix), name the outcome in the recipient local-part:
| Parameter | Type | Required | Description |
|---|---|---|---|
Sending | delivered@ · bounce@ · complaint@ | Optional | e.g. bounce@example.com always produces a hard (permanent) bounce + bounce webhook. |
Soft bounce | softbounce@ (also soft-bounce@, soft_bounce@) | Optional | Always ends in a temporary bounce: status bounced, bounced webhook with bounceType: Transient, smtpStatus: 4.2.2. Resending it redelivers the same message (and it soft-bounces again). |
Refused at submission | refused@ | Optional | A single send (POST /v3/messages) to it is refused with 422 sandbox_refused; the attempt is recorded as a rejected message with its content kept, and the error message names it (Recorded as rejected message msg_…; it is also the rejected event in GET /v3/events). Resending it sends it again as a new email, which is delivered. In a batch, refused@ is simply delivered. |
Verification | valid@ · invalid@ · catchall@ · unknown@ | Optional | e.g. invalid@example.com always returns invalid. |
The local part is matched case-insensitively on any domain (e.g. softbounce@example.com). Magic addresses only act on test keys and sandbox traffic — with a live key they are ordinary addresses and the email is really sent, so never use them with a live key. Simulated sends never leave the platform and never add the recipient to your suppression list.
Testing resend
Only emails that were never delivered can be resent (see Resend a message). Use these fixtures to cover each outcome deterministically:
| Parameter | Type | Required | Description |
|---|---|---|---|
queued | softbounce@ | Optional | Send to softbounce@, wait for status bounced, then resend: outcome: queued, the same message_id, attempt 1, 2, … on each resend. |
resubmitted | refused@ | Optional | Send to refused@ (single send, answered 422 sandbox_refused naming the recorded msg_… id), then resend that id: outcome: resubmitted with a new_message_id. Resending the original again returns in_progress (already resent). |
not_allowed | delivered@ · bounce@ · complaint@ | Optional | Delivered messages and hard bounces cannot be resent. |