# Test mode

Test mode gives you a **practice organisation**: a copy of an organisation with sample sites, doors and people, where nothing is real. Use it to try the API before you touch real buildings.

## Start

1. Sign in to the dashboard as an Organisation and open **Developers** in the menu.
2. Press **Start test mode**. Your practice organisation is made straight away, with sample data.
3. Make a **test key**. Test keys start with `tbc_test_` and only reach your practice organisation. Your production keys never reach it, and a test key never reaches your real organisation.

Send the key like any other key:

```bash
curl https://go.thebuilding.cloud/api/entrances \
  -H "Authorization: Bearer tbc_test_…" \
  -H "Accept: application/json"
```

## What is in it

- one site and one building,
- three **virtual doors**: "Front door", "Car park gate" and "Bin store",
- one entrance group, "Residents", with all three doors,
- five people, "Test Resident 1" to "Test Resident 5", with `@example.test` email addresses and no phone numbers,
- keypad PINs for two of them,
- a few past door events, so the access log isn't empty.

**Reset to sample data** on the Developers page removes everything you made and brings the sample data back. Your test keys stay.

## What you can do with a test key

Read everything in your practice organisation, and create, change and delete:

| What | Most you can have |
|---|---|
| Sites | 5 |
| Buildings | 10 |
| Doors | 25 |
| Entrance groups | 20 |
| People | 100 |
| PINs | 200 |
| Webhooks | 5 |

You can also open its doors (`POST /api/entrances/{id}/unlock`) and add people to entrance groups or take them out.

Above a limit you get `422` with a message such as *"Test mode allows up to 25 doors. Delete one or reset the practice organisation."*

### Rules in test mode

- **Doors are always virtual.** They have no controller, so opening one moves nothing: the event is written to the access log of your practice organisation (`GET /api/access-logs`), and you get the same answer as for a real door.
- **People need an `@example.test` email address** that nobody else uses, and get no phone number. They can be door users, employees, visitors or guests (`role_id` 4, 6, 7 or 8).
- **PINs** can be keypad codes or cards (`pin_type` `default` or `code`), with the Unlimited time limit (`single_pin_timer_id` 1).
- **No files or photos**, and request bodies up to 64 KB.
- Ids in a request (site, building, door, entrance group, person) must be your practice organisation's own.

### Not available in test mode

Billing and plans, user import, the Notice Board, door schedules, intercom calls, automations, FireBird controllers and firmware, other devices, roles, API tokens and account settings. A test key gets `403` with a short message for these.

## Request limits

Test keys have their own limits, separate from your production keys:

- 60 requests a minute,
- 20 changes (POST, PUT, PATCH, DELETE) a minute,
- 1,000 changes a day.

Above them you get `429` with a `Retry-After` header: wait that many seconds and try again.

## The test outbox

Nothing in test mode is ever sent to anyone. Emails that would go to the people of your practice organisation — for example the welcome email when you add a person — are kept in the **test outbox** on the Developers page instead.

The outbox and the door events keep the newest 1,000 items for 30 days.

## When it is removed

A practice organisation you don't use for 30 days is removed, with everything in it. We email you a week before. Any call with a test key keeps it.
