Error Codes Wiki

HTTP 422 Unprocessable Entity — Validation Error Handling

Warning4xx client error

Overview

HTTP 422 Unprocessable Entity means the server understands the request format but cannot process the contained instructions due to semantic errors.

Key Details

  • 422 indicates the request is syntactically correct but semantically invalid
  • Originally from WebDAV (RFC 4918) but widely adopted by REST APIs
  • Common for form validation errors — fields are present but values are invalid
  • Different from 400 Bad Request which means the syntax itself is wrong
  • Response body should contain specific validation error details

Common Causes

  • Form field values failing server-side validation (invalid email, password too short)
  • JSON structure is valid but business rules reject the data
  • Required fields present but with invalid or out-of-range values
  • Data type correct but value violates constraints (negative age, future birth date)

Steps

  1. 1Read the response body for specific field-level validation errors
  2. 2Fix the invalid field values according to the error messages
  3. 3Check API documentation for field format requirements and constraints
  4. 4Add client-side validation to catch errors before sending to the server
  5. 5Log 422 responses to identify common user input mistakes

Tags

http422unprocessable-entityvalidationrest-api

More in 4xx Client Error

Frequently Asked Questions

Use 400 when the request is malformed (bad JSON syntax). Use 422 when the request is well-formed but the data fails validation.