# Test environment

URL: /products/api/test-environment · Id: `page:products/api/test-environment`

> Every Customer of an API gets test and live keys on one address; test calls reach test records, move no money and run the Startup's latest merged Change.

Every [Startup](/business/nouns/startup)'s API has two environments, `test` and `live`, on one address. A [Customer](/business/nouns/customer)'s key picks between them, so its code moves from `test` to `live` by changing one variable.

## Two keys, one address
Harbor Residential's developer makes a `test` key in the [Portal](/business/nouns/portal) and sets it as `LEASELINE_API_KEY` on a laptop. Production holds the `live` key in the same variable, and the call is the same:

```bash
curl https://api.leaseline.app/leases -H "Authorization: Bearer $LEASELINE_API_KEY"
```

Every record, such as an [Order](/business/nouns/order) or an [Event](/business/nouns/event), belongs to one environment and never crosses. No parameter moves a keyed call between them.

## What test does differently
`test` runs every [Verb](/business/nouns/verb) for real, with three exceptions:

| In `test` | What happens instead |
| --- | --- |
| Payments | Test cards charge, and no money moves |
| Outbound messages | Reach only the Startup's own team |
| Outside effects | Simulated, then recorded as `done` |

Everything else matches `live`: [Permissions](/business/nouns/permission), [Limits](/business/nouns/limit), [Watches](/business/nouns/watch) and Events. A flow that passes in `test` passes in `live`. A magic value forces an outcome, such as card `4000 0000 0000 0002`, which declines.

## Test runs ahead of live
`test` runs the Startup's latest merged [Change](/business/nouns/change); `live` runs the [Version](/business/nouns/version) last deployed. A Customer sees a merged Change in `test` before it reaches `live`, which is how Harbor Residential tests `v2` before moving its pin.

## Your own test environment
Leaseline's builders use the same two environments on the builder plane. [Environments](/code/cli/guides/environments) covers them, and [the testing guide](/code/sdk/guides/errors-and-testing) lists every magic value.