Split In Batches
Splits an array into individual items or batches for parallel or iterative processing.
Fans out an array: the engine runs the nodes connected to out once per item (or batch), then signals done with the item count.
This operator allows you to iterate over a list of items found in the input payload. For each item (or batch of items), it triggers the 'loop' output port. Once all items have been processed, it triggers the 'done' port.
Behavior:
- Iteration: Emits a message for each item/batch in the array.
- Context Preservation: Child executions inherit the parent context.
- Batching: Can group items into batches (e.g., size 10) for efficiency.
Use Cases:
- Processing a list of new users from a CSV.
- Sending emails to a segment of subscribers.
- Processing order line items individually.
How it works
- Resolves
path. A{{ }}that returns an array or object ({{ $json.items }}) is used as is; plain text is evaluated as JSONata against the payload (data.items); an emptypathuses the whole payload. - Recovers an object with numeric keys (
{ "0": {...}, "1": {...} }) as an array in key order; an empty object becomes[]. - Fails when the value is not an array.
- An empty array leaves directly through
donewith{}; nothing goes throughout. - Otherwise returns the array with
meta.splitandmeta.batch_size. The engine queues every node connected tooutonce per item (batch_size1) or per slice ofbatch_sizeitems, each with that item or slice as payload. - Then queues the nodes connected to
donewith{ total_items }, the number of items.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-each-order",
"label": "Each order",
"operator_slug": "flow.split",
"operator_version": "1.0.0",
"config": {
"path": "{{ $json.orders }}",
"batch_size": 1
}
}{
"ok": true,
"data": [
{
"order_id": "ord_1",
"total": 10
},
{
"order_id": "ord_2",
"total": 25
},
{
"order_id": "ord_3",
"total": 7
}
],
"meta": {
"split": true,
"batch_size": 1
},
"port": "out"
}Configuration
-
pathstring Optional Accepts expressions -
JSONata path to the array in the input payload (e.g. `data.items`). If empty, the root payload is treated as the array.
-
batch_sizeinteger Optional -
Number of items to include in each emitted batch.
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
batch_size - With a value above 1 each
outpayload is an array slice, butdonestill reports the number of items, so aflow.joindownstream never fires.
Output ports
out default Once per item (or batch array when batch_size > 1). The payload is the item itself.
{
"order_id": "ord_1",
"total": 10
}done After all items were queued. With an empty array the payload is {}.
{
"total_items": 3
}error The value at path is not an array, or JSONata failed.
{
"ok": false,
"errors": [
"Target at path 'data.items' is not an array. Got: object. Keys found: [id, name]"
],
"port": "error"
}In expressions
What a later node can read from this node's output with $("Split In Batches").item.json.<path> (write your node's label instead of Split In Batches). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Split In Batches").item.json.payloadThe batch of items. | — | |
$("Split In Batches").item.json.order_id | — | |
$("Split In Batches").item.json.total | — |
— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Target at path '<path|root>' is not an array. Got: <type>. Keys found: [<keys>] | error | path points to an object, string or nothing. Check the path against the real payload. |
<JSONata message> | error | Invalid JSONata in path; the message is in data.error. |
Input contract
-
payloadobject Optional
Output contract
-
payloadarray<object> Optional -
The batch of items.
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "flow.split",
"name": "Split In Batches",
"category": "flow",
"version": "1.0.0",
"description": "Splits an array into individual items or batches for parallel or iterative processing.\n\n This operator allows you to iterate over a list of items found in the input payload. For each item (or batch of items), it triggers the 'loop' output port. Once all items have been processed, it triggers the 'done' port.\n\n **Behavior:**\n - **Iteration:** Emits a message for each item/batch in the array.\n - **Context Preservation:** Child executions inherit the parent context.\n - **Batching:** Can group items into batches (e.g., size 10) for efficiency.\n\n **Use Cases:**\n - Processing a list of new users from a CSV.\n - Sending emails to a segment of subscribers.\n - Processing order line items individually.",
"capabilities": [
"loop",
"iteration",
"array",
"fan-out"
],
"config_schema": {
"type": "object",
"properties": {
"path": {
"type": "string",
"title": "Array Input Path",
"description": "JSONata path to the array in the input payload (e.g. `data.items`). If empty, the root payload is treated as the array.",
"format": "expression"
},
"batch_size": {
"type": "integer",
"title": "Batch Size",
"default": 1,
"minimum": 1,
"description": "Number of items to include in each emitted batch."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"description": "Payload containing the array to split.",
"properties": {
"payload": {
"type": "object"
}
}
},
"output_contract_schema": {
"type": "object",
"description": "A single item or a batch of items from the source array.",
"properties": {
"payload": {
"type": "array",
"items": {
"type": "object"
},
"description": "The batch of items."
}
}
},
"ports": [
{
"port_id": "out",
"label": "Loop Item",
"is_default": true,
"description": "Emits for each item or batch in the array."
},
{
"port_id": "done",
"label": "Done",
"description": "Activated when all items have been processed."
},
{
"port_id": "error",
"label": "Error",
"description": "Activated if the input is not a valid array."
}
],
"execution_mode": "sync",
"tags": [
"loop",
"iterator",
"fan-out",
"batch"
],
"is_stateful": true,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"path": {
"type": "string",
"title": "Array Input Path",
"description": "JSONata path to the array in the input payload (e.g. `data.items`). If empty, the root payload is treated as the array.",
"format": "expression"
},
"batch_size": {
"type": "integer",
"title": "Batch Size",
"default": 1,
"minimum": 1,
"description": "Number of items to include in each emitted batch."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"description": "Payload containing the array to split.",
"properties": {
"payload": {
"type": "object"
}
}
}{
"type": "object",
"description": "A single item or a batch of items from the source array.",
"properties": {
"payload": {
"type": "array",
"items": {
"type": "object"
},
"description": "The batch of items."
}
}
}[
{
"port_id": "out",
"label": "Loop Item",
"is_default": true,
"description": "Emits for each item or batch in the array."
},
{
"port_id": "done",
"label": "Done",
"description": "Activated when all items have been processed."
},
{
"port_id": "error",
"label": "Error",
"description": "Activated if the input is not a valid array."
}
]Execution
- Execution
sync- Stateful
- Yes
- Retries (
retryOnFail) - No
- Capabilities
loopiterationarrayfan-out- Tags
loopiteratorfan-outbatch
Notes and limits
- Every node execution counts towards the engine limit of 100 steps per run; past it the run fails with
Max step ceiling reached (100). Items are processed one after another in queue order, not in parallel. doneis queued right after the items reach their first node, so nodes ondonecan run before the item branches finish. Onlyflow.joinwaits for every item.- When the envelope has no
data(ordatais falsy), the engine stores the whole envelope as the node output: onerrorthe next node receives{ ok: false, errors: [...], port: "error" }as its payload.
Reviewed against the orchestrator code · 31e874b · 2026-11-26