> For the complete documentation index, see [llms.txt](https://sodex.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sodex.com/documentation/for-developers/api-reference/json-rpc/eth-unsubscribe.md).

# eth\_unsubscribe

POST `wss://mainnet-ws.valuechain.xyz`

Cancels a WebSocket subscription.

Send over the same WebSocket connection that created the subscription.

## Parameters

| Name             | Type | Required | Description                     |
| ---------------- | ---- | -------- | ------------------------------- |
| `subscriptionId` | data | Yes      | ID returned by `eth_subscribe`. |

## Result

**Unsubscribed** (boolean): `true` if the subscription existed and was removed.

## Example

### Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

## Code examples

### cURL

```bash
curl --request POST \
  --url wss://mainnet-ws.valuechain.xyz \
  --header 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_unsubscribe", "params": ["0x1"]}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "eth_unsubscribe", "params": ["0x1"]})
};

fetch('wss://mainnet-ws.valuechain.xyz', options)
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

### Python

```python
import requests

url = "wss://mainnet-ws.valuechain.xyz"
payload = {
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_unsubscribe",
  "params": [
    "0x1"
  ]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
```
