# 413 Payload Too Large: Request entity too large, max size is 1048576 bytes

- **ID:** `api/rest-api-request-body-too-large-streaming`
- **Domain:** api
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The HTTP request body exceeds the server-configured maximum payload size limit, typically for file uploads or large JSON payloads.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| HTTP/1.1 RFC 7231 | active | — | — |
| Nginx 1.24 | active | — | — |
| Express.js 4.18 | active | — | — |

## Workarounds

1. **Reduce the payload size by removing unnecessary fields or using pagination. Example: send data in chunks with a multipart upload or use chunked transfer encoding: curl -X POST https://api.example.com/upload -H 'Transfer-Encoding: chunked' -d @largefile.json** (90% success)
   ```
   Reduce the payload size by removing unnecessary fields or using pagination. Example: send data in chunks with a multipart upload or use chunked transfer encoding: curl -X POST https://api.example.com/upload -H 'Transfer-Encoding: chunked' -d @largefile.json
   ```
2. **Increase the server-side max payload size limit (if you control the server). Example (Nginx): client_max_body_size 10m; (Express.js): app.use(express.json({limit: '10mb'}));** (80% success)
   ```
   Increase the server-side max payload size limit (if you control the server). Example (Nginx): client_max_body_size 10m; (Express.js): app.use(express.json({limit: '10mb'}));
   ```

## Dead Ends

- **** — Compressing the request body (e.g., gzip) may not reduce size below the limit if the server counts uncompressed bytes. (50% fail)
- **** — Splitting the request into multiple smaller requests without proper sequencing may cause data inconsistency or missing data. (40% fail)
