# Copy the request URL to the clipboard

**URL:** <https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367>\
**Category:** Help Hub\
**Created:** [March 16, 2020, 9:25am UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367 "2020-03-16T09:25:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pokrakam](https://avatars.discourse-cdn.com/v4/letter/p/ea5d25/32.png) [@pokrakam](https://community.postman.com/u/pokrakam)\
**Post date:** [March 16, 2020, 9:25am UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/1 "2020-03-16T09:25:50Z")

</div>

I’m using a URL with several variables, and would like to see the full URL that is sent to the server. The main point is for sharing with non-Postman users, such as copy/paste a working example to an email so someone else can just open it in their browser.

i.e. my PM request looks like this: http://{{host}}/my/service({{ref}})?p1={{p1}}  
But I want to get the full URL:  
[http://my.server/my/service(foo)?p1=bar](http://my.server/my/service(foo)?p1=bar)

Yes I can copy/paste and manually fill in the variables, but that get a bit tedious after a while. So I was hoping for an ‘expanded URL’ link or something. This sounds like an obvious feature but I can’t find it in the app nor the forums.

Any help appreciated.

---

<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 16, 2020, 11:38am UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/2 "2020-03-16T11:38:21Z")

</div>

Hey @pokrakam

Welcome to the community! 👋

You could add `console.log(pm.request.url.toString());` to the Tests sandbox. This will print the whole _resolved_ URL in the Postman Console.

---

<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 16, 2020, 12:08pm UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/3 "2020-03-16T12:08:47Z")

</div>

If you didn’t want to keep going to the Postman Console, you could have a go with this? Add this template to the Tests tab and it should show the URL and give you a “copy to clipboard” button in the Visualizer. 😄

 ![URL_Copy](https://us1.discourse-cdn.com/getpostman/original/2X/e/e9c96cfd1cb7306df32b7012805463659640418b.gif)

```
let resolvedURL = pm.request.url.toString();

let template = `
<html>
<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
</head>
<body>
    <div>
    <div>
        <pre><code style="width:max-content!important;" id="copyText">${resolvedURL}</code></pre>
    </div>
    <button class="copyButton" type="button" data-clipboard-action="copy" data-clipboard-target="#copyText" style="background:green;color:white;">Copy to Clipboard</button>
    </div>
</body>
</html>
<script>
    var clipboard = new ClipboardJS('.copyButton');

    clipboard.on('success', function(e) {
        e.clearSelection();
        e.trigger.textContent = '✔ Copied!';
        window.setTimeout(function() {
            e.trigger.textContent = 'Copy to Clipboard';
        }, 2000);
    });
    clipboard.on('error', function(e) {
        e.clearSelection();
        e.trigger.textContent = '✗ Not Copied';
        window.setTimeout(function() {
            e.trigger.textContent = 'Copy to Clipboard';
        }, 2000);
    });

</script>`

pm.visualizer.set(template, pm.response.json())

```

---

<div class="post-metadata">

**Author:** ![pokrakam](https://avatars.discourse-cdn.com/v4/letter/p/ea5d25/32.png) [@pokrakam](https://community.postman.com/u/pokrakam)\
**Post date:** [March 16, 2020, 6:33pm UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/4 "2020-03-16T18:33:42Z")

</div>

Hi @danny-dainton  
I was happy with the console bit, but this is really neat, thanks! 👍  
I am quite surprised this hasn’t been in PM to start with, seems like something obvious folks might want to do.

---

<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 16, 2020, 6:49pm UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/5 "2020-03-16T18:49:04Z")

</div>

You’re very welcome.😁

---

<div class="post-metadata">

**Author:** ![pokrakam](https://avatars.discourse-cdn.com/v4/letter/p/ea5d25/32.png) [@pokrakam](https://community.postman.com/u/pokrakam)\
**Post date:** [March 17, 2020, 4:46pm UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/6 "2020-03-17T16:46:27Z")

</div>

Just in case anyone is interested, I just found a third option:  
Open the collection via the web rather than the app and you get the expanded URL and even a nice multi-language code template. So I can work in the app, and just refresh the page if I want the URLs for all my requests.

---

<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 17, 2020, 5:38pm UTC](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/7 "2020-03-17T17:38:53Z")

</div>

You can also get those same code snippets from the app:

 ![Code_Snippets](https://us1.discourse-cdn.com/getpostman/original/3X/5/4/54cac225c4fb0bb75dbdf1379cc5ef44caed35bd.gif)
