# stellar_unsubscribe

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

WebSocket · Send JSON-RPC messages after opening a connection.

Stellar Mainnet: wss://stellar-mainnet.g.alchemy.com/v2/YOUR_API_KEY
Stellar Testnet: wss://stellar-testnet.g.alchemy.com/v2/YOUR_API_KEY

WebSocket only. Send positional params containing the subscription ID returned by stellar_subscribe on this connection. The result is true if removed, false if not found. Already-in-flight notifications may arrive while unsubscribing. Other subscriptions stay active. Closing the connection ends every subscription; recreate subscriptions after reconnecting.

```json
{"jsonrpc":"2.0","id":60,"method":"stellar_unsubscribe","params":["0x0123456789abcdef0123456789abcdef"]}
```

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

Reference: https://www.alchemy.com/docs/chains/stellar/websocket/stellar-unsubscribe

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| subscriptionId | string | Yes | The opaque ID from this connection. |

## Result

**removed** (boolean): Whether a subscription was removed.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "stellar_unsubscribe",
  "params": [
    "0x0123456789abcdef0123456789abcdef"
  ],
  "id": 1
}
```

### Response

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

## OpenRPC Method Specification

```yaml
name: stellar_unsubscribe
summary: Stop a Stellar subscription on the current WebSocket connection
description: |-
  WebSocket only. Send positional params containing the subscription ID returned by stellar_subscribe on this connection. The result is true if removed, false if not found. Already-in-flight notifications may arrive while unsubscribing. Other subscriptions stay active. Closing the connection ends every subscription; recreate subscriptions after reconnecting.

  ```json
  {"jsonrpc":"2.0","id":60,"method":"stellar_unsubscribe","params":["0x0123456789abcdef0123456789abcdef"]}
  ```

  ```json
  {"jsonrpc":"2.0","id":60,"result":true}
  ```
paramStructure: by-position
x-api-explorer: false
params:
  - name: subscriptionId
    required: true
    schema:
      type: string
      minLength: 1
    description: The opaque ID from this connection.
result:
  name: removed
  description: Whether a subscription was removed.
  schema:
    type: boolean
errors:
  - code: -32602
    message: Invalid params
examples:
  - name: Unsubscribe
    params:
      - name: subscriptionId
        value: '0x0123456789abcdef0123456789abcdef'
    result:
      name: removed
      value: true
```
