devkult_
tools29converters34

422 Unprocessable Content

4xx client errorformerly “Unprocessable Entity”

The request is well-formed, but its content fails validation.

422 says 'I understood you, and it's invalid'. The JSON parses and the Content-Type is right, but the values break the rules — an email that isn't an email, an end date before the start date.

Rails and Laravel use it for validation errors, FastAPI returns it for schema mismatches, and GitHub's API uses it widely. RFC 9110 renamed it from 'Unprocessable Entity' to 'Unprocessable Content'.

Class4xx Client Error
Retry?No — change the request first
Cacheable by defaultNo — only with explicit Cache-Control
Response bodyAllowed
Defined inRFC 9110 §15.5.21 — 422 Unprocessable Content
Example response
HTTP/1.1 422 Unprocessable Content
Content-Type: application/json
Content-Length: 33

{"error":"Unprocessable Content"}

Common causes

  • Form or API validation failures.
  • FastAPI / Pydantic schema mismatches: a wrong type or a missing field.
  • Business-rule violations that don't fit 409.

How to fix it

  1. Read the error body — validation frameworks list each failing field.
  2. With FastAPI, compare your JSON with the endpoint's schema at /docs.
  3. On the server, return field-level errors (for example problem+json with an errors array).

Useful here: JSON Validator

Send a 422 from your server

Express
res.status(422).json({ error: "Unprocessable Content" });
Next.js route handler
return Response.json({ error: "Unprocessable Content" }, { status: 422 });
Flask
return {"error": "Unprocessable Content"}, 422
Go net/http
http.Error(w, "Unprocessable Content", http.StatusUnprocessableEntity)
nginx
return 422;

Check what a URL returns

Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.

curl -sI https://example.com/your-path | head -n 1

Frequently asked questions

422 vs 400?

400: the request is malformed — bad JSON, wrong structure. 422: well-formed but semantically invalid. Either is acceptable for validation errors if you're consistent.

Why does FastAPI return 422?

The body or query didn't match the Pydantic model. The response's detail array lists each error's location (loc), message and type.

Related status codes