> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agscard.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Error responses and the codes your app can handle.

Every error from the API has the same shape. Branch on `code`. The `message` is for people and may change.

```json theme={null}
{
  "error": {
    "code": "validation_failed",
    "message": "The search field is required.",
    "errors": {
      "search": ["The search field is required."]
    }
  }
}
```

`errors` appears only on `validation_failed`, and lists the messages for each field that failed.

| Status | Code | Meaning |
| - | - | - |
| `401` | `unauthenticated` | The access token is missing, invalid, expired or revoked |
| `403` | `insufficient_scope` | The token doesn't have the scope this endpoint needs |
| `404` | `not_found` | The endpoint doesn't exist, or the order wasn't created through the API by your app or account |
| `409` | `idempotency_key_in_use` | A request with this `Idempotency-Key` is still running |
| `422` | `validation_failed` | The request is invalid. See `errors` for each field |
| `422` | `order_rejected` | The order breaks a rule, such as a missing signature on a high-value order |
| `422` | `idempotency_key_reused` | This `Idempotency-Key` was used with a different body |
| `429` | `rate_limited` | Too many requests. Retry after the `Retry-After` header's seconds |
| `500` | `server_error` | Something went wrong on our side |

Errors from `/oauth/authorize` and `/oauth/token` use the OAuth 2.0 format instead. See [Authentication](https://docs.agscard.com/authentication.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.