DevKits
422

Unprocessable Entity

4xx Client Error

Last updated:

The request is well-formed but contains semantic errors and cannot be processed.

Description

The best fit for domain-level validation errors: the JSON parsed fine, the required fields are present, but the values violate business rules (e.g. 'age' is negative, or 'end_date' is before 'start_date').

When to use

Return 422 for validation errors instead of 400 to distinguish semantic issues from syntactic issues.

Common pitfalls

422 vs 400 trips people up: 400 is for malformed syntax (broken JSON, missing required field), 422 is for well-formed input that fails business rules (negative age, end_date before start_date). If your framework or clients don't recognize 422 (it comes from WebDAV), 400 with a detailed error body is an acceptable fallback.

Also searched as

Developers commonly search for 422 using phrases like 422 unprocessable entity · http 422 · 422 vs 400 · 422 validation error · 422 unprocessable content. All refer to the same HTTP 422 Unprocessable Entity response.

Specification

RFC 9110 §15.5.21

Examples

HTTP response
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{"error":"Unprocessable Entity"}
Node.js (Express)
res.status(422).json({ error: "Unprocessable Entity" });
Go (net/http)
w.WriteHeader(http.StatusUnprocessableEntity)
Python (Flask)
return jsonify({"error": "Unprocessable Entity"}), 422

Debug 422 with these tools

Related status codes

All 4xx codes