Guides
Test mode
Build and test without delivering real email, and make bounces and complaints on demand.
What a test key does#
Create a key with the mode Test in the dashboard. Its value begins cirrus_test_. A test key accepts the same requests as a live key and answers them the same way, but:
- Nothing is delivered. No email leaves, to anyone, however real the address looks.
- The outcome is simulated. The events a real send would produce are made up for you, so your webhooks, your status checks and your error handling all get exercised.
- It uses no allowance and stays out of your analytics and your suppression list.
- The answer has
test_mode: true, and so do the email, its events and the webhooks about it, so you can tell test traffic apart.
Make an outcome happen#
Mail to an address at simulator.test is never delivered. The part before the @ chooses what happens:
| Address | What happens |
|---|---|
bounce@simulator.test | A hard bounce. The recipient ends as bounced. |
softbounce@simulator.test | A soft bounce. The recipient is delayed. |
complaint@simulator.test | Delivered, then a spam complaint. The recipient ends as complained. |
reject@simulator.test | The email provider refuses the message. The recipient is failed. |
throttle@simulator.test | The provider is busy. The send is tried again later. |
timeout@simulator.test | The provider's answer is lost. The recipient is unknown and is never retried. |
| any other name at simulator.test | Delivered. Nothing reaches an inbox. |
These addresses are simulated with a live key too, so a stray one can never cause a real bounce. A live message cannot mix them with real recipients: the request is refused with a 422 on to. Send them separately.
curl -X POST https://api.cirrusmail.example/v1/emails \
-H "Authorization: Bearer $CIRRUS_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Shop <orders@shop.example>",
"to": "bounce@simulator.test",
"subject": "This will bounce",
"text": "Nothing is delivered in test mode."
}'Read the email back with GET /v1/emails/{id}, list its events, or let a webhook tell you. The recipient will end as bounced. Because it is a test, the address is not added to your suppression list.
Move to live#
Switching to live is a change of key and nothing else: no URL changes and no field changes. Create a live key (cirrus_live_…) with only the scopes the app needs, put it in your production environment and keep the test key for development and automated tests.
An idempotency key is remembered separately for test keys and live keys. A live request that reuses a key from your tests is sent as a new message. It is not answered with the test receipt.