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

# Chat room

> Channel name: `chat.{room}`. Private channel (requires authentication) that streams a chat room live, where {room} is general or fee_tier. Every wallet that is not banned from chat may subscribe to general; fee_tier also needs a fee tier (see private/get_chat_rooms). Rooms are unavailable while the account is disabled. Each message shows its sender's username, never a wallet address. Each event is either a new message (event message) or the id of a message a moderator removed (event deleted).



## AsyncAPI

````yaml subscriptions.asyncapi.json chatRoom
id: chatRoom
title: Chat room
description: >-
  Channel name: `chat.{room}`. Private channel (requires authentication) that
  streams a chat room live, where {room} is general or fee_tier. Every wallet
  that is not banned from chat may subscribe to general; fee_tier also needs a
  fee tier (see private/get_chat_rooms). Rooms are unavailable while the account
  is disabled. Each message shows its sender's username, never a wallet address.
  Each event is either a new message (event message) or the id of a message a
  moderator removed (event deleted).
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: receive_chatRoom
    title: Receive_chat room
    type: send
    messages:
      - &ref_7
        id: chatRoomNotification
        payload:
          - oneOf: &ref_0
              - type: object
                required:
                  - creation_timestamp
                  - event
                  - message_id
                  - room
                  - text
                  - username
                properties:
                  creation_timestamp:
                    type: integer
                    format: int64
                    x-parser-schema-id: <anonymous-schema-30>
                  event:
                    type: string
                    enum:
                      - message
                    x-parser-schema-id: <anonymous-schema-31>
                  message_id:
                    description: UUID v4 string
                    type: string
                    format: uuid
                    x-parser-schema-id: <anonymous-schema-32>
                  room:
                    description: >-
                      Every wallet not banned from chat may join `general`;
                      `fee_tier` also needs a fee tier.
                    type: string
                    enum:
                      - general
                      - fee_tier
                    x-parser-schema-id: ChatRoom
                  text:
                    type: string
                    x-parser-schema-id: <anonymous-schema-33>
                  username:
                    type: string
                    x-parser-schema-id: <anonymous-schema-34>
                x-parser-schema-id: <anonymous-schema-29>
              - type: object
                required:
                  - event
                  - message_id
                properties:
                  event:
                    type: string
                    enum:
                      - deleted
                    x-parser-schema-id: <anonymous-schema-36>
                  message_id:
                    description: UUID v4 string
                    type: string
                    format: uuid
                    x-parser-schema-id: <anonymous-schema-37>
                x-parser-schema-id: <anonymous-schema-35>
            x-parser-schema-id: RoomEvent
            name: chatRoomNotification
        headers: []
        jsonPayloadSchema:
          description: Payload for `chat.{room}`.
          oneOf: *ref_0
          x-parser-schema-id: RoomEvent
        title: Chat room notification
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: chatRoomNotification
    bindings: []
    extensions: &ref_2
      - id: x-parser-unique-object-id
        value: chatRoom
  - &ref_3
    id: send_subscribe_chatRoom
    title: Send_subscribe_chat room
    type: receive
    messages:
      - &ref_5
        id: subscribeRequest
        payload:
          - name: subscribeRequest
            description: >-
              Send to subscribe: list this channel's address (with the {param}
              segments filled, e.g. orderbook.ETH-PERP.10.20) in
              params.channels.
            type: object
            properties:
              - name: headers
                type: object
                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: object
              additionalProperties: true
              nullable: true
              x-parser-schema-id: <anonymous-schema-17>
            id: &ref_1
              anyOf:
                - type: string
                  x-parser-schema-id: <anonymous-schema-18>
                - type: number
                  x-parser-schema-id: <anonymous-schema-19>
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-20>
              x-parser-schema-id: JsonRpcId
            method:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-21>
            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-23>
                  x-parser-schema-id: <anonymous-schema-22>
              x-parser-schema-id: SubscribeParams
          x-parser-schema-id: <anonymous-schema-16>
        title: Subscribe request
        description: >-
          Send to subscribe: list this channel's address (with the {param}
          segments filled, e.g. orderbook.ETH-PERP.10.20) in params.channels.
        example: |-
          {
            "id": 1,
            "method": "subscribe",
            "params": {
              "channels": [
                "orderbook.ETH-PERP.10.20"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
      - &ref_6
        id: unsubscribeRequest
        payload:
          - name: unsubscribeRequest
            description: >-
              Send to unsubscribe: list the channel addresses to drop in
              params.channels, or omit it to unsubscribe from everything.
            type: object
            properties:
              - name: headers
                type: object
                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: array
                    required: false
                    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: object
              additionalProperties: true
              nullable: true
              x-parser-schema-id: <anonymous-schema-25>
            id: *ref_1
            method:
              type: string
              const: unsubscribe
              x-parser-schema-id: <anonymous-schema-26>
            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: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-28>
                  nullable: true
                  x-parser-schema-id: <anonymous-schema-27>
              x-parser-schema-id: UnsubscribeParams
          x-parser-schema-id: <anonymous-schema-24>
        title: Unsubscribe request
        description: >-
          Send to unsubscribe: list the channel addresses to drop in
          params.channels, or omit it to unsubscribe from everything.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_2
sendOperations:
  - *ref_3
receiveOperations:
  - *ref_4
sendMessages:
  - *ref_5
  - *ref_6
receiveMessages:
  - *ref_7
extensions:
  - id: x-parser-unique-object-id
    value: chatRoom
securitySchemes: []

````

## Related topics

- [private/get_chat_rooms](https://docs.derive.xyz/api-reference/chat/privateget_chat_rooms.md)
- [private/send_room_message](https://docs.derive.xyz/api-reference/chat/privatesend_room_message.md)
- [private/get_room_messages](https://docs.derive.xyz/api-reference/chat/privateget_room_messages.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.