Appearance
Path variables
Path variables let you keep a placeholder in the URL path, such as :userId, and set its value separately. They're handy when the same endpoint is called with different IDs.
Add a path variable
In the URL bar, type a path segment that starts with a colon, for example:
https://api.example.com/users/:userId/orders/:orderIdOpen the Params tab. A PATH VARIABLES table appears above QUERY PARAMETERS, with one row per variable:
userIdandorderId.Enter a Value for each row, for example
42. Add a Description if it helps your team.Save the request.
When you send the request, Collapy replaces each :name with its value:
https://api.example.com/users/42/orders/1001
How the table works
- The URL controls the rows. Adding
:nameto the URL adds a row; removing it from the URL removes the row. You can't add or delete rows in the table yourself. - The key is read-only. To rename a variable, change it in the URL. A renamed variable starts with an empty value.
- Values are kept while you edit. Editing other parts of the URL doesn't clear the values of variables that are still there.
- The same name twice in a URL gives one row, and both places get the same value.
- If a variable has no value, the
:nametext is sent as it is.
Naming rules
A path variable must:
- start a path segment — directly after a
/, - start with a letter or underscore, followed by letters, digits or underscores.
/users/:userId and /items/:item_id are path variables. https:// isn't, and a colon inside a query string (after ?) isn't either.
Use environment variables in values
A path variable's value can contain {{variables}} from the active environment, for example {{currentUserId}}. Collapy resolves it when you send the request, then puts the result into the URL. Type {{ in the Value field to get suggestions.
To check the final URL before sending, press and hold the eye button in the toolbar or hold Ctrl+E (Cmd+E on macOS). The URL bar shows the resolved values highlighted.
FAQ
Can I use the {param} style from OpenAPI?
Not in the URL bar — Collapy recognises the :name style only. When you import an OpenAPI spec, /users/{id} is converted to /users/:id for you. See Import an OpenAPI spec.
Do path variables count toward the Params badge?
Yes. The number on the Params tab counts both query parameters and path variables.
