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.

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

Related status codes

All 4xx codes