Skip to main content
This guide reads one Solana token, fetches its candles, and streams its trades live. It uses BONK (DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263) as the example token.
1

Set your API key

If you have no key yet, see Get an API key. Then export it in your shell:
2

Read a token

Request the token object. Every request sends the key as a bearer token.
The response is the token object. This one is shortened:
Prices and amounts are decimal strings, and every priced value carries both a native and a usd value. Reading responses explains each convention.
3

Fetch candles

Request the last 24 hourly candles, priced in USD:
Candles come oldest first, and time is the bucket’s open time in milliseconds. A bucket with no trades is left out.
4

Stream live trades

Install wscat, then connect with your key on the handshake:
Once connected, send a subscribe frame:
The server confirms the subscription:
Then it sends one update frame per trade:
Each update’s data is the trade object the REST trades endpoint returns. A subscription by token leaves out flags and platforms; see spot.trades.

Next steps

Reading responses

Prices, decimals, percentages and timestamps.

Connecting to streams

Every frame, every channel, and how to reconnect.

Errors, limits and retries

Handle every error code correctly, and stay inside the limits.

Token trades

Page through a token’s full trade history.