Skip to content
Vegha Docs

Environments

An environment lets you reuse one collection against multiple targets — for example local, staging, and production — by swapping a named set of values.

An environment is a set of name/value pairs stored in its own .bru file. Each pair becomes a variable you can reference with {{name}} anywhere a request is built.

A typical environment defines values like:

VariableLocalProduction
base_urlhttp://localhost:8080https://api.example.com
api_keydev-key{{prod_key}}

Create a new environment and add the name/value pairs you need. Because an environment is just a .bru file, it lives alongside your collection and can be versioned with it.

You can keep environments per collection (specific to one project) or as global environments shared across collections.

Use the environment picker to choose the active environment. Only one environment is active at a time, and its values are used when requests are sent. Switching the picker instantly retargets every {{variable}} reference in the collection.

You can also run with no environment selected, in which case only collection, workspace, and runtime variables resolve.

Once an environment is active, reference its variables anywhere with double braces:

URL

{{base_url}}/v1/orders

Header

Authorization: Bearer {{access_token}}

Body

{
"region": "{{region}}",
"tenant": "{{tenant_id}}"
}

Auth fields — environment variables work in the Authorization tab too, so you can keep credentials out of individual requests.

Environment variables are one of several scopes. When the same name exists in more than one scope, Vegha resolves it by precedence. See Variable types for the full resolution order and the available scopes.