How to call an API before executing another API call

I need to execute an API for that i need to pass Authorization token every time. so how can i write pre-requisite script which does the token API call and then it sets as environment variable. So that i can use token where ever i need in the APi.

Note:- Token API call is a POST method.

Hello @Vineeth0696, welcome to the community! :wave:

You can use pm.sendRequest feature in the pre-request script.
So you make the call using pm.sendRequest and then store the value in the environment variable.

Then the main request will be executed and it’ll take up the token value from the environment