# getblock_unsubscribe - Solana Market Data

> Cancel an active Solana Market Data subscription. Complete guide on how to use getblock_unsubscribe in GetBlock Solana Market Data documentation.

`getblock_unsubscribe` cancels a subscription created with [`getblock_subscribe`](/solana-market-data/api-reference/getblock_subscribe-market-data/). Delivery for that subscription stops immediately and the subscription ID is no longer valid. Other subscriptions on the same socket are unaffected.

> **Warning:** **WebSocket-only method.** Send it on the same connection that owns the subscription.

## Parameters

`params` is an array containing exactly **one object**:

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `subscription` | string | Yes | The subscription ID returned by `getblock_subscribe`. |

> **Danger:** The subscription ID must be wrapped in an object — `[{"subscription": "0x…"}]`. Passing the ID as a bare string, as Solana's own `*Unsubscribe` methods accept, fails with `getblock_unsubscribe params must contain one object`.

## Request Example

#### wscat

```bash
wscat -c 'wss://stream.eu-central-1.getblock.io/v1/solana-mainnet/stream?apiKey=<API-KEY>'
# WebSocket-only. On the connection that owns the subscription, send:
{"jsonrpc":"2.0","id":"getblock.io","method":"getblock_unsubscribe","params":[{"subscription":"0x4503d281ca474f3322ed277fde75db15"}]}
```

#### JavaScript

```javascript
ws.send(JSON.stringify({
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'getblock_unsubscribe',
  params: [{ subscription: subscriptionId }]
}));
```

#### Python

```python
await ws.send(json.dumps({
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "getblock_unsubscribe",
    "params": [{"subscription": subscription_id}]
}))
```

## Response Example

```json
{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": true
}
```

## Response Parameters

| Field | Type | Description |
| --- | --- | --- |
| `result` | boolean | `true` when the subscription was cancelled. No further notifications are delivered for it. |

## Use Cases

* Switching a chart or dashboard from one market pair or window to another
* Releasing streams a user has navigated away from without dropping the socket
* Managing several subscriptions on one connection independently
* Tearing down cleanly on component unmount

## Error Handling

| Code | Message | Cause |
| --- | --- | --- |
| `-32602` | `getblock_unsubscribe params must contain one object` | `params` was empty, held more than one entry, or the entry was not an object — for example a bare ID string. |
| `-32602` | `subscription is required` | The object was passed without a `subscription` field. Note that `id` is not an accepted alias. |
