Appearance
Variables
Write {{name}} anywhere a request accepts text, and Collapy replaces it with that variable's value from the active environment when you send. For example, {{baseUrl}}/users/{{userId}} becomes https://api.example.com/users/42.
Syntax
- Wrap the variable's key in double curly braces:
{{apiToken}}. - Spaces inside the braces are ignored, so
{{ apiToken }}works the same as{{apiToken}}. - Keys are case-sensitive and must match the Key in the environment exactly.
- Values are inserted as-is. A value that contains
{{another}}isn't resolved a second time.
Where you can use variables
| Part of the request | What resolves |
|---|---|
| URL | Anywhere in the URL |
| Query params | Keys and values |
| Path variables | Values. See Path variables. |
| Headers | Keys and values |
| Auth | Bearer Token token, Basic Auth username and password, API Key key and value. See Authentication. |
| Body: Raw (JSON/Text) | Anywhere in the text |
| Body: Form Data and URL Encoded | Field keys and values |
A collection's auth can use variables too. They resolve when a request inherits that auth.
Insert a variable
Type {{ in any of the fields above and a list of the active environment's variables appears.
- Keep typing to filter the list.
- Use
↑/↓andEnterto insert a variable, or click it. - Press
Escto close the list.
If no environment is active, Collapy first asks you to Select Environment.
Variables are highlighted in the field so you can spot them.
Preview resolved values
To check what a request will actually send, press and hold the eye button in the request editor (Hold to preview resolved values (Ctrl+E)). You can also hold Ctrl+E (macOS: Cmd+E). While you hold it, every field shows its resolved value, with the substituted parts highlighted. Release to go back to the {{...}} view.
- The preview includes your per-request overrides (see below).
- Secret values show as dots.
- If no environment is active, the button is disabled and shows Select an environment to preview.
Unresolved variables
Collapy checks every variable before it sends a request:
- If a variable isn't defined in the active environment, the request isn't sent. You see
Unresolved variables: name1, name2. Check that these variables exist in the "<environment>" environment. - If the request uses variables but no environment is active, you see
This request uses environment variables but no environment is selected.
Add the missing variable to the environment, give it a per-request override, or switch to the right environment, then send again.
The REQUEST VARIABLES panel
The REQUEST VARIABLES panel lists every variable the open request uses, with its current value.
- Where it's used. A letter badge in front of each name shows where the variable appears: U (URL), Q (Query params), P (Path params), H (Headers), A (Auth) and B (Body). Hover over a badge to see the full name.
- Unresolved. A warning icon (Unresolved) and an
unresolvedplaceholder mark variables that the active environment doesn't define. - Secrets. Secret values show as dots, also while you type a new one.
- All variables. Expand this section to see the active environment's other variables, the ones this request doesn't use. Secret values show as dots.
Override a value for one request
You can try a different value without changing the environment for everyone:
- In REQUEST VARIABLES, click a variable's value and type a new one.
- Click away or press
Enter. A pencil icon (Local override) marks the variable.
The override applies only to this request, and only for you. It's saved on this device and stays in place when you switch environments. You can override an unresolved variable to make the request sendable.
To do something with an override, click the sync icon next to the value (Override actions):
| Action | Result |
|---|---|
| Update shared value | Saves the override as the variable's value in the active environment, so everyone gets it. The override is then removed. This isn't available for variables the environment doesn't define. For a secret variable, the value is saved to secure storage, like a secret you save in the environment. |
| Reset value | Removes the override and goes back to the environment's value, which is shown under the action. |
Secrets can't be overridden
Overrides don't apply to secret variables when you send. A secret always uses the value stored in the environment. In REQUEST VARIABLES, a secret's value is hidden, also while you type. To change the stored value from here, type the new value and choose Update shared value.
FAQ
Can a variable's value contain another variable?
No. Variables are resolved once. {{a}} whose value is {{b}} is sent literally as {{b}}.
Are there global or collection-level variables?
No. Variables come from the active environment, plus any per-request overrides you set.
