Setting it up
Drop a Loop node on the canvas and it appears as an empty container with a + inside it. That + adds the first step of the body; the handle on the container’s bottom edge is where the workflow continues once the loop is done. The inspector has one required choice — Repeat — and the field below it changes to match.
An empty list runs zero iterations and the workflow carries on — that is not an error.
Optional settings
Stop early when — a condition checked after every iteration. When it is true the loop ends. The iteration that satisfied it still counts and still contributes its result. Maximum iterations — a ceiling. While-loops default to100 if you leave it blank, since a condition that never goes false would otherwise run forever. Every mode is capped at 10,000 regardless.
If a step inside the loop fails —
Referencing data
Inside the loop body:
After the loop:
n3 stands for the loop’s own step id — replace it with yours. The inspector prints the right one for you.
To test how many results you have so far, use
{{ $count(n3.results) }}, not $exists(). JSONata treats an empty array as nothing, so $exists() on a loop that has not finished an iteration yet will mislead you.An iteration’s result is its last step’s output
Each entry inresults is whatever the final step of the body produced. If your body ends with a Wait step, you will get the wait’s output rather than the useful work before it — put the step whose output you want last.
Looking back at earlier iterations
Becauseresults is readable from inside the body, a step can use everything that came before it, not just the previous pass:
Waiting inside a loop
A Wait step inside the body suspends the whole run and resumes on the next iteration exactly where it left off — the item being processed and everything collected so far survive the pause. That makes while mode plus a Wait the way to poll something until it is ready:- Wait — pause between checks
- HTTP API — ask for the current status
- Loop condition —
{{ check_status.state != 'done' }}
Nesting
A loop can contain another loop. The inner one runs completely on each pass of the outer one, and starts collecting fresh results each time. In the outer loop’sresults, each entry is the inner loop’s summary — its results, iterations, and errors.
When to use it
Considerations
- Iterations are serial. Ten items each taking two seconds takes twenty seconds. For concurrency, use the Parallel step.
- Body step data holds the last iteration only. After the loop, a body step’s own output is whatever the final pass left. The full history is in
results. - The body must be self-contained. A step inside the loop cannot also be reachable from after it; the workflow will not save. Steps that repeat go in the container, steps that run once go after it.
- Output steps cannot go inside a loop. An Output step ends the workflow, which is ambiguous mid-iteration. Put it after the loop.
- A loop with no steps inside does nothing and the workflow continues — it will not fail the run.

