# Iterate over iteration/collection (i.e. loop over a loop)?

**URL:** <https://community.postman.com/t/iterate-over-iteration-collection-i-e-loop-over-a-loop/36656>\
**Category:** Help Hub\
**Tags:** tests, collections, chain\
**Created:** [June 28, 2022, 4:29pm UTC](https://community.postman.com/t/iterate-over-iteration-collection-i-e-loop-over-a-loop/36656 "2022-06-28T16:29:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattyoungblood](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@mattyoungblood](https://community.postman.com/u/mattyoungblood)\
**Post date:** [June 28, 2022, 4:29pm UTC](https://community.postman.com/t/iterate-over-iteration-collection-i-e-loop-over-a-loop/36656/1 "2022-06-28T16:29:44Z")

</div>

Is it possible to set up Postman to loop over a loop?

I have a collection established that uses a data file to iterate over a series of IDs (roughly 100 or so). These IDs are used with the API endpoints in my collection. A user ID is targeted at the beginning of the collection run through a collection variable, followed by Postman iterating over the IDs in the data file.

The general idea is that the collection takes care of associating a series of data relationships with a specific user, rather than establishing these relationships one-at-a-time using the platform’s UI.

I’d like to take this one step further and be able to target multiple users instead of one-at-a-time. In other words, multiple user IDs would be identified on the front-end, followed by looping over each one, to then loop through the 100 IDs/endpoints already established in the collection.

---

<div class="post-metadata">

**Author:** ![sseenivasan89](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/sseenivasan89/32/8350_2.png) [@sseenivasan89](https://community.postman.com/u/sseenivasan89)\
**Post date:** [July 4, 2022, 10:00am UTC](https://community.postman.com/t/iterate-over-iteration-collection-i-e-loop-over-a-loop/36656/2 "2022-07-04T10:00:26Z")

</div>

Hi @mattyoungblood

Do you want to iterate the collections folder ? or only the requests that inside the collection ?

---

<div class="post-metadata">

**Author:** ![altimetry-observer-1](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@altimetry-observer-1](https://community.postman.com/u/altimetry-observer-1)\
**Post date:** [July 4, 2022, 12:21pm UTC](https://community.postman.com/t/iterate-over-iteration-collection-i-e-loop-over-a-loop/36656/3 "2022-07-04T12:21:40Z")

</div>

If you want to run the API one after the other in an iterative manner,

1. You can add that API to a collection. Export the collection as a .json file
2. Then you can use the Newman utility of Postman to iterate it as many times as you want for more information you can refer this page

[Running collections on the command line with Newman | Postman Learning Center](https://learning.postman.com/docs/running-collections/using-newman-cli/command-line-integration-with-newman/#:~:text=Newman%20is%20a%20command%2Dline,integration%20servers%20and%20build%20systems).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [December 12, 2024, 12:54pm UTC](https://community.postman.com/t/iterate-over-iteration-collection-i-e-loop-over-a-loop/36656/4 "2024-12-12T12:54:13Z")

</div>

Closed on December 12, 2024, 12:54pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
