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

# Quickstart

> Get started with Probalytics in 2 minutes

Choose your access method and get working code in 2 minutes.

<Tabs>
  <Tab title="REST API">
    ## REST API

    Query prediction market data via HTTP with simple authentication.

    ### Setup (1 min)

    #### Step 1: Click "Create API Key"

    Go to [app.probalytics.io](https://app.probalytics.io) → API Keys section

    <Frame>
      <img src="https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/click-create-api-key.png?fit=max&auto=format&n=XCOjsFabz4gtaVHr&q=85&s=1d65c6e1db2607c1140989cd63a63f11" alt="Click Create API Key" width="2316" height="1210" data-path="public/images/quickstart/click-create-api-key.png" />
    </Frame>

    #### Step 2: Enter Credential Name

    Give your key a name (e.g., "trading-bot", "research")

    <Frame>
      <img src="https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/insert-api-credentials-name.png?fit=max&auto=format&n=XCOjsFabz4gtaVHr&q=85&s=e4967d6ec000e5983bd16e754b73acac" alt="Enter API Credentials Name" width="1336" height="962" data-path="public/images/quickstart/insert-api-credentials-name.png" />
    </Frame>

    #### Step 3: Copy API Key ID and API Key Secret

    Copy both the **API Key ID** and **API Key Secret** from the dashboard.

    <Frame>
      <img src="https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/copy-api-credentials.png?fit=max&auto=format&n=XCOjsFabz4gtaVHr&q=85&s=642886a5c2ae710c704020976d04ee8d" alt="Copy API Credentials" width="1346" height="1326" data-path="public/images/quickstart/copy-api-credentials.png" />
    </Frame>

    <Warning>
      Keep your API Key Secret secure. Never commit it to git or expose it publicly.
    </Warning>

    ### Make Your First Request

    Concatenate **API Key ID** and **API Key Secret** with a colon in the `Authorization` header:

    ```
    Authorization: Bearer API_KEY_ID:API_KEY_SECRET
    ```

    ```python theme={null}
    import requests

    API_KEY_ID = "api_brave_cosmic_falcon"
    API_KEY_SECRET = "sk_life_AbCdEfGh..."
    API_KEY = f"{API_KEY_ID}:{API_KEY_SECRET}"

    headers = {"Authorization": f"Bearer {API_KEY}"}

    response = requests.get(
        "https://api.probalytics.io/api/v1/markets",
        headers=headers
    )

    markets = response.json()
    print(f"Found {len(markets)} markets")
    ```

    See the REST API section in the sidebar for:

    * All endpoints (GET /markets, GET /fills)
    * Query parameters & filtering
    * Complete response examples
  </Tab>

  <Tab title="SQL (ClickHouse)">
    ## SQL (ClickHouse)

    Direct database access for analytics, batch operations, and complex queries.

    ### Setup (2 min)

    #### Step 1: Click "Create ClickHouse Credentials"

    Go to [app.probalytics.io](https://app.probalytics.io) → ClickHouse Credentials section

    <Frame>
      <img src="https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/click-create-clickhouse-key.png?fit=max&auto=format&n=XCOjsFabz4gtaVHr&q=85&s=8114ac4f842deea94d926c5b061af714" alt="Click Create ClickHouse Key" width="2362" height="1218" data-path="public/images/quickstart/click-create-clickhouse-key.png" />
    </Frame>

    #### Step 2: Enter Credential Name

    Give your credentials a name (e.g., "research", "dashboard")

    <Frame>
      <img src="https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/insert-clickhouse-credentials-name.png?fit=max&auto=format&n=XCOjsFabz4gtaVHr&q=85&s=ec8dfab4c3d6cd88ee41ddf6eed921d1" alt="Enter ClickHouse Credentials Name" width="1304" height="960" data-path="public/images/quickstart/insert-clickhouse-credentials-name.png" />
    </Frame>

    #### Step 3: Copy Username and Password

    Copy both the username and password generated for you.

    <Frame>
      <img src="https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/copy-clickhouse-credentials.png?fit=max&auto=format&n=XCOjsFabz4gtaVHr&q=85&s=32c684b004dbeefebdd0195f39d7995c" alt="Copy ClickHouse Credentials" width="1266" height="1222" data-path="public/images/quickstart/copy-clickhouse-credentials.png" />
    </Frame>

    ### Connection Details

    * **Host**: `clickhouse.probalytics.io`
    * **Port**: `9440` (Secure TCP) or `8443` (Secure HTTPS)
    * **Database**: `probalytics`
    * **Username**: From dashboard
    * **Password**: From dashboard

    <Note>
      All connections are secured with TLS encryption. Use the secure ports and enable TLS/SSL in your client.
    </Note>

    ### Connect with CLI

    ```bash theme={null}
    clickhouse client --host=clickhouse.probalytics.io --secure --port=9440 --user=YOUR_USERNAME --password=YOUR_PASSWORD --database=probalytics
    ```

    ### Connect with Python

    Install first: `pip install clickhouse-driver`

    ```python theme={null}
    from clickhouse_driver import Client

    client = Client(
        host='clickhouse.probalytics.io',
        port=9440,
        user='YOUR_USERNAME',
        password='YOUR_PASSWORD',
        database='probalytics',
        secure=True
    )

    result = client.execute('SELECT count() FROM markets;')
    print(f"Total markets: {result[0][0]}")
    ```

    ### First Query

    ```sql theme={null}
    SELECT count() FROM markets;
    ```

    See [SQL Guide](/docs/sql-guide/overview) for:

    * More connection tools (CLI, JavaScript, Go, DBeaver)
    * Table schemas
    * Query examples
    * Performance tips
  </Tab>
</Tabs>

## Which Method Should I Use?

**REST API**

* ✓ Simple to integrate
* ✓ Good for production applications
* ✗ Limited query flexibility

**SQL (ClickHouse)**

* ✓ Complex queries and analytics
* ✓ Aggregations and joins
* ✓ Full historical data (Pro tier+)
* ✓ Super fast analytics

## Next Steps

<CardGroup cols={2}>
  <Card title="SQL Guide" icon="database" href="/docs/sql-guide/overview">
    Tables, schemas, query templates
  </Card>

  <Card title="Tutorials" icon="graduation-cap" href="/docs/tutorials/track-price-spreads">
    Real-world examples
  </Card>

  <Card title="Common Patterns" icon="code" href="/docs/common-patterns">
    Copy-paste recipes
  </Card>
</CardGroup>
