Sharing Global Variables with Team?

I’ve figured out how to share environment templates with team members, but can’t seem to figure out a way to share global variables that are used in my collections tests.

Any help on this??


I don’t believe this is possible. (yet)
Looking at the Postman Pro API, there is no mention of Global variables

I could be wrong though :S

Well, it looks like the latest release this morning allows for setting variables at the collection level (which would do what I’m trying to do with global variables). I am able to set variables for the collection, but can’t seem to access that variable in the request.

example collection variable:
{ “click_report_version”: 12 }

example request

where uri and api_key are environment variables and completely accessible.

The builder, however, says that {{click_report_version}} is an unresolved variable. How am I supposed to be accessing collection level variables?


Works for me.

Here’s my collection which has one request

The collection just has one collection which hits:{{number}}

I’m also console logging the value of the “something” environment variable

I hit the request successfully after waiting 1 second (as expected) and “Here’s some text” was output to console :slight_smile:

1 Like

I would have updated my previous post, but since I’m a newbie, I think they limited my ability to reply, so I couldn’t even see my post until this morning.

Anyway, I would have updated with this.

It appears there is bug in the UI when it comes to using collection-level variables. In the above example, the UI complained (showed the variable in red and the hover stated it was an unresolved variable) about the collection-level variable but the actual request worked.

So my remaining question is, how do I access the collection-level variables programmatically, such as in a test. In a test I can access the global and environment variables using
getGlobalVariable(<foo>)|| getEnvironmentVariable(<bar>), but I haven’t found a way to get the collection variables this way.

Your example is definitely a work around, but you are simply using the collection’s pre-request scripts to set environment variables, you don’t seem to be actually using the collection variables.

– Oh… and clicking the “Learn more about collection variables” takes you to the “old” documentation about variables. I couldn’t seem to find any documentation that describes how to access collection-level variables programmatically.

From what I’ve heard from the Postman team they’ve “soft-released” this and will flesh it out further down the line with a blog post explaining this etc.
No idea why they’d add something like this with ZERO documentation or explanation.

If you:


You’ll get your environment and globals variables by their key/value pairs.
You’ll also see something named "execution"
If you expand this, you’ll see a “collectionVariables” object with an array named 'values’
Inside that you’ll see objects per “collectionVariable” you have configured.

I tried targeting this path in the Tests tab in Postman but got no luck :frowning:

Hopefully this helps others and maybe they can point us in the right direction how to call these “collection variables”

I didn’t even know these were classified as their own type, just thought it was a way to do perform actions across the board instead of using evals xD

Ahhh interesting… Didn’t realize this was a soft release.

In the meantime, your suggestion of using the collection’s pre-request scripts to set global or environment variables looks like it will work for now as a stop-gap.


Cool, can you confirm if it worked for you?
If so, I’ll share that solution with the rest of the Postman people :slight_smile:

Yep. Confirmed that this work around works. It isn’t the ideal solution, but will definitely hold up until they either “fix” this issue or get us some better documentation.

1 Like