# How i can set a variable from URL that i request?

**URL:** <https://community.postman.com/t/how-i-can-set-a-variable-from-url-that-i-request/8276>\
**Category:** Help Hub\
**Created:** [October 10, 2019, 4:23am UTC](https://community.postman.com/t/how-i-can-set-a-variable-from-url-that-i-request/8276 "2019-10-10T04:23:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fxatp21](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@fxatp21](https://community.postman.com/u/fxatp21)\
**Post date:** [October 10, 2019, 4:23am UTC](https://community.postman.com/t/how-i-can-set-a-variable-from-url-that-i-request/8276/1 "2019-10-10T04:23:42Z")

</div>

Hello ,

I just add **API KEY** feature on my API, and now i got some problem to test my api key.  
To make API KEY i need a url that’s i request , is anyone can explain to me how i can set a variable from my request url ?

 ![111](https://us1.discourse-cdn.com/getpostman/original/3X/d/9/d9cb89970a9b5ffe1aeaf3e2a17e2c268ae9c8da.png)

---

<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:** [October 10, 2019, 6:46am UTC](https://community.postman.com/t/how-i-can-set-a-variable-from-url-that-i-request/8276/2 "2019-10-10T06:46:32Z")

</div>

Hey @fxatp21,

Welcome to the Postman Community!! 🌟

If you add this command to the `Tests` tab, it will save the Request URL as a global variable:

`pm.globals.set("requestURL", pm.request.url.toString())`

I’m unsure about _how_ you’re going to be using the value but at least you know that you can store it somewhere now 🙂

---

<div class="post-metadata">

**Author:** ![fxatp21](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@fxatp21](https://community.postman.com/u/fxatp21)\
**Post date:** [October 11, 2019, 8:32am UTC](https://community.postman.com/t/how-i-can-set-a-variable-from-url-that-i-request/8276/3 "2019-10-11T08:32:36Z")

</div>

THANK YOU, it’s work!

Now i just need to get and store on variable javascript.
