| HTTP status | 422 Unprocessable Entity |
| Code | validation_error |
| Retry? | No — fix the request and re-issue. |
When this happens
The request matched the route but the body or query parameters failed schema validation. Examples:- A required field is missing.
- A field has the wrong type.
- An enum field has a value not in the allowed set.
- A numeric field is out of range.
limitexceeds the per-endpoint cap (see Pagination).
Example response
For a missing required field:detail is an array of items, each shaped
{ loc, msg, type }:
| Field | Meaning |
|---|---|
loc | Path to the offending field. body.policy_slug means the JSON body’s top-level policy_slug. |
msg | Human-readable message. |
type | Pydantic / FastAPI error type, e.g. missing, value_error, type_error.integer. |
How to fix
- Read the
locof every item indetail. - Compare with the auto-generated schema in the API reference.
- Fix the request and re-send.
SDK behaviour
| SDK | Exception |
|---|---|
| Python | agnes.ValidationError with field_errors: dict[str, str] mapping dotted-path → message. |
| TypeScript | ValidationError with fieldErrors: Record<string, string>. |
detail array for you so you can branch on
specific fields without re-parsing JSON.