APIs with Valentine

Hands-on tutorials about learning how to use APIs, how to test them and much more.

Member-only story

Demystifying Postman Variables: HOW and WHEN to use Different Variable Scopes

7 min readMar 7, 2019

--

Variables are a very powerful feature of Postman. Not only it allows you to save and manage some repeating information (like URLs, authentication tokens or keys, and so on) but by using scripts, you can pass data from one request to the next thus creating some very advanced workflows. But they can also cause a lot of confusion and uncertainty.

✅ UPDATED in January 2021. All the information in this article is up-to-date.

I have documented how to use the Postman variables within scripts in the Postman Quick Reference Guide which you can view online or download a PDF.

Similar to many programming languages, Postman uses scopes when defining variables. Currently, the following scopes are available:

  • Global
  • Collection
  • Environment
  • Local
  • Data

Let's next try to understand what is the deal with these scopes, why they are needed, and when to use them.

So how does the variable scope affect me?

--

--

APIs with Valentine
APIs with Valentine

Published in APIs with Valentine

Hands-on tutorials about learning how to use APIs, how to test them and much more.

Valentin Despa
Valentin Despa

Written by Valentin Despa

Software developer, educator & overlander • GitLab Hero • AWS Community Builder • Postman Supernova • Imprint: http://vdespa.com/imprint