> ## 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.

# Unsubscribe from notification channels

> WebSocket-only method that removes the connection's subscriptions for the given channel names; omit channels (or pass null) to unsubscribe from everything. Returns a per-channel status map ("ok" or an error string) plus the subscriptions that remain after the call.



## AsyncAPI

````yaml websocket.asyncapi.json unsubscribe
id: unsubscribe
title: Unsubscribe from notification channels
description: >-
  WebSocket-only method that removes the connection's subscriptions for the
  given channel names; omit channels (or pass null) to unsubscribe from
  everything. Returns a per-channel status map ("ok" or an error string) plus
  the subscriptions that remain 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_4
    id: send_unsubscribe
    title: Send_unsubscribe
    type: receive
    messages:
      - &ref_6
        id: unsubscribeRequest
        payload:
          - name: unsubscribeRequest
            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: unsubscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `unsubscribe`. `channels` is optional.


                  When omitted (or null) the connection unsubscribes from all
                  channels.
                required: true
                properties:
                  - name: channels
                    type: &ref_1
                      - array
                      - 'null'
                    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-30>
            id: &ref_2
              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: unsubscribe
              x-parser-schema-id: <anonymous-schema-31>
            params:
              description: >-
                Params for `unsubscribe`. `channels` is optional.


                When omitted (or null) the connection unsubscribes from all
                channels.
              type: object
              properties:
                channels:
                  default: null
                  type: *ref_1
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-33>
                  x-parser-schema-id: <anonymous-schema-32>
              x-parser-schema-id: UnsubscribeParams
          x-parser-schema-id: <anonymous-schema-29>
        title: Unsubscribe request
        example: |-
          {
            "method": "<string>",
            "params": {}
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: &ref_3
      - id: x-parser-unique-object-id
        value: unsubscribe
  - &ref_5
    id: receive_unsubscribe
    title: Receive_unsubscribe
    type: send
    messages:
      - &ref_7
        id: unsubscribeResponse
        payload:
          - name: unsubscribeResponse
            type: object
            properties:
              - name: id
                type: anyOf
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          anyOf:
            - type: object
              required:
                - result
              properties:
                result:
                  description: >-
                    Result for `unsubscribe`. `status` maps each requested
                    channel to `"ok"` or an error string;
                    `remaining_subscriptions` is the set of channels the
                    connection is still subscribed to after the operation.
                  type: object
                  required:
                    - remaining_subscriptions
                    - status
                  properties:
                    remaining_subscriptions:
                      type: array
                      items:
                        type: string
                        x-parser-schema-id: <anonymous-schema-37>
                      uniqueItems: true
                      x-parser-schema-id: <anonymous-schema-36>
                    status:
                      type: object
                      additionalProperties: true
                      x-parser-schema-id: <anonymous-schema-38>
                  x-parser-schema-id: UnsubscribeResult
              x-parser-schema-id: <anonymous-schema-35>
            - 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-39>
          required:
            - id
          properties:
            id: *ref_2
          x-parser-schema-id: <anonymous-schema-34>
        title: Unsubscribe response
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeResponse
    bindings: []
    extensions: *ref_3
sendOperations:
  - *ref_4
receiveOperations:
  - *ref_5
sendMessages:
  - *ref_6
receiveMessages:
  - *ref_7
extensions:
  - id: x-parser-unique-object-id
    value: unsubscribe
securitySchemes: []

````

## Related topics

- [Subscribe to notification channels](/api-reference/methods/subscribe-to-notification-channels.md)
- [Subscriptions](/subscriptions.md)
- [Connecting over WebSocket](/connecting.md)
