> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testbrick.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Environments

> Manage environment variables — switch between dev, staging, and production

# Environments

Environments let you define reusable variables per project. Switch between development, staging, and production with one click — same flow, different config.

## Creating an environment

1. In the API flow toolbar, click the **environment dropdown** (shows "No Environment" by default)
2. Type a name like "Development" and click **+**
3. Click the **gear icon** next to the environment to add variables

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/environment-dropdown.png" alt="Environment dropdown" />

## Adding variables

Each environment has key-value pairs:

| Key         | Value                             |
| ----------- | --------------------------------- |
| `baseUrl`   | `https://api.staging.example.com` |
| `apiKey`    | `sk_test_abc123`                  |
| `testEmail` | `test@staging.example.com`        |

### Secret variables

Toggle a variable as **secret** to mask its value:

* Always shows `••••••` in the UI
* Masked in shared result links
* Variables with `key`, `token`, `secret`, `password` in the name are flagged automatically

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/variable-editor.png" alt="Variable editor" />

## Using variables

Reference environment variables in any field with `{{variableName}}`:

```
URL:    {{baseUrl}}/users
Header: Authorization: Bearer {{apiKey}}
Body:   {"email": "{{testEmail}}"}
```

## Switching environments

Select a different environment from the dropdown before running your flow. The same flow runs against different servers — no changes needed.

**Example:**

| Environment | baseUrl                   | apiKey         |
| ----------- | ------------------------- | -------------- |
| Development | `http://localhost:3000`   | `dev_key_123`  |
| Staging     | `https://api.staging.com` | `stg_key_456`  |
| Production  | `https://api.prod.com`    | `prod_key_789` |

<Warning>
  Be careful running flows against production. Consider using a dedicated test account.
</Warning>
