# How to handle request payloads larger than 5MB

Both [**REST**](/documentation/connectors-and-triggers/triggers/web-protocols/rest.md) and [**HTTP**](/documentation/connectors-and-triggers/triggers/web-protocols/http.md) triggers have a payload limit of 5MB. If this limit is reached, the Platform returns the HTTP status "413" with the following message:

```json
{
    "message": "Request size limit exceeded"
}
```

Below you can find out more about an alternative method for handling requests that exceed the payload limit.

## **Step-by-step guide for handling requests larger than 5MB**

{% stepper %}
{% step %}

### **Use the HTTP File Trigger**

You can use the [**HTTP File Trigger**](/documentation/connectors-and-triggers/triggers/web-protocols/http-file.md) to process payloads larger than 5MB by sending the data as a file.

Specify the appropriate content type for your file under **Body Upload** and **Response Content-Types**. In this example, the value is `application/json`, but it can also be other formats, such as `application/pdf` or `application/jpeg`.

<figure><img src="/files/JcXrj6szGekT9oBmEB5X" alt=""><figcaption></figcaption></figure>

After receiving the payload with the [**HTTP File Trigger**](/documentation/connectors-and-triggers/triggers/web-protocols/http-file.md), you can access the **Monitor** page to see the [**Execution Details**](/documentation/developer-guide/development-cycle/dashboards/completed-executions.md). Note that the payload is received as a file and not in the body key. In this context, the body key is empty.

<figure><img src="/files/X0ogFxLZAtRaTqCI9WKG" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/hcCy4FYKQttA8x2dLQVO" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Save the input data in the Session Management connector**

Special handling is required to access the uploaded file. A common approach is to store the request’s input data in a [**Session Management**](/documentation/connectors-and-triggers/connectors/structured-data/session-management.md) connector, preserving details such as `Headers` and `QueryAndPath`.

<figure><img src="/files/HNKizBC3HUye1DPiX7Fn" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Convert the string into JSON**

Use the [**File Reader**](/documentation/connectors-and-triggers/pt-br/connectors/files/file-reader.md) connector to read the file and convert it into a JSON string. Then, apply the Double Braces [`TOJSON` function](/documentation/connectors-and-triggers/double-braces/double-braces-functions/json-functions.md) to transform it into a JSON object.

In this example, the conversion takes place in the [**JSON Generator**](/documentation/connectors-and-triggers/connectors/tools/json-generator.md) connector, named "TOJSON data", as illustrated in the image below.

<figure><img src="/files/QLT69hmBJFTase42eVt4" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Configure the response of the pipeline**

Once you have obtained the desired payload, you need to prepare the pipeline's response. You can return either a `.json` file or a JSON object.

To generate a file, use the [**File Writer**](/documentation/connectors-and-triggers/connectors/files/file-writer.md) connector:

<figure><img src="/files/QIG59CHpHW6UMfTjajnR" alt=""><figcaption></figcaption></figure>

Alternatively, you can use a [**JSON Generator**](/documentation/connectors-and-triggers/connectors/tools/json-generator.md) connector to structure and provide the final response, as shown in the following example:

<figure><img src="/files/L2Ps3lGtEpay6wrop99q" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions: 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://docs.digibee.com/documentation/troubleshooting/integration-guides/payloads-larger-than-5mb.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.
