# Use variable from response from POST in header GET request

**URL:** <https://community.postman.com/t/use-variable-from-response-from-post-in-header-get-request/11279>\
**Category:** Help Hub\
**Created:** [March 10, 2020, 2:31pm UTC](https://community.postman.com/t/use-variable-from-response-from-post-in-header-get-request/11279 "2020-03-10T14:31:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardkr](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@richardkr](https://community.postman.com/u/richardkr)\
**Post date:** [March 10, 2020, 2:31pm UTC](https://community.postman.com/t/use-variable-from-response-from-post-in-header-get-request/11279/1 "2020-03-10T14:31:35Z")

</div>

Hello,  
In my testcase i have a Post request, which returns a response with a header and body. In the response body there is a consentId - number which i have to use in the header of for my next GET request. I

What do i have 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 10, 2020, 6:14pm UTC](https://community.postman.com/t/use-variable-from-response-from-post-in-header-get-request/11279/2 "2020-03-10T18:14:54Z")

</div>

Hey @richardkr,

You can capture the value as a variable using a short script in the `Tests` tab:

```
pm.globals.set("consentId", pm.response.json().consentId)

```

This is assuming a very basic structured response so that reference to the value might be slightly different. I’ve used a global variable here but the same could be down using the other scopes.

Once you have that `consentId` value as the variable, you will be able to use it in your next request’s header using the `{{consentId}}` syntax.
