> For the complete documentation index, see [llms.txt](https://docs.getblock.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getblock.io/market-sql/getting-started.md).

# Getting Started

This guide walks you through the basic steps required to start using Market SQL.

### 1. Activate Market SQL

1. Log in to your [GetBlock account](https://account.getblock.io/)
2. Under **Products**, select **Market SQL**
3. Open the **Pricing** tab and choose an access plan for one dataset:

* **Free trial** — $0 for 2 hours
* **24-hour trial** — $29 for 24 hours
* **Monthly** — $299 per dataset per month
* **Custom** — contact sales

4. Once access is active, the dataset appears under **Your Market SQL access** on the **Overview** tab, with its status and end date.

{% hint style="info" %}
Each plan covers **one dataset**. To query more than one dataset, activate each one separately.
{% endhint %}

### 2. Get your credentials

Market SQL uses **HTTP Basic Auth** with your existing GetBlock credentials. Both values are shown on the **API Docs** tab.

<table data-search="false"><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><strong>Username</strong></td><td>Your GetBlock user ID</td></tr><tr><td><strong>Password</strong></td><td>A GetBlock API key in <code>gb_…</code> format</td></tr></tbody></table>

{% hint style="info" %}
**The user ID must belong to the account that owns the API key.**\
Need an API key? You can create one with **Create API key** on the [**API Docs**](https://account.getblock.io/products/sql#api-docs) tab.
{% endhint %}

{% hint style="warning" %}
Keep your API key secret. Store it in an environment variable or a secrets manager and never commit it to source control.
{% endhint %}

### 3. Choose a dataset

Each dataset is a separate database. Pass its name in the `database` parameter:

<table data-search="false"><thead><tr><th>Dataset</th><th>Database name</th></tr></thead><tbody><tr><td>Solana</td><td><code>solana</code></td></tr><tr><td>Polymarket</td><td><code>polymarket</code></td></tr><tr><td>Hyperliquid</td><td><code>hyperliquid</code></td></tr><tr><td>Robinhood Chain</td><td><code>robinhood</code></td></tr></tbody></table>

### 4. Run your first query

Market SQL exposes the **ClickHouse HTTP interface** over HTTPS, so you can connect with the tools you already use such as Python or Javascript

Start by inspecting real PumpSwap trades on Solana:

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --fail-with-body \
  --user "<USER-ID>:<API-KEY>" \
  "https://market-sql.eu-central-1.getblock.io?database=solana&default_format=JSONEachRow" \
  --data-binary "SELECT block_time, direction, base_token, quote_token FROM pumpswap_all_swaps LIMIT 5"
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
// npm install @clickhouse/client

import { createClient } from '@clickhouse/client'

const client = createClient({
  host: 'https://market-sql.eu-central-1.getblock.io',
  username: process.env.GETBLOCK_USER_ID,
  password: process.env.GETBLOCK_API_KEY,
  database: 'solana'
})

const rows = await client.query({
  query: `
    SELECT block_time, direction, base_token, quote_token
    FROM pumpswap_all_swaps
    LIMIT 5
  `,
  format: 'JSONEachRow'
})

console.log(await rows.json())
```

{% endtab %}

{% tab title="Python" %}

```python
# pip install clickhouse-connect

import os
import clickhouse_connect

client = clickhouse_connect.get_client(
    host='market-sql.eu-central-1.getblock.io',
    port=443,
    username=os.environ['GETBLOCK_USER_ID'],
    password=os.environ['GETBLOCK_API_KEY'],
    database='solana',
    secure=True,
)

df = client.query_df("""
    SELECT block_time, direction, base_token, quote_token
    FROM pumpswap_all_swaps
    LIMIT 5
""")
print(df)
```

{% endtab %}
{% endtabs %}

From there, you can filter, aggregate, and join tables to test a hypothesis without waiting for a new endpoint to be built.

### 5. Response

{% code overflow="wrap" %}

```bash
{
    "block_time": "2025-10-13 04:54:17",
    "block_date_utc": "2025-10-13",
    "slot": 373090867,
    "tx_idx": 3,
    "swap_idx": 9,
    "signature": "4BnrYwrNqVsbMQvdXrsjJAZCo24gmSDoU8tw13hgZm5u1P69HrYP4WT9FkfC4yF5EbCUoCteyeCQXK9o6LtDcPCL",
    "fee_payer": "2BhC9q2cdKUehmtJXoHtMvyhQ1vxodUHm3fsDuMfZAHJ",
    "provided_gas_fee": "10000",
    "provided_gas_limit": "120000",
    "fee": "6200",
    "consumed_gas": "75291",
    "pool_id": "D2izdr62stAqqmj7T9zJAJbX2oTRDAaYuap1zVHWMBCA",
    "signer": "2BhC9q2cdKUehmtJXoHtMvyhQ1vxodUHm3fsDuMfZAHJ",
    "direction": "B",
    "base_coin": "7MLMicE9WaY1BT6UxTkSTPSbKMwL3QtxXqXQLastXNgQ",
    "quote_coin": "So11111111111111111111111111111111111111112",
    "base_coin_amount": "35725002561",
    "quote_coin_amount": "502228929",
    "base_coin_slippage": "-175076707",
    "quote_coin_slippage": "0",
    "parent_program": "",
    "top_level_transfers_json": "[{\"from\":\"2BhC9q2cdKUehmtJXoHtMvyhQ1vxodUHm3fsDuMfZAHJ\",\"to\":\"7Ji8r5SrWQsGfAGgG1yckD4EzHwhcBwXhHEkK92EDc8T\",\"lamports\":\"502228929\"}]",
    "orig_base_coin_amount": "35725002561",
    "orig_quote_coin_amount": "502228929",
    "config": "HcuvFfW3aHLgQA2c31bHEMWjV8Xxtphaeq84SKarssUh",
    "trade_direction": "1",
    "has_referral": 1,
    "swap_amount0": "502228929",
    "swap_amount1": "35549925854",
    "swap_mode": "0",
    "input_amount": "502228929",
    "output_amount": "35725002561",
    "base_mint": "7MLMicE9WaY1BT6UxTkSTPSbKMwL3QtxXqXQLastXNgQ",
    "quote_mint": "So11111111111111111111111111111111111111112",
    "referral": "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN",
    "blockhash_prefix": "",
    "cu_price_ix_index": 0,
    "cu_limit_ix_index": 0,
    "num_signatures": 0,
    "transaction_version": 0,
    "lookup_tables": "",
    "curve_complete": 0,
    "base_reserve_after": "0",
    "quote_reserve_after": "0",
    "signers": []
}
```

{% endcode %}

### Explore the catalog in the dashboard

The easiest way to find the right table before writing code is the **Datasets** tab.

Use it to:

1. choose a dataset;
2. search tables by keyword, such as `swaps`, `wallet`, or `token creation`;
3. read each table's description;
4. copy the table name into your query.

### 5. Integrate it into your application

Once you know which tables you need, query them from your application, notebook, or data pipeline.

A typical workflow looks like this:

```mermaid
graph TD
  A[Choose a dataset] --> B[Find tables in the catalog]
  B --> C[Run an exploratory query]
  C --> D[Filter, aggregate, and join]
  D --> E[Use the results in your research or product]
```

You can track request volume, latency, data transfer, and dataset usage in the **Analytics** tab.

For endpoint details, parameters, and plan limits, continue to [**Querying Market SQL**](/market-sql/querying-market-sql.md) or see the [**API Reference**](/market-sql/api-reference.md).
