The server understands the request but cannot process it due to semantic errors in the content.
The HTTP 422 Unprocessable Entity status code means the server understands the content type of the request and the syntax of the request body is correct, but it was unable to process the contained instructions. This typically indicates that the request data failed validation - the structure is correct but the values are semantically invalid.
A 422 error occurs when the server can parse your request body (it is syntactically correct), but the data within it fails business logic or validation rules. For example, submitting a user registration form with an email that is missing the @ symbol, a password that is too short, or a birth date set in the future.
This status code originated from WebDAV (RFC 4918 - Web Distributed Authoring and Versioning) and was later adopted broadly by REST APIs. It has since been included in RFC 9110 (HTTP Semantics), making it an official part of the HTTP standard. Modern frameworks like Laravel, Ruby on Rails, and Phoenix use 422 as their default response for validation failures.
Framework-Specific Behavior:
Laravel Returns 422 by default for validation errors. The response includes a JSON object with "errors" mapping field names to arrays of error messages. Uses $request->validate() or Form Requests.
Rails ActiveRecord validation failures return 422. render json: @model.errors, status: :unprocessable_entity is the standard pattern. Rails 7+ also uses 422 for Turbo form submissions.
Express No built-in validation. Libraries like express-validator or joi handle validation, and you return 422 manually: res.status(422).json({ errors }).
Django Django REST Framework returns 400 by default for validation errors, but many developers override this to return 422 for semantic consistency. Use raise ValidationError() with a custom exception handler.
# Client submits a user registration with invalid data POST /api/users HTTP/1.1 Host: api.example.com Content-Type: application/json { "name": "", "email": "not-an-email", "password": "123", "age": -5 } # Server Response (validation failed) HTTP/1.1 422 Unprocessable Entity Content-Type: application/json { "message": "The given data was invalid.", "errors": { "name": ["The name field is required."], "email": ["The email must be a valid email address."], "password": ["The password must be at least 8 characters."], "age": ["The age must be a positive number."] }, "statusCode": 422 }
{"name": } with missing values. A 422 Unprocessable Entity means the server parsed the request successfully but the data is semantically invalid - like sending {"email": "not-an-email"}. The JSON is valid, but the value fails validation. Use 400 for syntax errors and 422 for validation or business logic errors.Detect validation failures, broken endpoints, and misconfigured APIs across your web infrastructure.
Start Free Scan