# Pm.info.request.id returns partial ID

**URL:** <https://community.postman.com/t/pm-info-request-id-returns-partial-id/30905>\
**Category:** Help Hub\
**Created:** [December 21, 2021, 1:03pm UTC](https://community.postman.com/t/pm-info-request-id-returns-partial-id/30905 "2021-12-21T13:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [December 21, 2021, 1:03pm UTC](https://community.postman.com/t/pm-info-request-id-returns-partial-id/30905/1 "2021-12-21T13:03:00Z")

</div>

I’m trying to set the request ID as a variable. But when I use the;

`pm.info.requestId`

I only appear to get part of the ID back in the output. Am I missing something here?

 ![Untitled](https://us1.discourse-cdn.com/getpostman/original/3X/4/5/450951b9d9cffd3e9ed3cdf35a2c102e6febc3a2.png)

---

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [December 23, 2021, 11:13am UTC](https://community.postman.com/t/pm-info-request-id-returns-partial-id/30905/2 "2021-12-23T11:13:09Z")

</div>

Hey @w4dd325 👋

Seems like the first 8 digits are taken from the Collection ID,  
So, to match the Request ID and the returned value from ‘pm.info.requestId’  
you need to add part of Collection’s Id to the pm.info.requestId result.  
Here’s one way to do it.

```auto
let Request_id= pm.info.requestId
let Collection_id= //Enter the initial digits from Collection ID

//Final Request ID
console.log(Collection_id+'-'+Request_id)

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [December 23, 2021, 5:00pm UTC](https://community.postman.com/t/pm-info-request-id-returns-partial-id/30905/3 "2021-12-23T17:00:11Z")

</div>

Hi @bbahadur thank you for your reply… Interesting theory but I tried pulling the collection id using;

`console.log(pm.collectionVariables.id);`

But the values still don’t appear to line up.  
I could definitely hardcode the values like you suggested above, but I’d be interested to understand where the values are originally produced/stored.

---

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [December 24, 2021, 8:40am UTC](https://community.postman.com/t/pm-info-request-id-returns-partial-id/30905/4 "2021-12-24T08:40:53Z")

</div>

I don’t think you are pulling the right value,  
` pm.collectionVariables` refers to the variables inside the collection, but what is required is the Collection ID.

Take Postman API Collection for Example, down below is the Collection Variables of Postman API Collection.

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

To get the Collection ID, we check the ‘info’ tab on the right. (i within a circle)

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/8/38fa7018dbab809cd9bc7d5aa60adaf9a1f78c83.png)

I’m not aware how to retrieve The Collection ID by script, but for the moment you can try copying the ID from here.

Good luck 🙂
