HTTP 422 Unprocessable Content
The request is well-formed, but the data fails validation (e.g. invalid email, missing required field).
Meaning
422 means “I understood your request, but the content doesn’t make sense.” It’s the standard validation-error status in Laravel, Rails and FastAPI. The response body almost always lists the failing fields.
Common causes
- Required fields missing or empty
- Values in the wrong format (email, date, enum)
- Business rule violations (duplicate username, end date before start date)
- Field names don’t match what the API expects (camelCase vs snake_case)
- FastAPI/Pydantic: body schema mismatch or wrong types
⚡ Quick fix
- Read the
errorsobject in the response body — it names each failing field - Compare your payload field names and types with the API schema
- Log the exact payload you send
Detailed fix by platform
PHP
- Laravel returns 422 from
$request->validate(); sendAccept: application/jsonto get JSON errors instead of a redirect.
Python
- FastAPI: the
detailarray showsloc(field path) andmsg. Check that you send JSON, not form data, for Pydantic body models.
JavaScript
- Display server validation errors:javascript
if (res.status === 422) { const { errors } = await res.json(); // { email: ["The email must be valid."] } Object.entries(errors).forEach(([field, msgs]) => showFieldError(field, msgs[0])); }
How to diagnose
- Response body — Which fields failed and why?
- Payload — Do names and types match the schema?
- Rules — Any uniqueness or cross-field rules?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026