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):

ParameterTypeRequiredDescription
Test sends10,000 / monthOptionalSimulated sends from test keys. No real email leaves.
Test verifications100 / monthOptionalSimulated 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.

jsonPOST /v3/keys
{
  "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:

ParameterTypeRequiredDescription
Sendingdelivered@ · bounce@ · complaint@Optionale.g. bounce@example.com always produces a hard (permanent) bounce + bounce webhook.
Soft bouncesoftbounce@ (also soft-bounce@, soft_bounce@)OptionalAlways 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 submissionrefused@OptionalA 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.
Verificationvalid@ · invalid@ · catchall@ · unknown@Optionale.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:

ParameterTypeRequiredDescription
queuedsoftbounce@OptionalSend to softbounce@, wait for status bounced, then resend: outcome: queued, the same message_id, attempt 1, 2, … on each resend.
resubmittedrefused@OptionalSend 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_alloweddelivered@ · bounce@ · complaint@OptionalDelivered messages and hard bounces cannot be resent.