View and edit variables
Use the variables pane to view and edit the variables and vault secrets a Postman element uses and can access. With the variables pane, you can edit your variables and vault secrets in one location. You won’t have to locate and update every variable in each scope and vault secret in your Postman Vault.
To access the variables pane, open a Postman element, then click Variables in the upper-right of the workbench. The variables pane opens on the right where you can view the following:
- Variables in request — View and edit your local value of variables and vault secrets referenced in a request. This also shows variables without a scope that are referenced in your request.
- All variables — View and edit your local value of variables and vault secrets that are available from your Postman elements, such as a request or collection. For example, if you have a request open, this might show variables defined in the active environment that you could choose to reference in the request.
You can also hover over a reference to a variable or vault secret, then click Variables in request or All variables to open the variables pane.
Variables set as secure are encrypted and masked by default.
Variables used in a request
To view variables and vault secrets used in a request, click Variables in the workbench to open the variables pane. The variables under Variables in request are defined at the environment, collection, or global variable scopes and show your local value. This also shows vault secrets stored in your Postman Vault.
You can edit your local value of a variable or vault secret that’s referenced in a request. Open the variables pane, delete the existing value next to a variable or vault secret, then enter a new value.
You can also hover over the reference to the variable or vault secret, delete the existing value, then enter a new value.
If the request auth is set to Inherit auth from parent, you can view variables and vault secrets in the variables pane that are used in the Authorization tab of the request’s parent collection or folder. Learn more about inheriting authorization from a parent element.
Access variables from an element
Under All variables in the variables pane, you can view and update variables and vault secrets that are available from your Postman elements. For requests that reference a variable or vault secret, select All variables to display all variables and vault secrets a request can access. Variables and vault secrets in this section can be referenced and resolved in the element that’s open.
You can edit your local value of a variable or vault secret that’s available from an element. Click Variables to open the variables pane, delete the existing value next to a variable or vault secret, then enter a new value.
You can also take the following actions to update the variables and vault secrets from the variables pane:
- If an environment isn’t selected, click Select environment to choose an environment from the environment selector.
- If there are no variables defined in the selected environment, associated collection, or globally in the workspace, click Add to open it in a new tab.
- If there are no vault secrets defined in your Postman Vault, click Add secrets to open your Postman Vault in a new tab.
Fixing empty variables
An empty variable is a variable that’s referenced in a request but doesn’t have a value. For example, Postman expects to find a value for {{cust_id}} in the https://postman-echo.com/get?customer_id={{cust_id}} request. If Postman doesn’t find a value for the variable, it’s flagged as an empty variable and the request may fail when you send it.
A variable can be empty for the following reasons:
- The variable was created, but no value was added to it.
- The environment that has the variable isn’t active.
- The variable is turned off in the respective collection, active environment, or globals.
- The variable doesn’t have a scope, and a value hasn’t been added to it.
A vault secret can also be empty if it’s missing a value and is referenced in a request. Learn how to fix empty vault secrets.
When you’re working on an API request, Postman highlights empty variables in the URL builder and in the Params, Authorization, and Headers tabs. Postman highlights empty variable text in red. If your request has an empty variable, a red mark displays on Variables in the upper right of the workbench.
To view empty variables referenced in a request, do the following:
- Open a request with empty variables, then click
Variables.
- Under Variables in request, review the variables without values.
To check if the variable exists and is available from the request, do the following:
- Select the collection in the sidebar that’s associated with the request, then click the Variables tab. You can also click Environments in the sidebar, then select Globals or one of the environments.
- Turn on the variable, make the necessary changes to the value of the variable, or make the correct environment active.
Learn more about viewing and editing variables in an element.
From a request, you can set local variables programmatically in a pre-request script using pm.variables.set. When the variable is also referenced in the request, it’ll display as Resolved via script in the variables pane. Environment, global, and collection variables set programmatically (for example, pm.environment.set) are saved for later use at their respective scope. If you experience issues referencing a variable set programmatically, debug your requests with the Postman Console.