> For the complete documentation index, see [llms.txt](https://developers.make.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.make.com/custom-apps-documentation/component-blocks/api/handling-responses/iterate.md).

# Iterate

**Required**: no

This directive specifies the container of an array of items that the module must process and output. In its simplest form, the `iterate` directive is an IML string that points to a container of your items. It must be an array.

{% tabs %}
{% tab title="Source" %}

```json
{
    "response": {
        "iterate": "{{body.data}}"
    }
}
```

{% endtab %}
{% endtabs %}

When you need to filter out some items for processing, you can specify the `iterate` directive as an object, in which case it will have the following properties:

<table><thead><tr><th width="195.33333333333331">Property</th><th width="168.22216796875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>container</code></td><td>IML string</td><td>Specifies the array with the data you want to process.</td></tr><tr><td><code>condition</code></td><td>IML string</td><td>Specifies a filter that can be used to filter out unwanted items.</td></tr></tbody></table>

## Properties

### container

**Required**: yes

The `iterate.container` directive must point to an array of items that are to be processed.

### condition

**Required**: no\
**Default**: `true`

An optional expression to filter out unwanted items. It must resolve into a Boolean value where `true` passes the item through and `false` drops the item from processing. The `item` variable is available in this directive, which represents the current item being processed.

## Example

The `iterate` directive changes the behavior of the `output` directive and allows you to use a special variable `item` that represents the currently processed item. The `output` directive is executed for each item in the container that you have specified in `iterate.container`. You can use the `item` variable in the `output` directive to access properties of iterated objects.

To iterate this response:

{% tabs %}
{% tab title="Response" %}

```json
{
    "success": true,
    "data": [{
        "id": 1,
        "foo": "bar"
    }, {
        "id": 2,
        "foo": "baz"
    }, {
        "id": 3,
        "foo": "qux"
    }]
}
```

{% endtab %}
{% endtabs %}

To process all items contained in the `data` array, specify the `iterate` directive:

{% tabs %}
{% tab title="Iterate directive" %}

```json
{
    "response": {
        "iterate": "body.data",
        "output": {
            "id": "{{item.id}}",
            "text": "{{item.foo}}"
        }
    }
}
```

{% endtab %}
{% endtabs %}

Specify how the output should look in the `output` directive. The `item` variable represents the currently processed item from the `data` array.

{% tabs %}
{% tab title="Output directive" %}

```json
[{
    "id": 1,
    "text": "bar"
}, {
    "id": 2,
    "text": "baz"
}, {
    "id": 3,
    "text": "qux"
}]
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.make.com/custom-apps-documentation/component-blocks/api/handling-responses/iterate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
