> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rails.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscribe

This request adds one or more streams to the current WebSocket connection.

#### Request

```json theme={null}
{
  "message":"subscribe",
  "content":{
    "clientRequestId":"cfff0f58-8780-4cf2-b3d3-6439fed37304",
    "subscriptions":[
      "trades",
      "publicTrades",
      "publicOrderBook"
    ]
  }
}
```

| Field                     | Type   | Required | Description                           |
| ------------------------- | ------ | -------- | ------------------------------------- |
| `message`                 | string | Yes      | `subscribe`                           |
| `content.clientRequestId` | string | No       | Client-generated UUID for correlation |
| `content.subscriptions`   | array  | Yes      | One or more subscriptions to add      |

#### Response

```json theme={null}
{
    "resultType": "subscribed",
    "data": {
        "activeSubscriptions": [
            "orders",
            "trades",
            "publicTrades",
            "publicOrderBook"
        ],
        "clientRequestId": "cfff0f58-8780-4cf2-b3d3-6439fed37304",
        "requestedSubscriptions": [
            "trades",
            "publicTrades",
            "publicOrderBook"
        ]
    }
}
```

| Field                         | Type   | Required | Description                                                |
| ----------------------------- | ------ | -------- | ---------------------------------------------------------- |
| `resultType`                  | string | Yes      | `subscribed`                                               |
| `data.activeSubscriptions`    | array  | Yes      | All currently active subscriptions after the operation     |
| `data.clientRequestId`        | string | No       | Client-generated UUID for correlation                      |
| `data.requestedSubscriptions` | array  | Yes      | The specific subscriptions that were requested to be added |

#### Allowed Subscription Values

| Subscription Value | Description                                                       |
| ------------------ | ----------------------------------------------------------------- |
| `orders`           | Order creation and cancellation requests and notifications        |
| `trades`           | Real-time trade updates for your account                          |
| `publicTrades`     | Real-time trade updates and snapshots for subscribed markets      |
| `publicOrderBook`  | Real-time order book updates and snapshots for subscribed markets |

#### Behavior

* Only new subscriptions are added to the connection
* Re-subscribing to an already active subscription is a no-op
* Existing subscriptions remain unaffected
* Changes apply immediately
* Safe to call repeatedly (idempotent)
* Does not affect other connections
* Does not require reconnecting
