The HTTP 422 Unprocessable Entity status code indicates that the server understands the request syntax and content type, but cannot process the request because the instructions contained within it are semantically invalid.
Unlike a 400 Bad Request, which usually indicates malformed syntax, a 422 response occurs when the request is structurally correct but fails application-level validation rules.
HTTP/1.1 422 Unprocessable Entity Content-Type: application/json
Many APIs return structured validation responses describing which fields failed validation and why the request cannot be processed.
A typical example of a 422 error occurs when submitting invalid form data to an API.
POST /users
{
"email": "invalid-email",
"password": "123"
}
Although the JSON structure is valid, the email format or password length may violate validation rules, causing the server to return a 422 Unprocessable Entity response.
The difference between 400 and 422 is important in API design.
The HTTP 422 Unprocessable Entity status code indicates that a request is syntactically valid but fails semantic validation rules defined by the application.
It is widely used in modern web APIs to communicate detailed validation errors and guide clients toward submitting correct data.