HTTPfy

422 Unprocessable Content

The request is well-formed but contains semantic errors, typically failed validation.

422 at a glance

Code
422
Name
Unprocessable Content
Class
4xx Client error
Status
IANA-registered standard code
Defined in
RFC 9110, Section 15.5.21
Cacheable by default
No by default. Caches store it only when the response carries explicit freshness (Cache-Control max-age, s-maxage or Expires).

What 422 means

422 Unprocessable Content (originally "Unprocessable Entity" from WebDAV) means the server understood the content type and the syntax was fine, but it cannot process the instructions, e.g. a JSON body with an invalid email address or a date in the past. It is the most common validation-error status in modern APIs.

What typically causes a 422

  • FastAPI and Pydantic request validation errors (FastAPI returns 422 by default).
  • Rails (:unprocessable_entity) and Laravel validation failures.
  • GitHub API "Validation Failed" responses.

Fix it on the server

  • Return field-level details so clients can show them; RFC 9457 problem details with an errors array work well.
  • Use 400 for unparseable bodies and 422 for parseable but invalid ones.

Fix it as a client or visitor

  • Read the error body: it lists the fields that failed and why.
  • With FastAPI, check that query, path and body parameters match the declared types.

Headers that go with 422

HeaderRole
Content-TypeUsually application/json or application/problem+json.

Example response

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json

{"detail": [{"loc": ["body", "email"], "msg": "value is not a valid email address"}]}

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.