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

# Querying Data

> Pagination, filtering, sorting, and history window rules for the Criffy public API.

# Querying Data

## Pagination

List endpoints use the same pagination envelope:

```json theme={null}
{
  "data": [],
  "pagination": {
    "total": 0,
    "offset": 0,
    "limit": 50,
    "has_more": false
  }
}
```

Shared pagination rules:

* `limit`: integer, minimum `1`, maximum `200`
* `offset`: integer, minimum `0`, maximum `2147483647`
* default `limit`: `50`
* default `offset`: `0`

## Platform indexes

These endpoints support pagination:

* `GET /api/v1/exchanges`
* `GET /api/v1/wallets`
* `GET /api/v1/protocols`
* `GET /api/v1/currencies`

Default ordering:

* `exchanges`: weekly visits, descending
* `wallets`: name, ascending
* `protocols`: TVL, descending
* `currencies`: market-cap rank, ascending with missing ranks last

## Offer indexes

Offer list endpoints support combinations of:

* `platform_type`: `exchange`, `wallet`, `protocol`
* `platform_slug`
* `asset_slug`
* `min_apy`
* `sort`: `apy_desc`, `apy_asc`, `tvl_desc`, `updated_desc`
* `limit`
* `offset`

Notes:

* `min_apy` is supported for earn and borrow offers.
* `min_apy` is intentionally ignored for collateral because collateral offers do not expose APY.
* `asset_slug` matches the base asset or collateral asset depending on the endpoint.
* `updated_desc` is the default sort when no `sort` is provided.
* APY filters and APY response values are percentages. For example, `4.25` means `4.25%`.
* Offer status is not a query filter. Earn offers may return with `available: false`; borrow and collateral offers may return with `is_active: false`.
* Offer list endpoints, offer detail endpoints, and offers embedded in `GET /api/v1/currencies/{slug}` use the same status semantics.

## History endpoints

History endpoints accept `period` with one of:

* `24h`
* `1w`
* `1m`
* `3m`
* `1y`
* `all`

Response shape:

```json theme={null}
{
  "period": "1m",
  "interval": "1d",
  "from": "2026-03-24T10:00:00.000Z",
  "to": "2026-04-23T10:00:00.000Z",
  "point_count": 30,
  "data": [
    {
      "timestamp": "2026-03-24T00:00:00.000Z",
      "apy": "4.25"
    }
  ]
}
```

Granularity depends on the requested window:

* `24h` returns hourly points
* `1w` and `1m` and `3m` return daily points
* `1y` and `all` return monthly points

## Data types

* Monetary and APY values are serialized as strings for precision safety.
* Timestamps use ISO 8601 UTC strings.
* Slug detail endpoints can return `301` when a resource was renamed.
* Follow same-host `301` redirects and update stored slugs from the `Location` header.
