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

# Errors

> One error shape with stable codes, and what to do about each one.

Every error has the same shape:

```json theme={null}
{
  "error": {
    "code": "window_too_large",
    "message": "This request serves at most 6 hours. Use a stream for more.",
    "request_id": "4f0c2a9e-0b7e-4f3e-9a51-2a8c3d1f6e20",
    "details": {"parameter": "end", "max": "PT6H"}
  }
}
```

Use `code` in your programs: the codes are stable. `message` is for people and may change. `details` holds machine-readable specifics: the parameter at fault, the limit, the reason, when a quota resets. Quote `request_id` (also in the `X-Request-ID` header) when you contact support at [support@qelso.io](mailto:support@qelso.io).

## Codes

| HTTP | `code` | Meaning | What to do |
| - | - | - | - |
| 400 | `invalid_parameter` | A parameter is missing, malformed or out of range (`details.parameter`) | Fix the request |
| 400 | `invalid_cursor` | The cursor is malformed or expired, or was sent with different parameters | Start the paging run again |
| 400 | `window_too_large` | The window or number of intervals is over this endpoint's limit (`details.max`) | Split the window, or use a stream |
| 401 | `unauthorized` | The key is missing, invalid, revoked or expired | Check the key |
| 403 | `forbidden_venue` | No access to this venue (`details.reason`: `not_in_plan`, `eligibility_required` or `not_yet_available`) | See `GET /v2/usage` |
| 403 | `forbidden_dataset` | This data isn't available to you on this venue (`details.reason`: `not_in_plan`, or `not_offered` when we don't offer it on that venue) | See `GET /v2/usage` |
| 403 | `plan_history_limit` | `start` is earlier than your plan allows (`details.earliest_allowed`) | Start later |
| 403 | `plan_resolution_not_allowed` | The resolution or interval is finer than your plan allows (`details.min_resolution`) | Ask for a coarser one |
| 403 | `suspended` | Your organisation's access to this venue is suspended | Write to [support@qelso.io](mailto:support@qelso.io) |
| 404 | `not_found` | Unknown market, event, series or path | Check the ID |
| 406 | `not_acceptable` | This endpoint can't return the format asked for in `Accept` | Ask for JSON, or a format it streams |
| 429 | `rate_limited` | Over your units per minute or your requests at once | Retry after `Retry-After` seconds |
| 429 | `quota_exceeded` | A monthly quota is used up (`details.resets_at`) | Don't retry automatically |
| 500 | `internal_error` | Our fault | Retry with backoff; quote `request_id` |
| 503 | `metadata_refreshing` | Market metadata is being refreshed | Retry after `Retry-After` seconds |
| 503 | `service_unavailable` | Temporarily unavailable | Retry after `Retry-After` seconds |
| 504 | `timeout` | The query ran over its time limit | Narrow the window, or use a stream |

More codes may be added. Treat a code you don't know by its HTTP status.

## In the Python SDK

Each status has its own exception, with the code, message, details and request ID. The SDK retries `rate_limited`, `internal_error`, `503`s and network errors by itself, and never retries `quota_exceeded` or `timeout`.

```python theme={null}
import qelso

try:
    page = client.get_market_prices("polymarket:3215007", start="2020-01-01", end="2026-11-01")
except qelso.PermissionDeniedError as e:
    if e.code == "plan_history_limit":
        print("earliest allowed:", e.details["earliest_allowed"])
except qelso.APIStatusError as e:
    print(e.status_code, e.code, e.message, e.request_id)
```


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