What HTTP 422 means
The JSON parsed fine, but the data is invalid: an email without @, an end date before the start date, a missing required field. FastAPI, Rails and Laravel return 422 for validation errors by default. 400 is the alternative when the body can’t even be parsed.
How to fix a 422 error
-
Read the response body. Frameworks list each invalid field, e.g. FastAPI’s
detailarray withlocandmsg.
Retrying
No. Fix the request first; sending it again unchanged will get the same response.
Example response
HTTP/1.1 422 Unprocessable Content
Date: Wed, 21 Oct 2026 10:30:00 GMT
Content-Type: application/json
How to return 422
res.status(422).json({ error: 'Unprocessable Content' });
from fastapi import HTTPException
raise HTTPException(status_code=422, detail="Unprocessable Content")
http.Error(w, http.StatusText(http.StatusUnprocessableEntity), http.StatusUnprocessableEntity)
location /private/ {
return 422;
}
Related status codes
- 400 Bad Request : The server can’t process the request because it is malformed.
- 409 Conflict : The request conflicts with the current state of the resource.
- 415 Unsupported Media Type : The server doesn’t accept the request body’s format.
Other 4xx status codes
400 Bad Request · 401 Unauthorized · 402 Payment Required · 403 Forbidden · 404 Not Found · 405 Method Not Allowed · 406 Not Acceptable · 407 Proxy Authentication Required · 408 Request Timeout · 409 Conflict · 410 Gone · 411 Length Required · 412 Precondition Failed · 413 Content Too Large · 414 URI Too Long · 415 Unsupported Media Type · 416 Range Not Satisfiable · 417 Expectation Failed · 418 I’m a Teapot · 421 Misdirected Request · 423 Locked · 424 Failed Dependency · 425 Too Early · 426 Upgrade Required · 428 Precondition Required · 429 Too Many Requests · 431 Request Header Fields Too Large · 444 No Response · 451 Unavailable For Legal Reasons · 499 Client Closed Request
See the full list of HTTP status codes.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does HTTP 422 Unprocessable Content mean?
HTTP 422 Unprocessable Content means the request is well-formed, but its contents fail validation. The JSON parsed fine, but the data is invalid: an email without @, an end date before the start date, a missing required field. FastAPI, Rails and Laravel return 422 for validation errors by default. 400 is the alternative when the body can’t even be parsed.
How do I fix HTTP 422?
Read the response body. Frameworks list each invalid field, e.g. FastAPI’s detail array with loc and msg.