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

# Subscribe to notification channels

> WebSocket-only method that subscribes the connection to one or more notification channels by name — see the Subscriptions section for the available channels and their address formats (e.g. orderbook.ETH-PERP.10.20). Duplicate names are deduplicated; private channels require a logged-in connection with access to the referenced subaccount. Returns a per-channel status map ("ok" or an error string) plus the connection's full set of subscriptions after the call.



## AsyncAPI

````yaml websocket.asyncapi.json subscribe
id: subscribe
title: Subscribe to notification channels
description: >-
  WebSocket-only method that subscribes the connection to one or more
  notification channels by name — see the Subscriptions section for the
  available channels and their address formats (e.g. orderbook.ETH-PERP.10.20).
  Duplicate names are deduplicated; private channels require a logged-in
  connection with access to the referenced subaccount. Returns a per-channel
  status map ("ok" or an error string) plus the connection's full set of
  subscriptions after the call.
servers:
  - id: production
    protocol: wss
    host: api.derive.xyz
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: testnet.api.derive.xyz
    bindings: []
    variables: []
address: /v3/ws
parameters: []
bindings: []
operations:
  - &ref_3
    id: send_subscribe
    title: Send_subscribe
    type: receive
    messages:
      - &ref_5
        id: subscribeRequest
        payload:
          - name: subscribeRequest
            type: object
            properties:
              - name: headers
                type: &ref_0
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: subscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `subscribe`. `channels` is the required list of
                  channel names to subscribe to.
                required: true
                properties:
                  - name: channels
                    type: array
                    required: true
                    properties:
                      - name: item
                        type: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_0
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-19>
            id: &ref_1
              anyOf:
                - type: string
                  x-parser-schema-id: <anonymous-schema-3>
                - type: number
                  x-parser-schema-id: <anonymous-schema-4>
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-5>
              x-parser-schema-id: JsonRpcId
            method:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-20>
            params:
              description: >-
                Params for `subscribe`. `channels` is the required list of
                channel names to subscribe to.
              type: object
              required:
                - channels
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-22>
                  x-parser-schema-id: <anonymous-schema-21>
              x-parser-schema-id: SubscribeParams
          x-parser-schema-id: <anonymous-schema-18>
        title: Subscribe request
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: &ref_2
      - id: x-parser-unique-object-id
        value: subscribe
  - &ref_4
    id: receive_subscribe
    title: Receive_subscribe
    type: send
    messages:
      - &ref_6
        id: subscribeResponse
        payload:
          - name: subscribeResponse
            type: object
            properties:
              - name: id
                type: anyOf
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          anyOf:
            - type: object
              required:
                - result
              properties:
                result:
                  description: >-
                    Result for `subscribe`. `status` maps each requested channel
                    to `"ok"` or an error string; `current_subscriptions` is the
                    full set of channels the connection is subscribed to after
                    the operation.
                  type: object
                  required:
                    - current_subscriptions
                    - status
                  properties:
                    current_subscriptions:
                      type: array
                      items:
                        type: string
                        x-parser-schema-id: <anonymous-schema-26>
                      uniqueItems: true
                      x-parser-schema-id: <anonymous-schema-25>
                    status:
                      type: object
                      additionalProperties: true
                      x-parser-schema-id: <anonymous-schema-27>
                  x-parser-schema-id: SubscribeResult
              x-parser-schema-id: <anonymous-schema-24>
            - type: object
              required:
                - error
              properties:
                error:
                  type: object
                  required:
                    - code
                    - message
                  properties:
                    code:
                      type: integer
                      format: int64
                      x-parser-schema-id: <anonymous-schema-15>
                    data:
                      type:
                        - string
                        - 'null'
                      x-parser-schema-id: <anonymous-schema-16>
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-17>
                  x-parser-schema-id: RPCError
              x-parser-schema-id: <anonymous-schema-28>
          required:
            - id
          properties:
            id: *ref_1
          x-parser-schema-id: <anonymous-schema-23>
        title: Subscribe response
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeResponse
    bindings: []
    extensions: *ref_2
sendOperations:
  - *ref_3
receiveOperations:
  - *ref_4
sendMessages:
  - *ref_5
receiveMessages:
  - *ref_6
extensions:
  - id: x-parser-unique-object-id
    value: subscribe
securitySchemes: []

````

## Related topics

- [Unsubscribe from notification channels](/api-reference/methods/unsubscribe-from-notification-channels.md)
- [Subscriptions](/subscriptions.md)
- [Connecting over WebSocket](/connecting.md)
