HTTP 431 — Request Header Fields Too Large

The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large

When to use it

Use status 431 when this is the correct HTTP response semantic: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large

Request and response example

GET /protected-resource HTTP/1.1
Host: api.example.com

HTTP/1.1 431 Request Header Fields Too Large
Content-Type: application/json

{"error":"Request cannot be completed"}

Related status codes

400, 401, 402, 403

References

MDN · RFC 9110