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

# API Reference

> Base URL, authentication, and conventions for the EntityML Market Data API.

## Base URL

All API requests are made to:

```
https://api.entityml.com/api/v1
```

Primary historical data endpoints:

* `GET /polymarket/market/data`, `GET /polymarket/market/data/range`, `GET /polymarket/market/orderbook-summary`, `GET /polymarket/market/list`, and `GET /polymarket/market/date-range` for Polymarket
* `GET /kalshi/market/data`, `GET /kalshi/market/data/range`, `GET /kalshi/market/orderbook-summary`, `GET /kalshi/market/list`, and `GET /kalshi/market/date-range` for Kalshi
* `GET /lookup/slug` for resolving a Polymarket slug into one or more condition IDs
* `/keys`, `/subscriptions`, `/usage`, `/user/{user_id}/requests/*`, and `/stats/*` for key management, billing, and usage analytics
* `GET /health` for an unauthenticated service health check
* `GET /monitoring/status` for infrastructure status used by the public status page

Legacy aliases remain available for existing integrations:

* `GET /market/data` as an alias of `GET /polymarket/market/data`
* `GET /market/data/range` as an alias of `GET /polymarket/market/data/range`
* `GET /market/orderbook-summary` as an alias of `GET /polymarket/market/orderbook-summary`
* `GET /polymarket/lookup/slug` as an alias of `GET /lookup/slug`

## Preferred clients

Use the official SDK or CLI for most integrations. They handle base URL conventions, auth headers, and common parameter patterns for you.

<CodeGroup>
  ```bash Python SDK (pip) theme={null}
  python3 -m pip install --upgrade entityml
  ```

  ```bash CLI included theme={null}
  entityml health
  ```

  ```bash Homebrew + pip theme={null}
  brew install python
  python3 -m pip install --upgrade entityml
  ```

  ```bash GitHub installs (latest main) theme={null}
  python3 -m pip install --upgrade "git+https://github.com/anaygupta2004/entityml.git"
  ```

  ```bash cURL downloads from GitHub theme={null}
  curl -L https://github.com/anaygupta2004/entityml/archive/refs/heads/main.tar.gz -o entityml.tar.gz
  tar -xzf entityml.tar.gz
  python3 -m pip install ./entityml-main
  ```
</CodeGroup>

## Authentication

Historical market endpoints require API key authentication via a Bearer token in the `Authorization` header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

Exceptions:

* `GET /health` does not require authentication
* `GET /lookup/slug` does not require authentication
* API key management endpoints under `/keys` do not use Bearer auth; they use the documented `user_id` and `key_id` parameters instead

You can create API keys from your [Dashboard](https://entityml.com/dashboard). See [Getting Started](/getting-started) for the basic flow.

Raw HTTP examples are included throughout the reference, but SDK/CLI examples are the preferred path.

## Request format

* All requests use standard query parameters or path parameters.
* All responses return JSON.
* Dates are formatted as `YYYY-MM-DD` and interpreted in UTC.
* Polymarket `condition_id` values are accepted with or without the `0x` prefix and are normalized in responses.
* Kalshi `ticker` and `prefix` values are normalized to uppercase.
* Range endpoints accept Unix seconds or milliseconds and use inclusive `start_timestamp` and `end_timestamp` bounds.
* Date-scoped endpoints use offset pagination and return `offset`, `limit`, `total_count`, and `has_more`.
* Range endpoints use cursor pagination and return `limit`, `has_more`, and `next_cursor`.
* Polymarket orderbook summaries require `asset_id` because each condition can contain multiple outcome token books.
* You can find Polymarket `asset_id` values by reading a small raw data page and collecting the unique `asset_id` fields.
* Orderbook summary buckets include close values plus OHLC candles for `best_bid`, `best_ask`, `mid_price`, and `spread`.
* Orderbook summary endpoints accept either a UTC `date` or inclusive `start_timestamp` / `end_timestamp` bounds. Choose the bucket size with `resolution`.

## Availability and coverage

Storage coverage is market-specific. The most reliable way to discover availability is to call the corresponding date-range endpoint first.

* Orderbook data exists for a subset of markets from **2025-09-01** on Polymarket and **2026-02-17** for Kalshi, but coverage is not continuous.
* Broad Polymarket crypto-related market coverage begins on **2026-02-04**. Broad Kalshi crypto-related market coverage begins on **2026-02-25**.
* Broad all-market capture begins on **2026-04-02** for Polymarket and **2026-03-31** for Kalshi, with known Kalshi parser and May 2026 storage-gap exceptions.
* `GET /polymarket/market/date-range` tells you which Polymarket UTC dates are present for a condition ID.
* `GET /kalshi/market/date-range` tells you which Kalshi UTC dates are present for a ticker.
* `GET /polymarket/market/data` currently rejects dates earlier than `2026-02-08`, even if older backfilled Polymarket dates exist in storage for some markets.
* See [Data Quality](/data-quality) for the Kalshi March 31-April 24 parser issue, the Kalshi May 4-May 11 storage ingestion gap, and the Polymarket April gap notes.

## Rate limits

Billable historical market endpoints may return `429 Too Many Requests` when a plan usage limit is reached. See [Error Responses](/errors) for the actual payload shape.
