HTTP 413 Payload Too Large (formerly 'Request Entity Too Large') indicates the request body exceeds the server's willingness or ability to process. The server may close the connection to prevent further transmission. Common limits: nginx defaults to 1MB (client_max_body_size), Apache to ~2GB, Express body-parser to 100KB. The server SHOULD include a Retry-After header if the condition is temporary.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/413
Example request:
curl -i "https://httpstatus.com/api/status/413"The request is larger than the server is willing or able to process.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 413 Payload Too Large has specific technical implications for API design, caching, and client behavior. Understanding the precise semantics helps distinguish it from similar status codes and implement correct error handling. The response should include a descriptive body following a consistent error schema (like RFC 7807 Problem Details) so clients can programmatically handle the error.
// Handle 413 Payload Too Large in Express
app.use((err, req, res, next) => {
if (err.status === 413) {
return res.status(413).json({
type: 'https://api.example.com/errors/payload-too-large',
title: 'Payload Too Large',
status: 413,
detail: err.message
});
}
next(err);
});from fastapi import HTTPException
# Raise 413 Payload Too Large
raise HTTPException(
status_code=413,
detail={
'type': 'payload_too_large',
'message': 'Descriptive error for 413 Payload Too Large'
}
)// Spring Boot 413 Payload Too Large handling
@ExceptionHandler(CustomPayloadTooLargeException.class)
public ResponseEntity<ErrorResponse> handlePayloadTooLarge(
CustomPayloadTooLargeException ex) {
return ResponseEntity.status(413)
.body(new ErrorResponse("Payload Too Large", ex.getMessage()));
}// Return 413 Payload Too Large
func errorHandler(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(413)
json.NewEncoder(w).Encode(map[string]any{
"status": 413,
"error": "Payload Too Large",
"message": message,
})
}