# Can we use pm.environment.set() and after that refers the value when run the collection using newman?

**URL:** <https://community.postman.com/t/can-we-use-pm-environment-set-and-after-that-refers-the-value-when-run-the-collection-using-newman/24505>\
**Category:** Help Hub\
**Tags:** newman-project\
**Created:** [June 4, 2021, 7:48am UTC](https://community.postman.com/t/can-we-use-pm-environment-set-and-after-that-refers-the-value-when-run-the-collection-using-newman/24505 "2021-06-04T07:48:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hariyaditeguh99](https://avatars.discourse-cdn.com/v4/letter/h/f08c70/32.png) [@hariyaditeguh99](https://community.postman.com/u/hariyaditeguh99)\
**Post date:** [June 4, 2021, 7:48am UTC](https://community.postman.com/t/can-we-use-pm-environment-set-and-after-that-refers-the-value-when-run-the-collection-using-newman/24505/1 "2021-06-04T07:48:08Z")

</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).

can we use pm.environment.set() and after that use the value when run the collection using newman?

I have case to collect access token response value from login request, then save the value to the environment variable, after that use it for authorization in the next request (run in newman), is it possible?

---

<div class="post-metadata">

**Author:** ![hannah.neil](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hannah.neil/32/4477_2.png) [@hannah.neil](https://community.postman.com/u/hannah.neil)\
**Post date:** [June 5, 2021, 1:44am UTC](https://community.postman.com/t/can-we-use-pm-environment-set-and-after-that-refers-the-value-when-run-the-collection-using-newman/24505/2 "2021-06-05T01:44:24Z")

</div>

Hey @hariyaditeguh99 - welcome to the community!

I’m moving this post to Help for tidiness and visibility.

[Does this post](https://community.postman.com/t/how-can-we-send-environment-variable-value-while-running-through-newman/22132) answer your question?
