---
title: Aggregate
description: Fold many items into a single item
---

Fold many items into a single item, so the next step runs once for the whole list.

## What it does

Aggregate waits for the whole list of incoming items and returns **one** item. It is the opposite of [Split Out](/nodes/builtin/datatransformation/splitout/): splitting a field out and aggregating it back gives you the original list.

It has two modes:

* **Individual fields** collects one or more fields from every item into lists. Items `[{ price: 3 }, { price: 5 }]` aggregated on `price` give the single item `{ price: [3, 5] }`.
* **All item data** puts every incoming item, whole, into one list under a field you name (`data` by default).

Only a field that is truly absent counts as missing. A field that is present but `null` is collected as a real value.

## When to use it

* Send one summary message about a scraped list instead of one message per row.
* Give a full set of results to an AI model in a single prompt.
* Turn "many rows with one value" back into "one row with many values" after a [Split Out](/nodes/builtin/datatransformation/splitout/) or a [Loop](/nodes/builtin/flow/loop/).
* To join two separate branches on matching keys, use [Merge](/nodes/builtin/flow/merge/) instead. Aggregate folds a single input down.

## Inputs and settings

* **Fields To Aggregate** and **Keep Missing Values** apply to *Individual fields*. **Put Output In Field** applies to *All item data*.
* When you leave **Output field name** empty for a nested field, the list is named after the last part of the path: `user.profile.name` becomes `name`.
* With **Keep Missing Values** off, items without the field are skipped, so that list is shorter. Turn it on to add `null` for them, which keeps the lists of several fields lined up position by position.

## Outputs

Always one item. In *Individual fields* mode it has one list per collected field, for example `{ titles: [...], urls: [...] }`. In *All item data* mode it has one field holding the list of every input item. Read a list downstream with an expression such as `{{ $input.titles }}`.

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

1. [HTML Extract](/nodes/builtin/datatransformation/html-extract/) returns one item per article on a news page, each with `title` and `url`.
2. Aggregate, in **Individual fields** mode, collects `title` (output name `titles`) and `url` (output name `urls`).
3. A [Text Formatter](/nodes/builtin/datatransformation/text-formatter/) or a [Slack](/nodes/builtin/integration/slack/) node uses `{{ $input.titles }}` to post all headlines in a single message.

## Common issues

* **"No fields to aggregate. Add at least one field, or use "All item data"."** *Individual fields* mode has no field filled in. Add a field, or switch **Mode**.
* **"No source node is connected to this node."** Connect a node that produces items to the input.
* **One list is shorter than the others.** Some items lack that field and were skipped. Turn on **Keep Missing Values**.
* **The output looks like the input, wrapped once.** The previous node sent a single object, not a list. Aggregate has nothing to fold; check that the earlier node returns several items.

## Related nodes

* [Split Out](/nodes/builtin/datatransformation/splitout/): the opposite, one item per list entry.
* [Merge](/nodes/builtin/flow/merge/): join two branches on matching keys.
* [Remove Duplicates](/nodes/builtin/datatransformation/removeduplicates/): clean the list before folding it.
* [Sort](/nodes/builtin/datatransformation/sort/): order items before you collect them.