Skip to content

Frames

All client commands and server responses are JSON objects with an op field.

Authenticate

Pass the API key in the URL, or send it as the first message:

json
{ "op": "auth", "key": "tsk_live_..." }

Use the message form when you do not want the key in the WebSocket URL.

Subscribe

json
{
  "op": "subscribe",
  "id": 1,
  "stream": "token_trades",
  "params": {
    "mint": "DD9e...",
    "detail": "full"
  }
}
FieldDescription
opMust be "subscribe"
idClient correlation id; server responses to the command carry it
streamOne of the eight stream names
paramsStream-specific target, filters, and detail options
cursorOptional replay cursor, beside stream rather than inside params

The server acknowledges a successful subscription and assigns its id:

json
{ "op": "ack", "id": 1, "sub": "tt_1" }

Use sub to match later events and to unsubscribe.

Parameter validation

  • A list accepts at most 50 values.
  • A string accepts at most 64 characters.
  • Unknown parameters fail with invalid_params, so misspellings are not silently ignored.
  • Required stream targets (mint or wallet) must be valid Solana addresses.

Event

json
{
  "op": "event",
  "sub": "tt_1",
  "stream": "token_trades",
  "cursor": "436312304:15:0",
  "data": {}
}
FieldDescription
subSubscription that produced the event
streamStream name
cursorEvent position used for replay after reconnecting
dataStream-specific payload

Unsubscribe

json
{ "op": "unsubscribe", "id": 2, "sub": "tt_1" }

The sub value is the id returned by the subscription acknowledgement.

Check the connection

json
{ "op": "ping", "id": 3 }

The server replies:

json
{ "op": "pong", "id": 3 }

WebSocket protocol pings are sent as well. The JSON command is useful through proxies that consume protocol-level pings.

Errors and notices

Errors include the id of the command that caused them. Notices are asynchronous and usually include the affected sub. See Errors & notices.

Realtime Solana data API