Skip to content

Messages

See Connecting for how they fit together.

{ "id": 1, "method": "tokens.get", "params": { ... } }
Key Description
id A number or a string. Names the reply, and the subscription if the method makes one
method The method to call
params The method’s params. Can be left out when there are none

Every message also has credits_used, see Credits.

Message When
{ "hello": { "version": 2, "height", "timestamp_millis", "limits" } } First, once
{ "id": 1, "result": { ... } } The reply to request 1
{ "id": 1, "error": { "code", "message" } } Request 1 failed. A subscription it would have made doesn’t exist
{ "sub": 1, "height", "timestamp_millis", ... } A push of the subscription request 1 made
{ "sub": 1, "end": { "code", "message" } } The server ended subscription 1
{ "idle": { "height", "timestamp_millis" } } After 15 seconds with nothing else sent
Code Why
1008 The client sent a binary message, or one that isn’t a JSON object with an id and a method
1006 The connection dropped without a close frame, as it does when the client sends a message too large

Ends a subscription, so its id can be used again.

Param Description
sub Required. The subscription’s id

The result is {}.

Takes no params. HTTP: /schema. The result describes the whole API, for checking a client against and generating types from:

  • version: the protocol version, as in hello;
  • token_fields: every token field with its type and kind, and whether it works in where, sort and min_change;
  • windows, thresholds, intervals_ms and limits;
  • trade_fields, transfer_fields and transaction_fields;
  • methods: every method’s params, and its HTTP path if it has one.