# GraphQL HTTP 413: Query payload too large

- **ID:** `api/graphql-http-413-payload-too-large-query`
- **Domain:** api
- **Category:** resource_error
- **Error Code:** `413`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

GraphQL query or mutation body exceeds the HTTP request body size limit configured on the server (e.g., 1 MB default in Express/NGINX).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Apollo Server 4.x | active | — | — |
| Express 4.18+ | active | — | — |
| NGINX 1.24+ | active | — | — |
| GraphQL Yoga 3.x | active | — | — |
| AWS API Gateway 2023+ | active | — | — |

## Workarounds

1. **Increase the body size limit in Express middleware:
const express = require('express');
const app = express();
app.use(express.json({ limit: '10mb' })); // Increase to 10 MB
If using Apollo Server with Express, apply this before the Apollo middleware.** (90% success)
   ```
   Increase the body size limit in Express middleware:
const express = require('express');
const app = express();
app.use(express.json({ limit: '10mb' })); // Increase to 10 MB
If using Apollo Server with Express, apply this before the Apollo middleware.
   ```
2. **If using NGINX as a reverse proxy, increase client_max_body_size in the server block:
server {
    client_max_body_size 10m;
    ...
}** (85% success)
   ```
   If using NGINX as a reverse proxy, increase client_max_body_size in the server block:
server {
    client_max_body_size 10m;
    ...
}
   ```

## Dead Ends

- **** — The body size limit is checked before query parsing. (60% fail)
- **** — GET requests have their own size limits (e.g., 8 KB for most servers) and are not suitable for large queries. (40% fail)
