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

# Stats

> Top-level totals over the entire LeoKit swap dataset (24h + lifetime)

## Endpoint

```
GET /leokit/explorer/stats
```

No authentication required. Cached for 60 seconds.

## Response

```json theme={null}
{
  "data": {
    "total_swaps": 482015,
    "swaps_24h": 1842,
    "volume_24h_usd": 12480921.55,
    "total_volume_usd": 4720112350.20,
    "total_fees_usd": 481200.45,
    "near_ecosystem_fees_usd": 18230.55,
    "unique_chains": 28,
    "unique_wallets_24h": 982,
    "avg_swap_size_usd": 6770.40,
    "success_rate": 1.0,
    "protocols_active": 9,
    "supported_chains": 32,
    "supported_protocols": 11,
    "volume_by_protocol": {
      "thorchain": { "count": 192015, "volume_usd": 1820000000 },
      "chainflip": { "count": 122104, "volume_usd": 945000000 },
      "near":      { "count": 51200,  "volume_usd": 380000000 }
    }
  }
}
```

## Field Reference

| Field                     | Description                                                              |
| ------------------------- | ------------------------------------------------------------------------ |
| `total_swaps`             | Lifetime swap count                                                      |
| `swaps_24h`               | Swaps in the past 24 hours                                               |
| `volume_24h_usd`          | USD volume in the past 24 hours                                          |
| `total_volume_usd`        | USD volume across the most recent 10,000 indexed rows                    |
| `total_fees_usd`          | Sum of `(affiliate_fee_bps / 10000) * volume_usd` across the same window |
| `near_ecosystem_fees_usd` | NEAR-ecosystem affiliate fees received at `leodex.near`                  |
| `unique_chains`           | Distinct source chains observed in the indexed window                    |
| `unique_wallets_24h`      | Distinct `from_address` values in the past 24 hours                      |
| `avg_swap_size_usd`       | `volume_24h_usd / swaps_24h`                                             |
| `success_rate`            | Currently always `1.0` (failed swaps are not indexed)                    |
| `protocols_active`        | Distinct protocol names observed in the indexed window                   |
| `supported_chains`        | Total chains LeoKit can swap (configuration-derived, not data-derived)   |
| `supported_protocols`     | Total protocols LeoKit can route to                                      |
| `volume_by_protocol`      | Per-protocol `count` + `volume_usd`                                      |

## Caching

| Header    | Value           |
| --------- | --------------- |
| `X-Cache` | `HIT` or `MISS` |

The cache TTL is 60 seconds.

## Errors

| Status | Description                                   |
| ------ | --------------------------------------------- |
| `500`  | Failed to query Supabase or aggregate results |


## OpenAPI

````yaml /api-reference/openapi.json GET /explorer/stats
openapi: 3.0.3
info:
  title: Leokit API
  version: 1.0.0
  description: API reference for Leokit
servers:
  - url: https://api.leokit.dev
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /explorer/stats:
    get:
      summary: Explorer top-level stats
      responses:
        '200':
          description: Aggregated swap stats.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExplorerStatsResponse'
      security:
        - {}
components:
  schemas:
    ExplorerStatsResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          properties:
            total_swaps:
              type: integer
            swaps_24h:
              type: integer
            volume_24h_usd:
              type: number
            total_volume_usd:
              type: number
            total_fees_usd:
              type: number
            near_ecosystem_fees_usd:
              type: number
            unique_chains:
              type: integer
            unique_wallets_24h:
              type: integer
            avg_swap_size_usd:
              type: number
            success_rate:
              type: number
            protocols_active:
              type: integer
            supported_chains:
              type: integer
            supported_protocols:
              type: integer
            volume_by_protocol:
              type: object
              additionalProperties:
                type: object
                properties:
                  count:
                    type: integer
                  volume_usd:
                    type: number
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
      description: 'Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4'

````