# Is there a way to retrieve a URL with environment variables resolved?

**URL:** <https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153>\
**Category:** Help Hub\
**Tags:** variables, environment\
**Created:** [March 9, 2021, 9:04am UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153 "2021-03-09T09:04:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hfhInventio](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@hfhInventio](https://community.postman.com/u/hfhInventio)\
**Post date:** [March 9, 2021, 9:04am UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/1 "2021-03-09T09:04:22Z")

</div>

We have a ton of requests and all of them have the same format. All of them contain environment variables but its a pain when you want to send the URL of a request to someone else because you have to manually replace all the variables with values from the selected environment.

Is there a way to easily copy the URL of a request with environment variables resolved based on the currently selected environment?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [March 9, 2021, 10:32am UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/2 "2021-03-09T10:32:31Z")

</div>

Could you send them a curl request using the code snippets? If the environment is selected it will show the resolved variables.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/7/47a34cac6912802bd1ab4161be8f86edb6481878.png)

If you’re working in a Team Workspace, you could also share the environment to that workspace for them to use. They would have the environment file so the variables would be resolved when it’s active.

---

<div class="post-metadata">

**Author:** ![hfhInventio](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@hfhInventio](https://community.postman.com/u/hfhInventio)\
**Post date:** [March 9, 2021, 12:45pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/3 "2021-03-09T12:45:06Z")

</div>

I dont have to send them the whole curl. I can just copy the resolved URL from there and send it to them. This works. I’d like a button for this in the textbox of the URL but this does work better than having to fabricate it manually.

It is already a shared workspace but they dont use postman.

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [March 9, 2021, 12:53pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/4 "2021-03-09T12:53:05Z")

</div>

`console.log(pm.variables.replaceIn(pm.request.url.toString()))`

add this to your pre-request script and now you can copy the resolved url from postman console

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [March 9, 2021, 12:55pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/5 "2021-03-09T12:55:14Z")

</div>

Hi @praveendvd,

In this case, we might need to actually trigger the request to see the output in postman console.

---

<div class="post-metadata">

**Author:** ![hfhInventio](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@hfhInventio](https://community.postman.com/u/hfhInventio)\
**Post date:** [March 9, 2021, 12:56pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/6 "2021-03-09T12:56:12Z")

</div>

Where do I actually find the console this will be written to?

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [March 9, 2021, 12:58pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/7 "2021-03-09T12:58:44Z")

</div>

![image](https://us1.discourse-cdn.com/getpostman/original/3X/2/0/2086c63260d9ab24ac82d789e8608303b8f76bd5.png)

on the bottom left corner or view\>show postman console (alt+ctrl+c)

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [March 9, 2021, 12:59pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/8 "2021-03-09T12:59:41Z")

</div>

sorry yes my mistake 😃 then you could simply copy the resolved url from the request 😃

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [March 9, 2021, 1:00pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/9 "2021-03-09T13:00:34Z")

</div>

in console you can copy the resolved request as it is don’t need to print it as @pranavdavar mentioned , 😃

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [March 9, 2021, 1:04pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/10 "2021-03-09T13:04:42Z")

</div>

Yes and as @danny-dainton mentioned copying from curl is the best way to extract the request url, I believe. 🙂

---

<div class="post-metadata">

**Author:** ![hfhInventio](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@hfhInventio](https://community.postman.com/u/hfhInventio)\
**Post date:** [March 9, 2021, 1:05pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/11 "2021-03-09T13:05:15Z")

</div>

Yes. The console already shows the resolved URLS for all requests executed. That is neat.

I’ve submitted an issue at the github to make it easier to get the resolved URL by maybe a button in the url textbox. That would be allot easier.

Thanks you guys.

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [March 9, 2021, 1:17pm UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/12 "2021-03-09T13:17:19Z")

</div>

yes in all code snippets the variables are shown after resolving

---

<div class="post-metadata">

**Author:** ![cpandya23](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@cpandya23](https://community.postman.com/u/cpandya23)\
**Post date:** [December 31, 2021, 5:43am UTC](https://community.postman.com/t/is-there-a-way-to-retrieve-a-url-with-environment-variables-resolved/21153/13 "2021-12-31T05:43:17Z")

</div>

Hi @hfhInventio , but wouldn’t it be better if we can just copy the url by right clicking on the text box?  
Maybe adding an option of **Copy with env variables**?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/9/e98ef58bdbc2d4333604da78198fb3e7361fdb71.png)
