
A 422 Unprocessable Entity error means the server received your request, understood the content type, and parsed the syntax correctly — but it can't process the data because of semantic errors. In plain terms: your request is well-formed, but the data inside it doesn't make sense or fails validation.
This is one of the more developer-facing HTTP errors. You'll encounter it most often when working with APIs, form submissions, and data-driven applications.
A 422 sits between two related status codes:
For example, sending valid JSON to an API but with an email field that contains "not-an-email" would trigger a 422. The JSON is perfectly valid — the server just can't process data that fails its validation rules.
The 422 status code was originally defined in WebDAV (RFC 4918) but has been widely adopted by REST APIs. Frameworks like Ruby on Rails, Laravel, and FastAPI use it as the standard response for validation failures.
The most common cause by far. The submitted data fails one or more server-side validation rules.
# Example: missing required fields
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name": "Test User"}'
# Response: 422 Unprocessable Entity
# {
# "errors": {
# "email": ["The email field is required"],
# "password": ["The password field is required"]
# }
# }
The field exists but contains the wrong type of data — a string where a number is expected, an array where an object is needed, or an invalid date format.
# Example: wrong data type
curl -X POST https://api.example.com/products \
-H "Content-Type: application/json" \
-d '{"name": "Widget", "price": "not-a-number", "quantity": -5}'
# Response: 422
# {
# "errors": {
# "price": ["Must be a valid number"],
# "quantity": ["Must be greater than 0"]
# }
# }
The data is valid in format but violates application rules. For example, trying to set an end date before a start date, booking a time slot that's already taken, or requesting a quantity that exceeds available stock.
The request references a related resource that doesn't exist or is in an invalid state:
# Example: referencing a non-existent category
curl -X POST https://api.example.com/products \
-H "Content-Type: application/json" \
-d '{"name": "Widget", "category_id": 99999}'
# Response: 422
# {"errors": {"category_id": ["Category not found"]}}
The file was uploaded successfully (the server received it), but it fails validation — wrong file type, too large, corrupted, or contains invalid content.
Data that contains invalid characters for the expected encoding, or special characters that break validation patterns.
A well-built API will return detailed validation errors. Always check the response body first:
# Get the full response including body
curl -s -X POST https://api.example.com/endpoint \
-H "Content-Type: application/json" \
-d '{"incomplete": "data"}' | jq .
The response typically contains field-level error messages telling you exactly what needs to change.
Implement client-side validation to catch issues before they reach the server:
# Verify your JSON is valid before sending
echo '{"name": "Test", "email": "[email protected]"}' | jq .
Check for:
Compare your request against the API documentation. Pay attention to:
# Test with a minimal valid payload first
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123",
"name": "Test User"
}'
If you're the one building the API and receiving reports of unexpected 422s, review your validation rules for edge cases:
# Check application logs for validation failure patterns
grep -i "validation\|422\|unprocessable" /var/log/app/error.log | tail -20
Common issues:
null vs being absent.Use curl's verbose mode to see exactly what's being sent:
curl -v -X POST https://api.example.com/endpoint \
-H "Content-Type: application/json" \
-d '{"field": "value"}'
Verify the Content-Type header is correct. Sending form data to an endpoint expecting JSON (or vice versa) can cause parsing issues that manifest as 422s.
Use 400 Bad Request when:
Use 422 Unprocessable Entity when:
A sudden spike in 422 errors across your API can indicate a broken deployment — perhaps a validation rule was changed, a required field was added without updating clients, or a database migration altered the expected data schema. While individual 422s are normal (users submit bad data), a system-wide increase suggests something broke on the server side.
Domain Monitor monitors your endpoints every minute from multiple locations. If a monitored endpoint that normally returns 200 starts responding with 422 or other error codes, you'll get an immediate alert via email, SMS, or Slack. You can set up downtime alerts for critical API endpoints and use website monitoring to track the health of your application's key flows.
| Cause | Fix |
|---|---|
| Missing required fields | Add all required fields to the request |
| Wrong data types | Match the expected types (string, number, etc.) |
| Business rule violation | Check the current state and constraints |
| Invalid references | Verify referenced resources exist |
| File validation failure | Check file type, size, and format |
A 422 is the server's way of saying "I understand your request, but the data is wrong." Read the error response, fix the data, and try again. If you're building the API, return detailed, field-level error messages so consumers can fix their requests without guessing.
Wildcard, SAN (multi-domain), and single-domain SSL certificates cover different use cases. Here's a clear comparison to help you pick the right type — and avoid paying for coverage you don't need.
Read moreDNS resolves correctly from your office but fails for users in other countries or on different ISPs. Here's why geographic DNS inconsistency happens and how to diagnose which layer is causing it.
Read moreRegistrar lock and transfer lock are often confused — and disabling the wrong one leaves your domain vulnerable. Here's a clear breakdown of what each does and when to use them.
Read moreLooking to monitor your website and domains? Join our platform and start today.