ENVIRONMENTS
Variable Priority
How API Studio resolves conflicts when the same {{variable}} is defined in multiple sources — and how to use that to your advantage.
Priority Chain
When multiple sources define the same variable name, the highest priority source wins. Resolution happens at send time — the final value is what gets interpolated into your request.
Priority (lowest → highest)
Collection Variables (Lowest Priority)
Defined in the Collection Editor → Overview tab. These are scoped to the collection and shared across all its requests.
Global Environment
Selected from the environment dropdown (global scope). Stored in ~/.openpost/global/environments.json and shared across all workspaces.
Vault Secrets
From the active Secret Set in the built-in vault. Secret entries map vault keys to {{variableName}} placeholders.
Local Environment (Highest Priority)
Selected from the environment dropdown (local scope). Workspace-specific, stored in .openpost/environments.json.
Conflict Resolution
When the same variable name exists in multiple sources, the highest priority source wins silently. This is by design — it enables intentional overrides without disrupting workflows.
{{var}} in the editor to see which source provided the valueExamples
Example 1: Development override
Variable: {{base_url}}
During development, local env overrides the production URL without changing the collection.
Example 2: Test key override
Variable: {{api_key}}
Local env overrides the vault production key with a test key for local testing.
Example 3: No conflict
Variable: {{version}}
When only one source defines the variable, that value is used directly.
Full resolution table
| Source | {{base_url}} | {{api_key}} | {{version}} |
|---|---|---|---|
| Collection Vars | https://api.example.com | — | v2 |
| Global Env | https://staging.example.com | — | — |
| Vault Secrets | — | sk-prod-abc123 | — |
| Local Env | http://localhost:3000 | sk-test-xyz789 | — |
| Resolved ✓ | http://localhost:3000 | sk-test-xyz789 | v2 |
For {{version}}, only collection vars defined it — so that value is used. For the others, local env wins.