loop node iterates over data, executing a set of nodes for each iteration. It supports three modes: iterating over arrays, running a fixed count, or looping while a condition is true.
Configuration
Config Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
items | string | * | - | Template resolving to an array |
count | number/string | * | - | Number of iterations or template |
while | string | * | - | Condition to check each iteration |
max | number | ** | - | Maximum iterations (required for while) |
as | string | No | "item" | Variable name for current item |
index | string | No | "index" | Variable name for current index |
do | string[] | Yes | - | Node IDs to execute each iteration |
concurrent | boolean | No | false | Run iterations in parallel |
items, count, or while
** Required when using while mode
Loop Modes
Items Mode
Iterate over an array:{{user}}- Current array element{{i}}- Current index (0-based)
Count Mode
Run a fixed number of times:While Mode
Loop while a condition is true:max field is required to prevent infinite loops.
Output
| Field | Type | Description |
|---|---|---|
iterations | number | Total iterations completed |
results | array | Output from each iteration |
completed | boolean | Whether loop finished normally |
error | string | Error message if loop failed |
Context Variables
During each iteration, these variables are available:| Variable | Description |
|---|---|
{{item}} (or custom as) | Current item (items mode) or iteration number (count mode) |
{{index}} (or custom name) | Zero-based iteration index |
Example Access
Examples
Process Array Items
Concurrent Processing
Process items in parallel for better performance:Pagination Loop
Fetch all pages from a paginated API:Retry Pattern
Retry a request up to 3 times:Accessing Loop Results
After the loop, access results by index:Nested Data Access
When iterating over objects with nested data:process_user:
Performance Considerations
- Use
concurrent: truefor independent operations - Set reasonable
maxfor while loops to prevent runaway execution - Batch operations when possible instead of individual API calls
- Limit iterations - very large loops can impact performance
Related
- Parallel Node - Run fixed branches concurrently
- Transform Node - Process array data with pipes