# Environments

> Every Project has a test half and a live half, and the prefix of the API key says which one you are in.

Every Project has two halves, `test` and `live`. Each has its own API keys and its own webhook endpoints, and nothing sent in one can be seen from the other. You do not create them: they exist from the moment the Project does.

## The key decides

An API key belongs to one Project and one Environment, and its prefix says which: `sk_test_…` or `sk_live_…`. No body has an `environment` field. A Message is born in the Environment of the key that sent it, and stays there.

The SDK reads the prefix too:

```ts
import { Nibify } from '@nibify/sdk';

const nibify = new Nibify({ apiKey: 'sk_test_…' });

nibify.environment; // 'test'
```

Every Request says where it lives: `environment` is in what `POST /v1/requests` returns and in every read of the Request.

## One boundary

A `test` key cannot read a `live` Request, and the other way round: to the wrong key it does not exist, and the answer is `404`. The same boundary runs through everything a key touches:

- A `threadKey` names one Thread in each half. `vendor:kiwi-studio` in `test` and in `live` are two conversations.
- An [`Idempotency-Key`](https://nibify.app/docs/idempotency-and-retries) counts within its half, so a workflow tried in `test` and then run in `live` with the same key does not replay the test.
- Webhook endpoints belong to one half, and receive only its events.
- [Rate limits](https://nibify.app/docs/errors-and-rate-limits) are counted per half: a loop running on `test` does not use up the day of `live`.
- [Plan limits](https://nibify.app/docs/errors-and-rate-limits#plan-limits) are counted per half too: `test` has a monthly allowance of its own, and spending it does not touch the Messages of `live`.

## A test push rings

A Request sent with a `test` key reaches the phone like any other, with the same push and the same buttons: trying a workflow is exactly when you want to see it arrive. The phone marks it as a test, next to the agent's words and never inside them, and the Inbox can show one half at a time.

## Going live

Build and try with `sk_test_`. When the workflow is real, create a `live` key in the [dashboard](https://app.nibify.app) and put it where the test key was. Nothing else in your code changes.

## Next

- [Priority and quiet hours](https://nibify.app/docs/priority-and-quiet-hours): Your agent says how urgent a Message is; the person decides when their phone may ring.
- [Threads](https://nibify.app/docs/threads): One conversation per threadKey: how Messages are grouped, and what the person sees.
