Skip to main content
HTTP/4xx (Client Error)

422 Unprocessable Content

The request was well-formed but was unable to be followed due to semantic errors.

❓ Why does this happen?

Common in modern REST APIs when input validation fails (e.g. Zod or Pydantic validation error).

✅ How to fix it

Review API response error details to identify and fix invalid parameter fields.

Return or handle 422 in your stack

// app/api/resource/route.ts
export function GET() {
  return Response.json(
    { error: "Unprocessable Content", status: 422 },
    {
      status: 422
    }
  );
}

Live 422 mock endpoint

Point your app, tests, or retry logic at this free public URL to reproduce a real 422 response (CORS enabled, optional ?delay=ms up to 5000).

https://castov.com/api/mock/422

422 vs similar status codes

Frequently Asked Questions

What does HTTP Status 422 mean?
The request was well-formed but was unable to be followed due to semantic errors.
Why am I getting a 422 status code?
Common in modern REST APIs when input validation fails (e.g. Zod or Pydantic validation error).
How do I fix a 422 Unprocessable Content error?
Review API response error details to identify and fix invalid parameter fields.
What is the difference between 422 Unprocessable Content and 400 Bad Request?
400 means the request is syntactically malformed (invalid JSON, bad framing). 422 means it parsed fine but failed validation rules (e.g. Zod or Pydantic errors).
How can I test how my app handles a 422 response?
Send a request to https://castov.com/api/mock/422 — it returns a real 422 Unprocessable Content response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 4xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.