422 Unprocessable Content

The request is syntactically valid but semantically wrong, so the server cannot act on it.

Status

HTTP/1.1 422 Unprocessable Content

Details

422 draws the line between parsing and meaning. The JSON parsed, the fields are the right types, and the server still cannot process it: an end date before a start date, a quantity below the minimum, a reference to a record that does not exist.

It began as a WebDAV code and was folded into the core HTTP semantics spec in RFC 9110. It is now the conventional validation-failure code for JSON APIs, and the response body should enumerate the specific failures rather than reporting one at a time.

Common causes

How to fix it

As the client

As the server

Examples

POST /api/v2/order HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"product_id":"isp-us","quantity":0}

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json; charset=utf-8

{"errors":[{"field":"quantity","rule":"min","min":1}]}

Specifications

RFC 9110 §15.5.21

See also