Variables
With the release of v1.28.0, we’ve shifted to treating all Request Variables as strings instead of inferring the data type from the value. See discussion for more information.
Overview
Variables in the Bruno allow you to store dynamic values that can be reused across multiple API requests, environments, and workflows. This feature enhances flexibility, maintainability, and efficiency by enabling you to manage frequently changing data points such as tokens, environment-specific URLs, or user-defined values in one place.
Types
There are 6 types of variables you can create:
- Global Environments Variables
- Environment Variables
- Collection Variables
- Folder Variables
- Request Variables
- Runtime Variables
Additionally, Process Environment Variables can be defined in an external environment configuration file:
Variable Precedence
When a variable is accessed, the following precedence is used to determine which value is used:
- Runtime Variables
- Request Variables
- Folder Variables
- Environment Variables
- Collection Variables
- Global Variables
Runtime variables get the highest precedence. Process Environment Variables are accessed using the {{process.env.VAR_NAME}}
syntax and hence don’t compete with the above.
Variable Data Type
All variables are stored as strings. Bruno does not infer or change the data type of the variable based on the value you set.
Scripting API
Please see the Scripting API for more information on how to access variables in your scripts.