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

# API Reference

> Complete reference for all ARBITER API endpoints.

## Base URL

```
https://api.arbiterapi.com
```

All endpoints (except `/health`) are prefixed with `/v1` and require an `X-API-Key` header.

## Authentication

```bash theme={null}
curl "https://api.arbiterapi.com/v1/markets" \
  -H "X-API-Key: YOUR_API_KEY"
```

## Endpoints

### Markets

| Method | Endpoint             | Description                            |
| ------ | -------------------- | -------------------------------------- |
| GET    | `/v1/markets`        | List markets with filters              |
| GET    | `/v1/markets/search` | Full-text search with advanced filters |
| GET    | `/v1/markets/{id}`   | Get a single market                    |

### Market Data

| Method | Endpoint                             | Description                    |
| ------ | ------------------------------------ | ------------------------------ |
| GET    | `/v1/markets/{id}/price`             | Current or historical price    |
| GET    | `/v1/markets/{id}/orderbook`         | Live orderbook                 |
| GET    | `/v1/markets/{id}/orderbook/history` | Historical orderbook snapshots |
| GET    | `/v1/markets/{id}/trades`            | Trade history                  |
| GET    | `/v1/markets/{id}/candles`           | OHLCV candlestick data         |

### Events

| Method | Endpoint            | Description                   |
| ------ | ------------------- | ----------------------------- |
| GET    | `/v1/events`        | List events (grouped markets) |
| GET    | `/v1/events/{slug}` | Get event with child markets  |

### Cross-Platform

| Method | Endpoint                              | Description                              |
| ------ | ------------------------------------- | ---------------------------------------- |
| GET    | `/v1/matching-markets`                | Find matching markets across platforms   |
| GET    | `/v1/matching-markets/sports/{sport}` | Sports-specific matching by sport + date |

### Wallets

| Method | Endpoint                          | Description                 |
| ------ | --------------------------------- | --------------------------- |
| GET    | `/v1/wallets/{address}`           | Wallet info + metrics       |
| GET    | `/v1/wallets/{address}/trades`    | Per-wallet trade history    |
| GET    | `/v1/wallets/{address}/positions` | Current holdings per market |
| GET    | `/v1/wallets/{address}/pnl`       | Realized PnL over time      |
| GET    | `/v1/wallets/{address}/activity`  | Merges, splits, redeems     |

### Polymarket Native

| Method | Endpoint                                | Description                       |
| ------ | --------------------------------------- | --------------------------------- |
| GET    | `/v1/polymarket/markets`                | Raw Gamma API market data         |
| GET    | `/v1/polymarket/markets/{condition_id}` | Single market with native fields  |
| GET    | `/v1/polymarket/trades`                 | Trades with tx\_hash, maker/taker |

### Kalshi Native

| Method | Endpoint                      | Description                             |
| ------ | ----------------------------- | --------------------------------------- |
| GET    | `/v1/kalshi/markets`          | Raw Kalshi API market data              |
| GET    | `/v1/kalshi/markets/{ticker}` | Single market with native fields        |
| GET    | `/v1/kalshi/trades`           | Trades with taker\_side, native pricing |

### WebSocket

| Protocol | Endpoint | Description                         |
| -------- | -------- | ----------------------------------- |
| WS       | `/v1/ws` | Real-time trades, prices, orderbook |

### System

| Method | Endpoint    | Description                             |
| ------ | ----------- | --------------------------------------- |
| GET    | `/health`   | Health check + service status (no auth) |
| GET    | `/v1/stats` | Database statistics                     |

## Pagination

List endpoints use offset-based pagination:

```bash theme={null}
curl ".../v1/markets?limit=50&offset=100"
```

Trade and orderbook history endpoints use cursor-based pagination:

```bash theme={null}
# First page
curl ".../v1/markets/{id}/trades?limit=100"
# Response includes: {"cursor": "1774399680782", "has_more": true}

# Next page
curl ".../v1/markets/{id}/trades?limit=100&cursor=1774399680782"
```

## Errors

```json theme={null}
{
  "detail": "Market not found"
}
```

| Status | Meaning                      |
| ------ | ---------------------------- |
| 400    | Bad request (invalid params) |
| 401    | Missing or invalid API key   |
| 404    | Resource not found           |
| 429    | Rate limit exceeded          |
| 500    | Server error                 |
