4xx Client Errors

HTTP 413 Content Too Large

The request body is larger than the server is willing or able to process.

When is 413 used?

  • File upload exceeds server limit
  • Request body size limit exceeded

How to handle a 413 response

Inspect the request — URL, method, headers, credentials, and body. Retrying the same request unchanged will usually fail again; 429 is the exception, where you should wait for the Retry-After period.

Check the status code a URL returns from the command line:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

How to return 413 from your server

Node.js (Express)

res.status(413).json({ message: 'Content Too Large' });

Python (Flask)

return {"message": "Content Too Large"}, 413

Go (net/http)

w.WriteHeader(413)

Frequently Asked Questions

What does HTTP 413 mean?

413 Content Too Large: The request body is larger than the server is willing or able to process.

Is 413 an error?

Yes. 413 is in the 4xx Client Errors class. Client errors: the request is malformed, unauthorized, or targets something that does not exist.