Error Codes Wiki

HTTP 422 Unprocessable Entity — Validation Error Handling

Warning4xx client error

About HTTP 422 Unprocessable Entity

HTTP 422 Unprocessable Entity means the server understands the request format but cannot process the contained instructions due to semantic errors. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: 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. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: 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). Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Read the response body for specific field-level validation errors. Fix the invalid field values according to the error messages. Check API documentation for field format requirements and constraints. Add client-side validation to catch errors before sending to the server. Log 422 responses to identify common user input mistakes. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

When should I use 422 vs 400?

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

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.