# Validation Failed

Source: https://apiguide.dev/errors/validation-failed
Problem type URI: https://apiguide.dev/errors/validation-failed
Status: 422 Unprocessable Content
Updated: 2026-10-14

## When to use it

Use 422 Validation Failed when the request payload is syntactically correct and readable (like valid JSON), but fails to meet the server's business constraints or data validation rules.

Typical examples include a required field being missing, a string failing to meet a min/max length, or a field violating dependency rules (e.g. `start_date` must be before `end_date`).

Type and format errors in a body that parses (a malformed email string, a boolean where a number belongs) are validation failures too, and get 422. The line with 400 is parsing: if the server cannot read the payload at all, it is `malformed-request-body`. Semantic problems with a query, rather than a body, are `unprocessable-query`.

## When not to use it

Do not use 422 for syntactically invalid payloads (use `malformed-request-body` / 400 instead). Do not use this code for authorization checks (use 401 or 403) or resource existence failures (use 404).

## Example response

```json
{
  "type": "https://apiguide.dev/errors/validation-failed",
  "title": "Validation Failed",
  "status": 422,
  "detail": "The end_date must be a date after start_date.",
  "errors": {
    "end_date": [
      "The end_date must be a date after start_date."
    ]
  },
  "instance": "/v1/leads"
}
```
