# How to specify environment URL when running collections

**URL:** <https://community.postman.com/t/how-to-specify-environment-url-when-running-collections/58114>\
**Category:** Help Hub\
**Tags:** collections\
**Created:** [February 26, 2024, 9:07am UTC](https://community.postman.com/t/how-to-specify-environment-url-when-running-collections/58114 "2024-02-26T09:07:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dids-reyes](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@dids-reyes](https://community.postman.com/u/dids-reyes)\
**Post date:** [February 26, 2024, 9:07am UTC](https://community.postman.com/t/how-to-specify-environment-url-when-running-collections/58114/1 "2024-02-26T09:07:50Z")

</div>

I can run collections using URL by doing this:

```auto
newman run https://api.postman.com/collections/myCollectionId?apikey=PMAK-myPostmanApiKey

```

I just need to get the collection ID and my Postman Api key

but how can i use my env named **Dev** without exporting it to JSON?

```-e
newman run collectionURL -e https://api.postman.com/environments/myCollectionId?apikey=PMAK-myPostmanApiKey

```

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 26, 2024, 10:33am UTC](https://community.postman.com/t/how-to-specify-environment-url-when-running-collections/58114/2 "2024-02-26T10:33:50Z")

</div>

You can’t as far as I’m aware. If you want to include an environment, you need to use the appropriate command line switch.

The Cloud Hosted Postman CLI will allow you to read your environment without exporting it, but the job will run from the Postman Cloud.

You could potentially call the Postman API to get the environment details as part of your pipeline.

[Manage Your Postman Environments with the Postman API | Postman Blog](https://blog.postman.com/manage-your-postman-environments-with-the-postman-api/)

---

<div class="post-metadata">

**Author:** ![dids-reyes](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@dids-reyes](https://community.postman.com/u/dids-reyes)\
**Post date:** [February 27, 2024, 2:36am UTC](https://community.postman.com/t/how-to-specify-environment-url-when-running-collections/58114/3 "2024-02-27T02:36:17Z")

</div>

Thanks @michaelderekjones

actually it works, i somehow mistyped a key in my environment id yesterday.

> <https://stackoverflow.com/questions/46460302/how-to-get-postman-environment-and-postman-globals-urls-for-passing-to-newman/50418567#50418567>

both `https://api.postman.com/` and `https://api.getpostman.com/` works too

```auto
newman run https://api.postman.com/collections/${api_collection_id}?apikey=${pm_key} -e https://api.getpostman.com/environments/${api_dev_environment_id}?apikey=${pm_key} --verbose -r cli,json --reporter-cli-show-timestamps

```

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [March 28, 2024, 2:36am UTC](https://community.postman.com/t/how-to-specify-environment-url-when-running-collections/58114/4 "2024-03-28T02:36:20Z")

</div>

Closed on March 28, 2024, 2:36am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
