> 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/output.md).

# Output

**Required**: no\
**Default**: `body`, when `iterate` is not set; `item` otherwise

With the `output` directive, you can specify how you want your module output to look.

## iterate

When using iterate, `output` is processed for each item of the array that is specified with the `iterate` directive.

When not using iterate, `output` is executed only once and the result is fed to the `wrapper` directive if present. Otherwise, it will be the final result of the module.

Within a chain of requests, the output directive should only be defined once, in the final step, to produce the module’s or RPC's output.

When you aren't using `iterate`, you can use the `body` object to specify the output of the module.

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

```json
"output": "{{body}}"
```

{% endtab %}
{% endtabs %}

You can also transform the output using custom IML functions to shape the final result as needed.

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

```json
"output": "{{parseResponse(body)}}"
```

{% endtab %}
{% endtabs %}

When using the `iterate` directive, specify the output using the `item` object. However, the `body` is still available to use.

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

```json
"iterate": "{{body.items}}",
"output": {
    "id": "{{item}}"
}
```

{% endtab %}
{% endtabs %}

## wrapper

When using the `wrapper` directive, the value becomes the final output of the module. This directive is executed only once and at the end of the processing chain. There are no more directives or transformations after it.

In the `wrapper` directive, you can define additional top-level properties alongside the `output`. In the example below, the properties `someAdditionalStuff` and `aNumber` appear at the top level of the final result, while the transformed data is nested inside the data field.

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

```json
"iterate": "{{body.users}}",
"output": {
	"label": "{{item.name}}",
	"value": "{{item.id}}"
},
"wrapper": {
	"someAdditionalStuff": "helloworld",
	"aNumber": "{{body.aValue}}",
	"data": "{{output}}"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The best approach is to return the API response as it is. See the best practices for [processing of output parameters](https://developers.make.com/custom-apps-documentation/best-practices/output-parameters/processing-of-output-parameters.md#response-output).
{% endhint %}

{% hint style="info" %}
If the API returns a [JSON string inside a JSON object](https://developers.make.com/custom-apps-documentation/component-blocks/api/processing-of-json-strings-inside-a-json-object.md#parse-a-json-string), use the `parseJSON()` function.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
