Accessing global variables when running collection using Newman


I am using newman to run requests from a postman collection file. This file was created using the Postman export feature. Ex:

newman run “Tests.postman_collection.json”

I have created some global variables inside of Postman, and I call those in the GET request url. Ex:


This all works when I run from the Postman UI. But when I run from command line, it doesn’t replace “{{instance}}” with the global variable named “instance”. Is there another step I can take to make this work? Or, do I have to hard code the values in the exported collection file?

Thanks in advance!

Hi, @dcarva! Welcome.

Globals can be passed as a command line parameter, either as a JSON file path/URL (via --globals) or individually (via --global-var). See here:

1 Like

Thank you! That works for me.

1 Like

Hi, @dcarva,
can please share the step by step to run this, im facing same proble
i have more then 10 api and every api dependes on other api response.
its working when run using postman but not newman