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
Open a subscription. Returns a subscription ID, then streams change sets.
Cancel one subscription without closing the socket.
Topics
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
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
The notification envelope: Row data is nested under
params.result, notresult. Only the initial acknowledgment uses a top-levelresult, and it is a plain string — the subscription ID.Change sets: Each notification can include up to three arrays. Maintain local state by upserting
insertsandupdatesbyid, then removingdeletesbyid. A property can be omitted when there are no changes of that type.
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.
hydratesets 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 throughdeletesas 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.
Optimistic delivery: Rows are published before finality and revised in place. An
insertis not final because it arrived first; the active window is re-sent throughupdatesunder the sameid.Serialization: Numeric and timestamp values are strings, to preserve precision.
idis a JSON number, booleans are JSON booleans, and durations use ISO 8601 format (1mcomes back asPT1M). Ignore unknown fields for forward compatibility.One socket, many subscriptions: Send several
getblock_subscriberequests on the same connection and route notifications onparams.subscription.
Last updated
Was this helpful?