422 Unprocessable Content
4xx Client Error
RFC 9110
The request arrived fine. The data inside it didn't make sense.
What 422 Unprocessable Content means {#what}
The request was syntactically correct (valid JSON, right content type) but semantically invalid — the data failed business logic or validation rules. One of the most useful codes for API design.
When you’ll see a 422 {#when}
- Submitting a form with an invalid email address
- Sending a date range where end is before start
- Violating a business rule (e.g., booking a room that’s already taken)
- Missing required fields that passed structural validation
When to use 422 {#use}
- Prefer over 400 when the request structure is valid but the content fails validation
- Always return a detailed error body listing which fields failed and why