# Test mode

Test keys with sample data: integrate without touching your real data or waiting for approval.

Guide No approval Sample data

**Like in Stripe.** Integrate with ByDomu without touching your real data or waiting for approval. Every account has a test mode.

## Test keys

In _Settings › API keys_ choose **Test** and create a key: `domu_sk_test_…` (secret, for your server) or `domu_pk_test_…` (publishable, for your website). They have every permission (writes, messages and webhooks) without requesting access, even during the free trial; you only need a verified email. Limit: 100 requests and 30 writes per minute.

## Your test organization

With your first test key we create a test organization with sample data: contacts, appointments, tasks and conversations, plus properties and deals if your account is a real estate agency. There’s no real personal data. A test key only sees and changes that organization, and a live key never sees it.

## How to tell which mode you’re in

Every response carries the `X-Domu-Mode: test` header (or `live`), and `GET /v1/me` returns `"mode": "test"` and `"livemode": false`.

```bash
curl https://api.bydomu.com/v1/me -i \
  -H "X-API-Key: $BYDOMU_API_KEY"

# X-Domu-Mode: test
# { "data": { "mode": "test", "livemode": false, … } }
```

## Nothing goes out for real

- The test organization sends no WhatsApp, Instagram, Facebook, email, SMS or notifications.
- There are no charges, portal or Meta Ads publications, or AI calls either.
- Messages are saved as sent and their id starts with `wamid.sim_`.

## Webhooks

They’re delivered just like in production, with the same `X-Domu-Signature` signature and the same retries. The envelope carries `"livemode": false`; production ones, `"livemode": true`. To test your receiver without waiting for a real event:

```bash
curl -X POST https://api.bydomu.com/v1/test/events \
  -H "X-API-Key: domu_sk_test_…" -H "Content-Type: application/json" \
  -d '{"type":"deal.won"}'
```

The event goes out with the data of the most recent record of that object in your test organization and carries `"test": true`.

## Start over

`POST /v1/test/reset` (with a secret test key) or the _Reset test data_ button erases everything and reloads the sample data. Your keys, the organization id and your webhooks are kept.

```bash
curl -X POST https://api.bydomu.com/v1/test/reset \
  -H "X-API-Key: domu_sk_test_…"
```

## Go live

Swap the key for a `domu_sk_live_…` one and check in your webhook receiver that `livemode` is `true`. The `/v1/test/*` operations return `403 TEST_MODE_ONLY` with live keys.

## MCP

The MCP server accepts `domu_sk_test_…` just like a live key; the assistant will only see the sample data.
