2022-02-25 03:04:02 +01:00
# API Routes Response Size Limited to 4MB
2021-07-02 21:27:33 +02:00
#### Why This Error Occurred
2022-06-16 23:59:54 +02:00
API Routes are meant to respond quickly and are not intended to support responding with large amounts of data. The maximum size of responses is 4MB.
2021-07-02 21:27:33 +02:00
#### Possible Ways to Fix It
2022-06-16 23:59:54 +02:00
If you are not using Next.js in a serverless environment, and understand the performance implications of not using a CDN or dedicated media host, you can set this limit to `false` inside your API Route.
2021-07-02 21:27:33 +02:00
2022-06-16 23:59:54 +02:00
```js
export const config = {
api: {
responseLimit: false,
},
}
```
2021-07-02 21:27:33 +02:00
2022-06-16 23:59:54 +02:00
`responseLimit` can also take the number of bytes or any string format supported by `bytes` , for example `1000` , `'500kb'` or `'3mb'` .
This value will be the maximum response size before a warning is displayed. The default value is 4MB.
```js
export const config = {
api: {
responseLimit: '8mb',
},
}
```