# Sharing Global Variables with Team?

**URL:** <https://community.postman.com/t/sharing-global-variables-with-team/405>\
**Category:** Help Hub\
**Tags:** variables, team\
**Created:** [December 4, 2017, 11:43pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405 "2017-12-04T23:43:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![cakeeddy](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cakeeddy/32/156_2.png) [@cakeeddy](https://community.postman.com/u/cakeeddy)\
**Post date:** [December 4, 2017, 11:43pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/1 "2017-12-04T23:43:05Z")

</div>

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??

Thanks,  
Eddy

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [December 5, 2017, 4:29pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/2 "2017-12-05T16:29:50Z")

</div>

I don’t believe this is possible. (yet)  
Looking at the Postman Pro API, there is no mention of Global variables  
[https://docs.api.getpostman.com/](https://docs.api.getpostman.com/)

I could be wrong though :S

---

<div class="post-metadata">

**Author:** ![cakeeddy](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cakeeddy/32/156_2.png) [@cakeeddy](https://community.postman.com/u/cakeeddy)\
**Post date:** [December 6, 2017, 5:19am UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/3 "2017-12-06T05:19:34Z")

</div>

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**  
_http://{{uri}}/api/{{click\_report\_version}}/report?api\_key={{api\_key}_

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?

Eddy

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [December 6, 2017, 11:37am UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/4 "2017-12-06T11:37:00Z")

</div>

Works for me.

Here’s my collection which has one request

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/f/0fa7fa130393aa27044694aa7a55e07749ac4c2f.png)

The collection just has one collection which hits:

```auto
https://postman-echo.com/delay/{{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 🙂

---

<div class="post-metadata">

**Author:** ![cakeeddy](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cakeeddy/32/156_2.png) [@cakeeddy](https://community.postman.com/u/cakeeddy)\
**Post date:** [December 6, 2017, 4:14pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/5 "2017-12-06T16:14:40Z")

</div>

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.

 ![Capture](https://us1.discourse-cdn.com/getpostman/original/3X/1/2/1260e6c9653f59c65d1db1940806a63f8f27b055.jpeg)

– 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.

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [December 6, 2017, 4:36pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/7 "2017-12-06T16:36:19Z")

</div>

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:

```auto
console.log(postman);

```

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 ☹

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

---

<div class="post-metadata">

**Author:** ![cakeeddy](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cakeeddy/32/156_2.png) [@cakeeddy](https://community.postman.com/u/cakeeddy)\
**Post date:** [December 6, 2017, 4:47pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/8 "2017-12-06T16:47:56Z")

</div>

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.

👍

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [December 7, 2017, 11:46am UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/9 "2017-12-07T11:46:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cakeeddy](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cakeeddy/32/156_2.png) [@cakeeddy](https://community.postman.com/u/cakeeddy)\
**Post date:** [December 8, 2017, 6:59pm UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/10 "2017-12-08T18:59:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![technical-speciali10](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@technical-speciali10](https://community.postman.com/u/technical-speciali10)\
**Post date:** [May 17, 2025, 2:03am UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/11 "2025-05-17T02:03:31Z")

</div>

My problem is even weirder. I set a global variable for base\_url, but it seems that my request is only able to access collection-level variable, while the global one is not used.

But the global env description on postman proudly says: “Global variables for a workspace are a set of variables that are **always available within the scope** of that workspace.”  
What a joke.

---

<div class="post-metadata">

**Author:** ![technical-speciali10](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@technical-speciali10](https://community.postman.com/u/technical-speciali10)\
**Post date:** [May 17, 2025, 2:18am UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/12 "2025-05-17T02:18:27Z")

</div>

Ahh, now I’ve figured out how to solve this. The joke is, once I set a variable at the collection level which has the same name as one in the global env, I was forced to use variable at collection level, or I was indirectly prohibited to switch between them.  
Now all I have to do is to delete the variable at the collection level.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [May 17, 2025, 6:50am UTC](https://community.postman.com/t/sharing-global-variables-with-team/405/13 "2025-05-17T06:50:49Z")

</div>

That’s the way the variable scopes work when you have variables of the same name at different levels.

 ![17474645815962312820786172990428](https://us1.discourse-cdn.com/getpostman/original/3X/0/d/0d6bba962e99e42509d1d6daddaa9948b781b358.jpeg)

> If a variable with the same name is declared in two different scopes, the value stored in the variable with narrowest scope will be used. For example, if there is a “username” global variable and a “username” local variable, the local value is used when the request runs.

> **[Store and reuse values using variables | Postman Docs](https://learning.postman.com/docs/sending-requests/variables/variables/#variable-scopes)**
>
> Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.
