# Testing

Source: https://won.dev/docs/testing

Build and test with a **test key**, a key that starts with `won_test_`. It is the sandbox of the API: every endpoint and every [MCP](/docs/mcp) tool is there, with the same parameters, validation, response shapes and [rate limit](/docs/rate-limits) as with a live key, but nothing real happens and nothing is charged. Code written against a test key works with a live one: change the key and nothing else.

## Get a test key [#keys]

In the console, open the **API keys** page, choose **Create key** and pick the **Test** mode. A new organization is offered one during onboarding. A test key has no budget, since it costs nothing.

```bash
curl https://api.won.dev/v1/trade/companies/search \
  -H "Authorization: Bearer won_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "role": "importer", "hs_code": "940161", "importer_country": "US", "limit": 10 }'
```

The answer has the shape of a real one, says in `notice` that it is sample data, and ends with `usage` at a `cost` of `0`.

## What a test key does [#behavior]

| Product                    | With a test key                                                                                                                                                                                                            |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Trade data](/docs/trade)  | The same made-up companies, shipments, contacts and numbers, whatever you ask. Every name carries "SAMPLE" and every domain ends in `.example`.                                                                            |
| [Enrichment](/docs/enrich) | The same made-up company and people, with work emails, phone numbers in the range kept for fiction, and job postings.                                                                                                      |
| [Signals](/docs/signals)   | Sample signals of the sample companies, whatever you ask.                                                                                                                                                                  |
| [Cold email](/docs/email)  | A [sandbox](/docs/email#sandbox) with the same endpoints, checks and events that sends nothing. A day between steps takes a minute, and the first part of an address, such as `reply@` or `bounce@`, decides what happens. |
| [Tasks](/docs/tasks)       | Every part runs with the test key, on sample data.                                                                                                                                                                         |
| [Account](/docs/account)   | The organization's balance and charges, for reference. A test key never adds to them.                                                                                                                                      |

## Kept apart from live data [#separate]

- A test key sees only what test keys made: its own senders, campaigns, recipients, suppression list, webhooks and tasks. A live key never sees them, and a test key never sees the live ones.
- What the sandbox simulates never reaches a real webhook, and its events carry `test: true`.
- A request tried with a test key is never the answer to the same request made with a live key: repeats and `Idempotency-Key`s are kept apart.
- `dry_run` and `max_cost` work as they do with a live key, so you can check the most a call would cost before you go live.

## Going live [#live]

Swap the test key for a `won_live_` key, with a budget of its own: see [Authentication](/docs/authentication#keys). The live key returns real data and spends the organization's balance. Send `dry_run: true` first to see the most a call can cost, and `max_cost` to cap it.