import { apiHost, apiOrigin, consoleOrigin } from '../../../lib/docs-env';

Every API key is bound to one region (`us` or `eu`) and one mode (`test` or `live`). The prefix encodes both, and the SDK uses it to pick the right endpoint. You cannot move data between regions, and a key issued in one region does not work against the other.

## Test vs live mode

Test mode is isolated from live mode. Verifications, applicants, checks, and webhook deliveries created in test mode never touch live data and never bill against your wallet.

Test-mode emails are suppressed — no real delivery occurs. They still appear in the [email log](/developers/email-log) so you can inspect what would have been sent.

You can wipe all test-mode data for an organization at any time from **Developers → Test data**. The purge is irreversible — see [Test data](/developers/test-data).

### Test mode is a zero-friction, fully synthetic sandbox

Test mode is free and provably synthetic — it is the safe place to build your integration end to end before going live:

- **Free, no billing.** Every check runs free. Test mode has no wallet and no subscription, so you do not need to fund anything to run a test verification. Billing applies to live mode only. (Your activity still meters into the dashboard so you can see counts.)
- **No real checks, no real data.** A test verification runs no real checks: document capture, selfie, and liveness are simulated in the browser, with no real data, camera, or biometrics used. Every result is synthetic.
- **You pick the outcome.** When you start a test verification you choose an **Expected outcome** (**Pass**, **Review**, or **Fail**), and that one choice drives a coherent synthetic verdict across every check in the verification (document, face match, and liveness). The default is **Pass**. This replaces guessing at magic identifiers: one picker, one outcome.

Switch to live mode when you are ready to verify real applicants, at which point checks run for real and bill against your wallet.

## US vs EU regions

Customer data is pinned to the region of the organization that owns it. We do not replicate tenant data across regions. EU verifications run entirely within the EU region against an EU-approved configuration for any organization in the EU region.

| Region | API endpoint                   | Console                            |
| ------ | ------------------------------ | ---------------------------------- |
| US     | <code>{apiOrigin('us')}</code> | <code>{consoleOrigin('us')}</code> |
| EU     | <code>{apiOrigin('eu')}</code> | <code>{consoleOrigin('eu')}</code> |

## How keys encode region and mode

Every API key has the form `ah_{type}_{region}_{mode}_{secret}` where `type` is `sk` (secret) or `pk` (publishable); `region` is `us` or `eu`; and `mode` is `live` or `test`. Example: `ah_sk_us_test_<your-key>`.

## Picking the right endpoint

Send each request to the API endpoint that matches the key's region. A `ah_sk_us_…` key against <code>{apiHost('eu')}</code> returns `region_mismatch`.

## Switching mode in the console

The sidebar's mode toggle switches between test and live across every page. The current mode persists in your session.

## Cross-region rules

You cannot share an applicant, verification, or webhook endpoint between US and EU. To run identical configuration in both, create one organization per region.