Reuse data with variables and environments in Postman

A variable is a reusable value you can use in API requests and test scripts. Postman will use the variable's current value when running a request or script. You can group variables in an environment to make it easier to change variable values based on your work context.

Variables quick start

To create and use a variable, do the following:

  1. Select the environment quick look icon Environment quick look icon in the workbench.

  2. Next to Globals, select Edit (or Add if no variables have been added yet).

  3. Add a variable named my_variable and give it an initial value of Hello.

  4. Select Save icon Save, then close the Globals tab.

  5. Open a new request tab and enter https://postman-echo.com/get?var={{my_variable}} as the URL. Hover over the variable name to inspect the variable's value and scope.

    View the variable value and scope
  6. Select Send and send the request. Inspect the response, which confirms that Postman sent the variable value to the API.

  7. Change the value in the environment quick look and send the request again.

To learn more about using variables in Postman, go to Store and reuse values using variables.

Create and switch environments

With environments, you can create sets of variables for the various types of work you do in Postman. For example, you might want to use different values when sending requests to a test server or a production server.

To get started, learn how to create and switch between environments In Postman. You can then add and edit variables in each environment. You can also use environments to collaborate with your team and share and manage sensitive data.

Last modified: 2024/02/07