Skip to content
On this page

Action: Unsuscribe

It is possible to unsubscribe from a stream at any given time after authentication. This is done by sending an unsubscribe action to the server as described below. Make sure that you are already authenticated.

The unsubscribe action is very similar to the subscribe action, so please also refer to the Action: Subscribe section for more information on the Stream object.

Operation

In order to unsubscribe from any streams that you are subscribed to, you should send an unsubscribe action with an array of Stream objects (see above) as the "streams" property of the body, exactly like you would do for a subscribe action:

json
{
  "id": "1234567890", // optional, for your own reference
  "action": "unsubscribe",
  "body": {
    "streams": [
      {
        "eventType": "trade",
        "base": "BTC",
        "quote": "USDT"
      },
      {
        "eventType": "trade",
        "base": "BTC",
        "quote": "USDC"
      }
    ]
  }
}

Just like it worked with the subscribe action, multiple streams can be matched by a single Stream object. The server will unsubscribe you from all streams that match any of the provided Stream objects. If the server was able to successfully unsubscribe you, it will respond with a successful unsubscribe action-response:

json
{
  "id": "1234567890", // optional, for your own reference
  "action": "unsubscribe",
  "success": true
}