# Collection with 2 requests (A and B), how to call A from B?

**URL:** <https://community.postman.com/t/collection-with-2-requests-a-and-b-how-to-call-a-from-b/29652>\
**Category:** Help Hub\
**Created:** [November 12, 2021, 5:03pm UTC](https://community.postman.com/t/collection-with-2-requests-a-and-b-how-to-call-a-from-b/29652 "2021-11-12T17:03:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neualex](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/neualex/32/10310_2.png) [@neualex](https://community.postman.com/u/neualex)\
**Post date:** [November 12, 2021, 5:03pm UTC](https://community.postman.com/t/collection-with-2-requests-a-and-b-how-to-call-a-from-b/29652/1 "2021-11-12T17:03:51Z")

</div>

I have a collection with 2 requests (A and B), how can I call A from B?

Request A gets a token and set the token to a collection variable.  
Request B makes a GET request against an API using the token collection variable set by request A.

I usually run A first, then run B.  
I tried the “Run collection” option, but I cannot see the API response when request B is run.

Other posts indicate to use Pre-request Script with complete JS scripts, but I just want to run an existing request on the collection.

---

<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:** [November 14, 2021, 11:37am UTC](https://community.postman.com/t/collection-with-2-requests-a-and-b-how-to-call-a-from-b/29652/2 "2021-11-14T11:37:11Z")

</div>

Hi @neualex,

Correct me if I am wrong. Do you want to use the token which you fetched in request A and use it in request B?

If so, then in the test script of request A, you can set the value of the token to a collection variable. And in request B use the variable in the request or in place of token value.

Hope this helps 🙂

---

<div class="post-metadata">

**Author:** ![neualex](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/neualex/32/10310_2.png) [@neualex](https://community.postman.com/u/neualex)\
**Post date:** [November 22, 2021, 1:01pm UTC](https://community.postman.com/t/collection-with-2-requests-a-and-b-how-to-call-a-from-b/29652/3 "2021-11-22T13:01:21Z")

</div>

Hi @pranavdavar,

Already doing what you suggest which is a 2-step process, here is what I’m trying to accomplish…

Under my Trustpilot collection, the “Get OAuth Token” request sets an environment variable for the received token, “AuthorizationToken”.

![image.png](https://support.postman.com/attachments/token/3Q0jQhUVXMHOICTtPCFCzx1a3/?name=image.png)

Then, I run “Get Reviews” request which uses this “AuthorizationToken” variable to properly execute this request.

![image.png](https://support.postman.com/attachments/token/Zt4XZJfkIyqum39JiZdUD3QOr/?name=image.png)

I always run “Get OAuth Token” request first, then “Get Reviews” request second.

Is it possible to call “Get OAuth Token” request from “Get Reviews” request using the “Pre-req” tab?

If yes, how?
