API Reference

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:

json{
  "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:

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

Endpoint

bashwss://stream.eu-central-1.getblock.io/v1/solana-mainnet/stream?apiKey=<API-KEY>

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

MethodDescription
getblock_subscribeOpen a subscription. Returns a subscription ID, then streams change sets.
getblock_unsubscribeCancel one subscription without closing the socket.

Topics

TopicDescriptionRequires
tradesNormalized individual trades—
blockTrading activity aggregated for one Solana slot—
ohlcvOpen, high, low, close, and volume candleswindow
twapTime-weighted average pricewindow
vwapVolume-weighted average pricewindow
volumeTrading volume and buy/sell activitywindow
tokenToken metadatamint

The token topic is currently not returning data — a subscription to it receives no acknowledgement, no data, and no error. See its page for details and a workaround.

Choosing a topic

If you needUse
Individual trades and maximum calculation flexibilitytrades
Market activity for each Solana slotblock
Candles or price chartsohlcv
A price weighted by elapsed timetwap
A price weighted by traded volumevwap
Buy, sell, and total market activityvolume
Token metadatatoken

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 setDescription
insertsNew rows, including the initial hydrate snapshot.
updatesFull replacement rows for previously emitted IDs whose values changed.
deletesRows 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.

A row in deletes is not by itself evidence of a chain reorganization. On fast-moving topics such as trades and block, most deletes are ordinary eviction from the hydrate window.

  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.