Variable scopes
Scopes
Section titled “Scopes”A name is looked up in five scopes; when the same name exists in several, the later one in this list wins:
- Globals — Environments → Globals, plus values scripts write with
pm.globals.set(...)orpm.variables.set(...). - Collection variables — defaults saved with the collection.
- Active environment variables — the selected environment for the workspace.
- Request variables — the request’s Vars tab.
- Data row — the current row of a data file in the Collection Runner or
kurlo run --data.
If nothing matches, the literal {{name}} is left untouched so the unresolved template is visible.
A name may contain any character except { and } — letters from any alphabet, spaces and colons included — and spaces around it are ignored, so {{токен}}, {{api key}} and {{ token }} all work.
Values written by a pre-request script
Section titled “Values written by a pre-request script”A pre-request script runs before the templates are filled in for good. When it stores a value — pm.environment.set("token", ...), pm.collectionVariables.set(...), pm.globals.set(...) — every {{token}} in the same request already uses the new value. The script itself still sees the request as it was resolved before it ran, and edits it makes through pm.request are kept.
Variables built from other variables
Section titled “Variables built from other variables”A value may itself contain {{...}}, and Kurlo keeps resolving until nothing changes:
scheme = httpshost = api.example.combaseUrl = {{scheme}}://{{host}}A request pointed at {{baseUrl}}/users goes to https://api.example.com/users. This is the usual way to keep one place to edit when a whole collection moves to staging.
Resolution stops after 20 rounds. A chain that refers back to itself — a = {{b}}, b = {{a}} — keeps its braces rather than looping, so the send fails with an unresolved-variable message pointing at the real culprit.