For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Reference

Full reference for the Solana Market Data streaming API: methods, topics, parameters, and response fields, with examples in JavaScript and Python.

This section documents every method and topic exposed by the Solana Market Data streaming API.

The API has just two methods — getblock_subscribe and getblock_unsubscribe. What you receive is decided by the topic you subscribe to. Each topic has its own page below covering its parameters, a live sample response, and every field it returns.

Quickstart

Subscribe to one-minute SOL/USDC candles, seeded with the last 10 and updated at most once a second:

{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "getblock_subscribe",
  "params": [
    {
      "source": "market",
      "topic": "ohlcv",
      "params": {
        "base": "So11111111111111111111111111111111111111112",
        "quote": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "window": "1m",
        "hydrate": 10,
        "throttle": "1s"
      }
    }
  ]
}

The service replies with a subscription ID, then pushes change sets:

{
  "jsonrpc": "2.0",
  "method": "getblock_subscribe",
  "params": {
    "subscription": "0x4503d281ca474f3322ed277fde75db15",
    "result": { "inserts": [ … ], "updates": [ … ], "deletes": [ … ] }
  }
}

Endpoint

The API key goes in the apiKey query parameter, not in a header. Create one in Dashboard → API Keys and confirm Solana Market Data is activated on it.

Methods

Method
Description

Open a subscription. Returns a subscription ID, then streams change sets.

Cancel one subscription without closing the socket.

Topics

Topic
Description
Requires

Normalized individual trades

—

Trading activity aggregated for one Solana slot

—

Open, high, low, close, and volume candles

window

Time-weighted average price

window

Volume-weighted average price

window

Trading volume and buy/sell activity

window

Token metadata

mint

Choosing a topic

If you need
Use

Individual trades and maximum calculation flexibility

trades

Market activity for each Solana slot

block

Candles or price charts

ohlcv

A price weighted by elapsed time

twap

A price weighted by traded volume

vwap

Buy, sell, and total market activity

volume

Token metadata

token

Concepts that apply to every topic

  1. The notification envelope: Row data is nested under params.result, not result. Only the initial acknowledgment uses a top-level result, and it is a plain string — the subscription ID.

  2. Change sets: Each notification can include up to three arrays. Maintain local state by upserting inserts and updates by id, then removing deletes by id. A property can be omitted when there are no changes of that type.

Change set
Description

inserts

New rows, including the initial hydrate snapshot.

updates

Full replacement rows for previously emitted IDs whose values changed.

deletes

Rows to remove from local state by id. Carries the whole row, not just the ID.

  1. hydrate sets the row-set size. It is not only the size of the opening snapshot — the subscription holds the set at that size, evicting the oldest rows through deletes as new ones arrive.

  1. Optimistic delivery: Rows are published before finality and revised in place. An insert is not final because it arrived first; the active window is re-sent through updates under the same id.

  2. Serialization: Numeric and timestamp values are strings, to preserve precision. id is a JSON number, booleans are JSON booleans, and durations use ISO 8601 format (1m comes back as PT1M). Ignore unknown fields for forward compatibility.

  3. One socket, many subscriptions: Send several getblock_subscribe requests on the same connection and route notifications on params.subscription.

Last updated

Was this helpful?