Loop
Iterate over an array of items one-by-one or in configurable batches with a safety cap on iterations.
The Loop node processes each item in an array sequentially. It supports item-by-item iteration and batch processing, with a configurable safety cap to prevent runaway loops.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
| sourcePath | string | Yes | Variable path to the array to iterate over (e.g., {{httpRequest_1.body.items}}). |
| itemVarName | string | No | Name of the variable that holds the current item inside the loop body. Defaults to item. |
| indexVarName | string | No | Name of the variable that holds the current index inside the loop body. Defaults to index. |
| batchSize | number | No | Process items in batches of this size. Set to 0 for item-by-item processing. Defaults to 0. |
| maxIterations | number | No | Safety cap to prevent infinite loops. Accepted range is 1 to 1000. Defaults to 100. |
Batch Mode
When batchSize is greater than zero, items are chunked into groups of the specified size. Each iteration receives a batch array instead of a single item. This is useful for bulk API calls that accept multiple records per request.
Safety Cap
The maxIterations value limits the number of source items that will be processed. If the source array contains more items than the cap, the excess items are silently skipped. The cap is hard-limited to 1000 regardless of the configured value.
Output
The Loop node has a single output handle (done) that fires after all iterations complete.
| Field | Type | Description |
|---|---|---|
| results | array | Array of processed items or batches. |
| iterationCount | number | Number of iterations that executed. |
| totalItems | number | Total number of items in the source array. |
| batchSize | number | Configured batch size. Only present when batching is active. |
| currentRunIndex | number | Zero-based index of the last iteration. |
| noItemsLeft | boolean | true when all source items were processed within the cap. |
Example
Process a list of users one at a time, sending each an email.
Source Array: {{httpRequest_1.body.users}}
Item Variable: user
Index Variable: i
Batch Size: 0
Max Iterations: 500Inside the loop body, reference {{loop_1.user.email}} to access the current user's email address.