> ## 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.

# Getting Started

> Create an API key, install the SDK or CLI, and make your first request to the EntityML Market Data API.

## 1. Create an API key

To authenticate your requests you need an API key.

<Steps>
  <Step title="Go to your Dashboard">
    Navigate to your [Dashboard](https://entityml.com/dashboard) and sign in.
  </Step>

  <Step title="Open API Keys">
    Click **API Keys** in the sidebar.
  </Step>

  <Step title="Create a new key">
    Click **Create New API Key** and give it a name.
  </Step>

  <Step title="Copy your key">
    Copy the API key immediately — it won't be shown again.
  </Step>
</Steps>

## 2. Install the SDK and CLI (preferred)

The Python client and terminal CLI ship in the same `entityml` package.

<Note>
  The previous split-package naming has changed. Use `pip install entityml`; you do not need a separate CLI package.
</Note>

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

  ```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>

## Historical coverage

* 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 April 2026 quality exceptions.

The best way to confirm what exists for a specific market is to call the corresponding date-range endpoint first:

* `GET /api/v1/polymarket/market/date-range`
* `GET /api/v1/kalshi/market/date-range`

For known parser and collector gap windows, see [Data Quality](/data-quality).

### Look up condition IDs from a Polymarket slug

If you only have a Polymarket slug, copy it from the event URL:

`https://polymarket.com/event/<slug>`

Then use the API lookup endpoint:

```python theme={null}
import requests

slug = "will-bitcoin-reach-100k"

response = requests.get(
    "https://api.entityml.com/api/v1/lookup/slug",
    params={"slug": slug},
    timeout=30,
)
response.raise_for_status()

for market in response.json()["markets"]:
    print(market["question"], market["conditionId"])
```

See [Look Up Polymarket Slug](/api-reference/endpoint/get-polymarket-slug-lookup) for the full response format.

## 3. Make your first request with the Python SDK

```python theme={null}
from entityml import EntityMLClient

client = EntityMLClient(api_key="YOUR_API_KEY")

polymarket_data = client.polymarket.get_market_data(
    condition_id="0x8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4",
    date="2026-02-13",
)

kalshi_data = client.kalshi.get_market_data(
    ticker="KXBTC-26FEB2606-B60125",
    date="2026-02-26",
)

print(polymarket_data["data_count"], kalshi_data["data_count"])
```

For full SDK usage, see [Python SDK](/sdk-python).

## 4. Make your first request with the CLI

```bash theme={null}
export ENTITY_API_KEY="YOUR_API_KEY"

entityml polymarket market-data \
  --condition-id 0x8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4 \
  --date 2026-02-13

entityml kalshi market-data \
  --ticker KXBTC-26FEB2606-B60125 \
  --date 2026-02-26
```

For the full command reference, see [CLI](/cli).

## 5. Raw HTTP fallback

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.entityml.com/api/v1/polymarket/market/data?condition_id=8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4&date=2026-02-13"
```

## 6. Raw HTTP code examples

<CodeGroup>
  ```python Python theme={null}
  import os
  import requests

  def get_market_data():
      api_key = os.environ.get('ENTITY_API_KEY')

      headers = {
          'Authorization': f'Bearer {api_key}'
      }

      params = {
          'condition_id': '8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4',
          'date': '2026-02-13'
      }

      response = requests.get(
          'https://api.entityml.com/api/v1/polymarket/market/data',
          headers=headers,
          params=params
      )

      return response.json()

  # Example usage
  data = get_market_data()
  print(data)
  ```

  ```typescript TypeScript theme={null}
  import fetch from 'node-fetch';

  interface MarketDataResponse {
    market_condition_id: string;
    date: string;
    data_count: number;
    data: Array<Record<string, unknown>>;
    pagination: {
      offset: number;
      limit: number;
      total_count: number;
      has_more: boolean;
    };
  }

  async function getMarketData(): Promise<MarketDataResponse> {
    const apiKey = process.env.ENTITY_API_KEY;

    const params = new URLSearchParams({
      condition_id: '8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4',
      date: '2026-02-13'
    });

    const response = await fetch(
      `https://api.entityml.com/api/v1/polymarket/market/data?${params}`,
      {
        headers: {
          'Authorization': `Bearer ${apiKey}`
        }
      }
    );

    return response.json() as Promise<MarketDataResponse>;
  }

  // Example usage
  getMarketData().then(data => console.log(data));
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  def get_market_data
    api_key = ENV['ENTITY_API_KEY']

    uri = URI('https://api.entityml.com/api/v1/polymarket/market/data')
    params = {
      condition_id: '8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4',
      date: '2026-02-13'
    }
    uri.query = URI.encode_www_form(params)

    request = Net::HTTP::Get.new(uri)
    request['Authorization'] = "Bearer #{api_key}"

    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(request)
    end

    JSON.parse(response.body)
  end

  # Example usage
  data = get_market_data
  puts data
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "io"
      "net/http"
      "os"
  )

  type MarketDataResponse struct {
      MarketConditionID string                   `json:"market_condition_id"`
      Date              string                   `json:"date"`
      DataCount         int                      `json:"data_count"`
      Data              []map[string]interface{} `json:"data"`
  }

  func getMarketData() (*MarketDataResponse, error) {
      apiKey := os.Getenv("ENTITY_API_KEY")

      url := "https://api.entityml.com/api/v1/polymarket/market/data"
      url += "?condition_id=8213d395e079614d6c4d7f4cbb9be9337ab51648a21cc2a334ae8f1966d164b4"
      url += "&date=2026-02-13"

      req, err := http.NewRequest("GET", url, nil)
      if err != nil {
          return nil, err
      }

      req.Header.Set("Authorization", "Bearer "+apiKey)

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          return nil, err
      }
      defer resp.Body.Close()

      body, err := io.ReadAll(resp.Body)
      if err != nil {
          return nil, err
      }

      var data MarketDataResponse
      err = json.Unmarshal(body, &data)
      if err != nil {
          return nil, err
      }

      return &data, nil
  }

  func main() {
      data, err := getMarketData()
      if err != nil {
          fmt.Println("Error:", err)
          return
      }
      fmt.Printf("%+v\n", data)
  }
  ```
</CodeGroup>

## 7. Demo

Watch the walkthrough to see the API in action:

<iframe src="https://www.loom.com/embed/a105accc8a1049e2b062578a9e84d283?sid=b9966280-b8be-419a-ba4f-c2e3e0684672" width="100%" height="400" frameBorder="0" allowFullScreen />

The `entityml` package repository includes the SDK and CLI source, packaging configuration, and examples:

<Card title="entityml on GitHub" icon="github" href="https://github.com/anaygupta2004/entityml">
  Use the source repository for local development and package release history.
</Card>
