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

> [tab] 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
>
> ![Click Create API Key](https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/click-create-api-key.png?fit=max\&auto=format\&n=XCOjsFabz4gtaVHr\&q=85\&s=1d65c6e1db2607c1140989cd63a63f11)
>
> #### Step 2: Enter Credential Name
>
> Give your key a name (e.g., "trading-bot", "research")
>
> ![Enter API Credentials Name](https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/insert-api-credentials-name.png?fit=max\&auto=format\&n=XCOjsFabz4gtaVHr\&q=85\&s=e4967d6ec000e5983bd16e754b73acac)
>
> #### Step 3: Copy API Key ID and API Key Secret
>
> Copy both the **API Key ID** and **API Key Secret** from the dashboard.
>
> ![Copy API Credentials](https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/copy-api-credentials.png?fit=max\&auto=format\&n=XCOjsFabz4gtaVHr\&q=85\&s=642886a5c2ae710c704020976d04ee8d)
>
> > [!WARNING]
> >
> > Keep your API Key Secret secure. Never commit it to git or expose it publicly.
>
> ### 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,
>     timeout=30,
> )
>
> response.raise_for_status()
> payload = response.json()
> markets = payload["data"]
> print(f"Found {len(markets)} markets")
>
> # A full page may include a cursor for the next request.
> next_cursor = payload.get("next_cursor")
> ```
>
> See the REST API section in the sidebar for:
>
> * All endpoints (GET /markets, GET /fills)
> * Query parameters & filtering
> * Complete response examples

> [tab] SQL (ClickHouse) — Recommended
>
> ## SQL (ClickHouse) — Recommended
>
> 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
>
> ![Click Create ClickHouse Key](https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/click-create-clickhouse-key.png?fit=max\&auto=format\&n=XCOjsFabz4gtaVHr\&q=85\&s=8114ac4f842deea94d926c5b061af714)
>
> #### Step 2: Enter Credential Name
>
> Give your credentials a name (e.g., "research", "dashboard")
>
> ![Enter ClickHouse Credentials Name](https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/insert-clickhouse-credentials-name.png?fit=max\&auto=format\&n=XCOjsFabz4gtaVHr\&q=85\&s=ec8dfab4c3d6cd88ee41ddf6eed921d1)
>
> #### Step 3: Copy Username and Password
>
> Copy both the username and password generated for you.
>
> ![Copy ClickHouse Credentials](https://mintcdn.com/probalytics/XCOjsFabz4gtaVHr/public/images/quickstart/copy-clickhouse-credentials.png?fit=max\&auto=format\&n=XCOjsFabz4gtaVHr\&q=85\&s=32c684b004dbeefebdd0195f39d7995c)
>
> ### 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.
>
> ### 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](https://docs.probalytics.io/docs/sql-guide/overview.md) for:
>
> * More connection tools (CLI, JavaScript, Go, DBeaver)
> * Table schemas
> * Query examples
> * Performance tips

## Which Method Should I Use?

**REST API**

* ✓ Simple to integrate
* ✓ Good for production applications
* ✓ Markets and fills over JSON
* ✗ Limited query flexibility

**SQL (ClickHouse) — Recommended**

* ✓ Complex queries and analytics
* ✓ Aggregations and joins
* ✓ Paid ClickHouse tiers have full markets/fills history; trials normally receive seven days of fills
* ✓ Super fast analytics

## Next Steps

> [card] [SQL Guide](https://docs.probalytics.io/docs/sql-guide/overview.md)
>
> Tables, schemas, query templates

> [card] [REST Errors](https://docs.probalytics.io/docs/api-reference/errors.md)
>
> Error bodies and pagination behavior

> [card] [S3 Data Files](https://docs.probalytics.io/docs/file-downloads/overview.md)
>
> Bulk Parquet exports over S3


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.