HTTP 422 Unprocessable Entity
The server understands the request but cannot process the contained instructions.
4xx Client Error
422
Unprocessable Entity
Description
The 422 Unprocessable Entity status code means the server understands the content type of the request entity (hence a 415 is not appropriate), and the syntax of the request entity is correct (hence a 400 is not appropriate), but was unable to process the contained instructions. For example, this error condition may occur if a JSON request body contains well-formed JSON but semantically erroneous data, such as a negative value for an age field, or a date in the wrong format. Originally defined for WebDAV (RFC 4918), this status code has become widely adopted in REST APIs for validation errors.
When Is It Used?
Commonly used for validation errors in REST APIs. The request is syntactically valid but semantically incorrect. Examples include invalid email format, password too short, date out of range, or any business rule violation that prevents processing.
Example Response
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json
{"errors": [{"field": "email", "message": "Invalid email format"}, {"field": "age", "message": "Must be a positive number"}]}