413

Content Too Large

4xx Client Error

ELI5

The file or data you're trying to send is too big for me to handle. Please make it smaller.

Server perspective

Use 413 when the request content is larger than the limits the server is willing or able to process.

When to use

  • Return 413 for oversized uploads, bodies, or request content limits
  • Use Retry-After only when the refusal is temporary rather than purely size-based
  • File uploads exceeding size limits
  • Request body too large for processing
  • JSON/XML payloads over server limits
  • Form data exceeding allowed size

How to respond

  • Document size limits clearly and enforce them consistently
  • Explain whether the client should compress, chunk, resize, or choose another upload path

Headers to consider

  • Retry-After

Response body

  • Include the relevant size limit or upload policy when that helps the client choose a smaller request.

Server-side pitfalls

  • Do not use 413 for oversized headers or URIs; use 431 or 414 instead
  • Do not suggest a time-based retry unless waiting could actually change the outcome
  • Headers too large (use 431 Request Header Fields Too Large)
  • URI too long (use 414 URI Too Long)
  • Bad request format (use 400 Bad Request)

Examples

File upload too large

Request:POST https://api.example.test/api/upload # Body <50MB binary payload>
Response:413 Content Too Large # Headers Content-Type: application/json # Body { "error": "content_too_large" }

File exceeds the server's 10MB upload limit

References

Related Status Codes