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

# Subscribe

> Send a subscription request to begin a stream of data from the Prime WebSocket API.

<Note>Public channel. Connect to: `wss://wss.prime.kraken.com/ws/v1`</Note>

Send a subscription request to begin a stream of data. An example request that subscribes to data.

## Request

<Tabs>
  <Tab title="Request Schema">
    <ParamField path="reqid" type="number" required>
      Request ID - will be echoed back in the response structure.
    </ParamField>

    <ParamField path="type" type="string" required>
      Request type for initializing a subscription. Value: `subscribe`
    </ParamField>

    <ParamField path="tag" type="string">
      Optional user generated tag to attach to stream data.
    </ParamField>

    <ParamField path="streams" type="array" required>
      Streams to subscribe to.

      <Expandable title="properties">
        <ParamField path="name" type="string" required>
          Subscription name (e.g., "Security", "MarketDataSnapshot", "ExecutionReport").
        </ParamField>

        <ParamField path="..." type="various">
          Any required or optional parameters described for the subscription names.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField path="ts" type="string">
      An ISO-8601 UTC string of the form `2019-02-13T05:17:32.000000Z`.
    </ParamField>
  </Tab>

  <Tab title="Example">
    ```json theme={null}
    {
      "reqid": 1,
      "type": "subscribe",
      "streams": [
        {
          "name": "MarketDataSnapshot",
          "Symbol": "BTC-USD"
        }
      ],
      "ts": "2019-02-13T05:17:32.000000Z"
    }
    ```
  </Tab>
</Tabs>

## Response

<Tabs>
  <Tab title="Response Schema">
    <ParamField path="reqid" type="number" required>
      A number that relates this response to a request.
    </ParamField>

    <ParamField path="seqNum" type="number" required>
      The sequence number for this response per request. seqNum begins at 1 on the first message with this reqid and increments by one for each message sent on this reqid.
    </ParamField>

    <ParamField path="type" type="string" required>
      The type of message sent. This document describes all valid message types.
    </ParamField>

    <ParamField path="tag" type="string">
      An optional tag from the stream request.
    </ParamField>

    <ParamField path="ts" type="string" required>
      An ISO-8601 UTC string of the form `2019-02-13T05:17:32.000000Z`.
    </ParamField>

    <ParamField path="initial" type="boolean">
      If this is initial data for a request, the initial flag will be set.
    </ParamField>

    <ParamField path="action" type="string">
      "Update" or "Remove" - tells the client if the given entity should be removed or added/updated.
    </ParamField>

    <ParamField path="total_count" type="number">
      The total number of records for this stream.
    </ParamField>

    <ParamField path="data" type="array" required>
      Array of response data structured per subscription type.
    </ParamField>

    <ParamField path="next" type="string">
      If paging, tag for next page of data.
    </ParamField>
  </Tab>

  <Tab title="Example">
    ```json theme={null}
    {
      "reqid": 1,
      "type": "MarketDataSnapshot",
      "ts": "2026-06-17T11:27:06.865086Z",
      "initial": true,
      "seqNum": 1,
      "data": [
        {
          "Timestamp": "2026-06-17T11:27:06.863369Z",
          "Symbol": "BTC-USD",
          "Status": "Online",
          "Bids": [
            {
              "Price": "64647.0",
              "Size": "0.50000000"
            },
            {
              "Price": "64647.0",
              "Size": "2.50000000"
            }
          ],
          "Offers": [
            {
              "Price": "64648.0",
              "Size": "0.50000000"
            },
            {
              "Price": "64648.0",
              "Size": "2.50000000"
            }
          ]
        }
      ]
    }
    ```
  </Tab>
</Tabs>

## Notes

* `reqid` cannot be equal to 0.
* `seqNum` is for debug purposes only, the client is not required to do any sequencing.
* If a request requires responses with different types, then multiple responses may have the `initial` flag set for different types.
* `action` is either `Update` or `Remove` and tells the client if the given entity should be removed or added/updated. The key for a given entity depends on the message type.
