# How can I run a collection with specified environment via Newman

**URL:** <https://community.postman.com/t/how-can-i-run-a-collection-with-specified-environment-via-newman/5744>\
**Category:** Help Hub\
**Tags:** newman-project, environments, collections, api\
**Created:** [June 4, 2019, 8:12am UTC](https://community.postman.com/t/how-can-i-run-a-collection-with-specified-environment-via-newman/5744 "2019-06-04T08:12:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sero.barseghyan](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sero.barseghyan](https://community.postman.com/u/sero.barseghyan)\
**Post date:** [June 4, 2019, 8:12am UTC](https://community.postman.com/t/how-can-i-run-a-collection-with-specified-environment-via-newman/5744/1 "2019-06-04T08:12:30Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

I have a collection for specified environment.  
How can I run that collection for that environment via Newman?

For example: In my collection I have this kind of requests:  
`{{url_production}}/streams/remove/{{private collection id}}.json?key{{json_key}}`

{{url\_production}} - environment  
{{private collection id}} - global  
{{json\_key}} - global

I have exported both the environment and the Collection JSON files but when I run the collection via Newman all cases are going to fail. (See the screenshot)  
How this will be done?

 ![Screenshot%20at%20Jun%2004%2012-04-34](https://us1.discourse-cdn.com/getpostman/original/2X/c/cafcf94c346810dad637dcb05281505e2f20a51c.png)

P.S the the values of globals which are mentioned in the url are generated by previous requests in the collection.  
How can we do with globals as well? I mean every time after sending the same request I should get different values of globals and this collection I need to run via Newman.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [June 4, 2019, 8:37am UTC](https://community.postman.com/t/how-can-i-run-a-collection-with-specified-environment-via-newman/5744/2 "2019-06-04T08:37:02Z")

</div>

It seems that the environment was not picked up by newman.

Are you sure you have specified it using --environment and that the path is correct?

---

<div class="post-metadata">

**Author:** ![tmccann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/tmccann/32/3550_2.png) [@tmccann](https://community.postman.com/u/tmccann)\
**Post date:** [June 4, 2019, 5:51pm UTC](https://community.postman.com/t/how-can-i-run-a-collection-with-specified-environment-via-newman/5744/3 "2019-06-04T17:51:12Z")

</div>

@sero.barseghyan As @vdespa mentioned you are either referencing your environment JSON file incorrectly or not at all.

Can you give us a sample of the command you are issuing so we can see the parameters you are passing?

Newman basically requires 2 parameters to be able to run. The Collection and the Environment, everything else is optional, so by the sounds of it you may just have a small config issue here.
