422 Unprocessable Content
Meaning
The request was well-formed (syntactically correct) but the server cannot process it due to semantic errors.
When to Use
When the server understands the content type and syntax of the request entity, but it was unable to process the contained instructions. Often used for validation errors on a request that has the correct format but invalid data.
Example
POST /api/users with a JSON body that is syntactically correct but fails business logic validation (e.g., password too short) may result in 422 Unprocessable Content to indicate the semantic issues.
When Not to Use
Do not use for malformed requests (use 400) or authentication/authorization errors. 422 is for scenarios where the request is understood but cannot be processed because of logic or semantic problems.
Source
RFC 9110