Loop
Runs the steps connected to its Body port once for each item of a list, then continues from the Completed port.
Properties
| Property | Required | Default | Description |
|---|---|---|---|
| Items | Yes | — | The list to iterate over: an array, or a dataset (large results of Parse CSV, Spreadsheet File, Transform or HTTP Request). Usually an expression, e.g. {{ $nodes['Get Users'].responseBody.users }} |
| Batch size | No | 1 | How many items each iteration receives (1–10000). With a batch size above 1, currentItem is an array of up to that many items |
Output ports
| Port | Runs |
|---|---|
body | Once per iteration. Everything reachable from this port is the loop body |
completed | Once, after the last iteration |
Inside the body
Body steps read the current iteration through the loop step's name:
| Field | Type | Description |
|---|---|---|
currentItem | Any | The current item — or, with a batch size above 1, an array of the items in this batch |
index | Number | Zero-based iteration number |
isFirst | Boolean | true on the first iteration |
isLast | Boolean | true on the last iteration |
totalCount | Number | Number of iterations (items ÷ batch size, rounded up) |
batchSize | Number | The batch size in use |
{{ $nodes['For Each User'].currentItem.email }}
{{ $nodes['For Each User'].index }}
Completed output
| Field | Type | Description |
|---|---|---|
TotalIterations | Number | How many iterations ran |
items | Array | The output of the body's last step from each iteration, in order (up to 1000 entries) |
items lets you collect per-item results without a separate aggregation step:
{
"TotalIterations": 3,
"items": [
{ "statusCode": 200, "responseBody": { "id": 1, "sent": true } },
{ "statusCode": 200, "responseBody": { "id": 2, "sent": true } },
{ "statusCode": 200, "responseBody": { "id": 3, "sent": true } }
]
}
Example
Send one request per user and report when done:
- Name the Loop step
For Each Userand set Items to{{ $nodes['Get Users'].responseBody.users }}. - Connect Body to an HTTP Request with the URL
https://api.example.com/users/{{ $nodes['For Each User'].currentItem.id }}/notify. - Connect Completed to the next step.
{{ $nodes['For Each User'].items }}holds every response.
To call a bulk API with 100 records per request instead, set Batch size to 100 and send
{{ $nodes['For Each User'].currentItem }} (an array) as the JSON body.
Nested loops
A Loop inside another loop's body runs its full set of iterations for every outer iteration. Each loop has its
own context, so inner body steps use the inner loop's name and can still read the outer loop's
currentItem.
Errors inside the body
Body steps support the normal error settings:
- Retries re-run just the failing step within the current iteration.
- With an error port, the failure is routed to the error branch and the loop moves on to the next iteration.
- A body step that fails without either setting fails the workflow run.
Large files
When Items is a dataset — for example {{ $nodes['Parse CSV'].rows }} for a large
CSV — the loop reads its rows from the file instead of holding the whole list in workflow state. currentItem has
the same shape as in a normal loop, so nothing else changes. This lets you loop over files with very many rows.
Normal lists work the same way behind the scenes: the list is read once when the loop starts, and each iteration reads only its own item (or batch), so long lists don't slow down as the loop goes on.
- Reading the file has the same time limit as a step (15 minutes by default). If it takes longer, the loop fails and says so; filter the rows first or split the file.
- Loops over large files can't use a file kept on your own workers ("Keep files on your workers") yet. The loop fails with a message naming the file; turn that setting off for the step that makes the file.
- Each iteration is a separate step, and every plan has a limit on steps per run. For files with many thousands of rows, set a Batch size so each iteration handles a batch of rows instead of one.
Notes
- With an empty list (or no Body connections) the body is skipped and Completed runs straight away with
TotalIterations: 0. - If Items isn't a list (for example a JSON string) the step fails. Parse it first with Parse JSON or Convert.