The Aggregate node collapses multiple items into one, which is the inverse of Split Out.
The Aggregate node collapses multiple items into one, which is the inverse of Split Out. Use it when you need to collect results from a loop or batch and produce a single summary object -- for example, to compose one email with all line items.
Real-world example: A workflow processes 15 order line items individually (for inventory checks). Now you need to combine them into a single summary for a confirmation email.
Configure the Aggregate node:
| Setting | Value |
|---|---|
| Aggregate | Individual Fields |
| Input Field | product_name -> Output: products |
| Input Field | line_total -> Output: amounts |
// Input — 3 items:
{ "product_name": "Widget A", "line_total": 29.99, "qty": 2 }
{ "product_name": "Widget B", "line_total": 49.99, "qty": 1 }
{ "product_name": "Widget C", "line_total": 15.00, "qty": 5 }
// Aggregated output — 1 item:
{
"products": ["Widget A", "Widget B", "Widget C"],
"amounts": [29.99, 49.99, 15.00]
}
```text
Follow up with a Code node to build the email body:
```javascript
const products = $json.products;
const amounts = $json.amounts;
const total = amounts.reduce((sum, val) => sum + val, 0);
let body = "Order Summary:\n\n";
for (let i = 0; i < products.length; i++) {
body += `- ${products[i]}: $${amounts[i].toFixed(2)}\n`;
}
body += `\nTotal: $${total.toFixed(2)}`;
return [{ json: { emailBody: body, orderTotal: total } }];
```text
The email node then receives a single item with a fully composed body instead of 15 individual fragments.
**Related:** [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md) | [Use the HTTP Request Node as a Universal Connector](../integration-patterns/01-use-the-http-request-node-as-a-universal-connector.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.