Introduce a new Variable Scope - Folder Variable

Hi, I have a use case where I have an API collection that was used for one product (Assume product A). Inside the API collections, there are finer categorization of different API calls categorized by their subpaths as follows:

where each subpath is categorized by the folders shown in screenshot below.

Each folder in the API collection is referring to a different microservice, and they would have different subpaths, eg.


As a user, i also have a lot of other API collections for other products, so it would be best (if possible) if i do not use different API collections for different microservices, since they are all related to a single product in this case.

Hence, imo, it would be best if there’s a finer variable management at folder level as well, so that users can use Collections for storing product based APIs and Folder for storing microservices based APIs.

This already exists, unless I misunderstand your question.

You can set your url for each endpoint to something like


Then, right click on the folder, click on Edit and then in the Pre-Request tab, add this code:

pm.globals.set(“FolderName”, “Auth”); // (or whatever the folder name is).

Do this Pre-Request add for each of your folders, setting the var to the Folder’s name.

Poof. Done.


Thanks @wendy.cook . I just tried this and it seems to work. But i am curious if this means that if the {{FolderName}} needs to be an unique name, because you’re setting this as global variable and if I’m having the same FolderName for different Product, would the variable will be able to resolve correctly.


Alright, seems that everytime you run an API from a folder, the Pre-request scripts will always get triggered and this will overwrite the last known global {{FolderName}} variable set. This allows {{FolderName}} to be a non-unique name and can be re-used on some other collections as well.

Thanks for the wonderful tips.