Loops, Wait and sub-workflows
You rarely need to build a loop in n8n. Nodes automatically run over every incoming item: five items into a Slack node means five messages. The most common beginner mistake is building loops by hand without knowing this.
An explicit loop is only needed in a few cases:
- Loop Over Items — splitting items into batches and processing each batch separately. It is the main tool for staying within API rate limits. Set Batch Size = 1 when each item must be handled on its own.
- Pagination — with the HTTP Request node you have to build the loop yourself to walk through a paginated response
- Repeat until a condition holds — connect a node's output back to an earlier node's input and stop it with an IF
If you want a node to work on only the first item, no loop is needed — turning on Execute Once in the node's Settings tab is enough.
| Tool | What for | Watch out for |
|---|---|---|
| Automatic iteration | The node runs once per item — nothing to build | Some nodes are exceptions (the Code node in "Run Once for All Items" mode, for one) |
| Loop Over Items | Batching; staying inside API rate limits | The node stops itself once every batch is processed — no IF needed |
| Wait | Waiting for a duration or until a point in time | For rate limits, the wait goes between batches |
| Execute Sub-workflow | Extracting logic into a separate workflow and reusing it | If the sub-workflow has errors, the parent cannot trigger it |
| Merge | Combining branches or streams from different sources | Choose the right mode (append vs a join key) |
A sub-workflow is a separate workflow called by another one. It is built from a pair of nodes: Execute Sub-workflow on the calling side and the Execute Sub-workflow Trigger on the called side (it also appears in node search as "When Executed by Another Workflow").
The called workflow accepts incoming data in one of three modes:
- Define using fields below — you declare the expected field names and types; the calling node picks them up automatically
- Define using JSON example — you supply an example object showing the expected shape
- Accept all data — no requirements at all; the sub-workflow must handle any inconsistency itself
Sub-workflows solve three problems: reuse (the same logic in several places), readability (splitting a huge canvas) and memory (reducing the memory pressure of one enormous workflow). They are also the only form of "your own logic" that can be handed to an AI agent as a tool.
Sub-workflow executions do not count towards a plan's monthly execution limit or active-workflow limit. That makes splitting logic into small modules economical on n8n Cloud too — the split does not raise the bill.
📚 Sources and documentation
- Loopofficialdocs.n8n.io
Also carries the official list of nodes where automatic iteration does not apply.
- Break workflows into smaller partsofficialdocs.n8n.io
- Loop Over Items (Split in Batches) nodeofficialdocs.n8n.io
- Merge dataofficialdocs.n8n.io