> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useboom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Test your integration

> Build and test against Boom with a test key: it reaches only your test numbers and the journeys you publish to staging, never your real customers.

While you build an integration, you want to send real events and real one-time
codes without reaching real customers. A **test key** does that. It's an API key
tied to a non-production environment, such as `staging`, and it can only:

* message your **test numbers**,
* start journeys **published to its environment**, and
* call the few endpoints an integration needs to test.

Your production keys keep working exactly as before. Test keys are available in
every organization.

## Set it up

**1. Create a staging environment**

Go to **Settings → Environments** and click **New environment**. Name it
`staging`.

The first environment an organization creates becomes its default, and a
test key can't use the default. If the list is empty, create `production`
first and then `staging`. Names like `production`, `prod`, `prd` and `live`
can't hold a test key, and neither can `test`, which Boom uses for test sends
from the dashboard. See [Environments](https://docs.useboom.ai/environments.md) for what else an
environment holds.

**2. Add your test numbers**

Go to **Settings → Test numbers** and click **Add number** for every phone
your team tests with. Each entry expires after the number of days you
choose. Click **Renew** to keep it. A test key can't reach a number that
isn't on this list or has expired.

**3. Publish your journeys to staging**

Open the journey, choose `staging` in the environment switcher in its
toolbar, and click **Publish**. A test key starts only journeys published to
its environment, so a journey published only to production never runs from
a test key.

**4. Create the test key**

Go to **Settings → API keys** and click **Create key**. Give it a name, set
**Environment** to `staging`, and click **Create Key**. Copy the key now:
you won't see it again.

In the keys table, it shows as **staging · test key**. A key's environment
can't be changed later.

> [!WARNING]
>
> A journey published **only** to staging can still start from your
> **production** keys. Before you send production events with the same name,
> publish the journey to production too.

## Use the key

Use the test key exactly like a production key, from your development backend:

```bash theme={null}
export BASE="https://www.useboom.ai"
export BOOM_KEY="your-test-key"
```

**Send a one-time code** to a test number:

```bash theme={null}
curl -X POST "$BASE/api/v1/otp/send" \
  -H "Authorization: Bearer $BOOM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+5215512345678"}'
```

Verify it with the same test key. A code sent with a test key verifies only
with a test key, and a production code only with a production key. See
[One-time codes › Testing](https://docs.useboom.ai/one-time-codes.md#testing).

**Create a test person**, then **record an event** for them:

```bash theme={null}
curl -X POST "$BASE/api/v1/cdp/people" \
  -H "Authorization: Bearer $BOOM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"externalId":"qa_ana","phoneNumber":"+5215512345678"}'

curl -X POST "$BASE/api/v1/cdp/events" \
  -H "Authorization: Bearer $BOOM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"payment_made","externalId":"qa_evt_1","personExternalId":"qa_ana"}'
```

The event starts the journeys published to staging that it triggers. `externalId`
is the event's idempotency key: sending the same one again stores no second event
and returns `created: false`, but it can still start a new run once the earlier
one has finished. Use a new `externalId` each time you re-run the example.

## What a test key can and can't do

| Call | With a test key |
| - | - |
| Send and verify one-time codes | Only to test numbers |
| Upsert a person | Only a person whose phone is a test number |
| Record an event | For a test-number person. For anyone else, only when every journey it would start is HTTP-only (no messages), and the event isn't stored |
| Anything else | `403 environment_not_supported` |

A send to a phone that isn't a test number answers `403
recipient_not_test_number`, and nothing is sent.

From a test key, a journey starts only if it sends **WhatsApp** (to test
numbers) or makes **HTTP requests** only. A journey that sends email or SMS,
places calls or gives rewards doesn't start.

Test runs never cancel or change a production run, and they don't count
toward your production frequency cap or Smart Sending cooldown.

## Good to know

* **Messages are real.** Test codes and journey messages go out from your usual
  WhatsApp number and template. They're billed and show up in the inbox.
* **Only one environment per key.** Create one test key per environment you
  test in.
* **Going live.** Create a production key in **Settings → API keys** and
  switch your production backend to it. A test key never becomes a production
  key.

## Not covered yet

* A different WhatsApp sender per environment: test messages use your
  production number.
* Batch endpoints, reads and every other endpoint answer
  `403 environment_not_supported`.

For the full endpoint reference, see
[Authentication › Test keys](https://docs.useboom.ai/authentication.md#test-keys).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.