Chaining Requests with Scripts

What Is Request Chaining?

Request chaining means using data from one response - like an ID or a token - as input to a later request. This mirrors real workflows, such as logging in first and then using the returned token for subsequent calls.

Passing Data Between Requests

In the Tests tab of the first request, a value from the response can be stored with pm.environment.set("token", pm.response.json().token). The next request can then reference it as {{token}}.

Example Chain

StepAction
1Send login request, store auth token
2Send create-resource request using stored token
3Store the new resource ID
4Send get/update/delete request using the stored ID

Running Chains Automatically

The Collection Runner executes requests in order, so a full chain can be run end-to-end automatically, with each request supplying data to the next.

You've now covered authentication, variables, collaboration, scripting, and chaining - a complete foundation for real-world API testing with Postman.

Ready to master Postman API Testing Course?

Join Uncodemy's hands-on training and build real-world API testing skills with expert mentors.

Explore Course