# Test mode

> Test keys, test numbers and predictable outcomes, with webhooks and no phone calls.


# Test mode

Keys that start with `alt_test_` work exactly like live keys, with three differences:

1. They only call **test numbers**, and nothing is dialled: the result is simulated a moment later.
2. Everything they create is marked `livemode: false` and is invisible to live keys (and vice versa).
3. Nothing is billed and no email is sent. Webhooks **are** sent, so you can test your endpoint.

Agents are shared between modes: a test key can create and publish agents, but only a live key makes them phone real people.

## Test numbers

| Number          | Simulated outcome                                                                |
| --------------- | -------------------------------------------------------------------------------- |
| `+390000000001` | `completed`, with example values for every result field                          |
| `+390000000002` | `no_answer` (retried after 1 minute in test mode)                                |
| `+390000000003` | `busy` (retried)                                                                 |
| `+390000000004` | `voicemail`                                                                      |
| `+390000000005` | `callback_requested` for tomorrow at 10:00, and the automatic callback is queued |
| `+390000000006` | `do_not_call`, and the number joins the do-not-call list                         |
| `+390000000007` | `wrong_person`                                                                   |
| `+3900000000NN` | any other ending completes                                                       |

Live keys refuse test numbers (`test_number_in_live_mode`) and test keys refuse real ones (`test_number_required`).

## A full check in one script

```sh
export ALLERTO_API_KEY=alt_test_…
AGENT=$(allerto agents push reminder.json --publish --json | jq -r .id)
for n in 01 02 05 06; do
  allerto calls create --agent "$AGENT" --to +3900000000$n \
    --input name=Test --input amount=1 --input month=January --json | jq -r '.id'
done
sleep 5 && allerto calls list --since 10m
```
