📦
413
Payload Too Large
!
?

Example HTTP Response

HTTP Response
HTTP/1.1 413 Payload Too Large
Content-Type: application/json

{"error": "Max size is 10MB"}
Common Causes
  • File upload exceeds limit
  • Request body too large
  • Too much data in single request
Technical Details

What does this mean?

That's way too much! Like trying to stuff a king-size mattress into a compact car. Time to pack lighter!

Technical Definition

The request entity is larger than limits defined by server.

RFC Says

"The 413 (Payload Too Large) status code indicates that the server is refusing to process a request because the request payload is larger than the server is willing or able to process. The server MAY close the connection to prevent the client from continuing the request."

Plain English:

413 means 'Your request body is too big.' This happens when uploading a file that's larger than the server's limit, or sending a JSON payload that exceeds the maximum size. The response can include a Retry-After header if the condition is temporary.

Common Misinterpretation

Make sure your error message tells users the actual size limit. Also consider that 413 can be returned by reverse proxies (like nginx) before your application code even runs, so configure those limits appropriately.

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(413).json({
    error: 'Payload Too Large',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(413, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Payload Too Large',
    message: 'Your error message here'
  }));
}).listen(3000);