HTTP 422 — Unprocessable Entity

The request was well-formed but was unable to be followed due to semantic errors

When to use it

Use status 422 when this is the correct HTTP response semantic: The request was well-formed but was unable to be followed due to semantic errors

Request and response example

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

{"quantity":0}

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

{"error":"quantity must be greater than zero"}

Related status codes

400, 401, 402, 403

References

MDN · RFC 9110