Reuse data with variables and environments in Postman

A variable is a reusable value you can use in API requests and 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 Environments in the sidebar, then select Globals.

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

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

  4. 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
  5. Select Send and send the request. Inspect the response, which confirms that Postman sent the variable value to the API.

  6. Select Variable list icon Variables in the workbench to open the variables pane.

  7. Under Variables in request, change the value of my_variable 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