openapi: 3.0.1
info:
  title: "YuChat Bot API"
  version: 2.7.0
  description: "Public API for working with YuChat."
  contact:
    name: "YuChat Team"
    url: "https://www.yuchat.ai"
    email: "support@yuchat.ai"
servers:
  - url: "https://yuchat.ai"
tags:
  - name: message
    description: Sending/editing/deleting messages
  - name: chat
    description: Creating chats, viewing/inviting chat members
  - name: member
    description: Viewing workspace members
  - name: updates
    description: Receiving all events addressed to the bot
  - name: webhook
    description: Creating, viewing, and deleting webhooks
  - name: file
    description: Getting a link for uploading files
  - name: transcription
    description: Getting transcriptions of voice messages and call recordings
  - name: poll
    description: Voting in polls
paths:
  /public/v2/getUpdates:
    post:
      description: Get the list of events for the bot
      tags:
        - update
      operationId: getUpdates
      requestBody:
        content:
          application/json:
            schema:
              properties:
                offset:
                  example: "31"
                  description: ID of the event after which to fetch subsequent events
                  type: integer
                  format: int64
                limit:
                  example: "25"
                  description: Number of events returned in the response. Maximum value is 1000. Default is 20
                  type: integer
      responses:
        "200":
          description: List of updates
          content:
            application/json:
              schema:
                properties:
                  updates:
                    type: array
                    items:
                      $ref: "#/components/schemas/Update"
                required:
                  - updates
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/setUpdateSettings:
    post:
      description: Sets which update types the bot will receive. By default the bot receives the MESSAGE and WORKSPACE_INVITE types
      tags:
        - me
      operationId: setUpdateSettings
      requestBody:
        content:
          application/json:
            schema:
              properties:
                updateSettings:
                  description: Settings apply only when receiving updates via API v2. Array of UpdateSetting values the bot receives. By default the bot receives the MESSAGE and WORKSPACE_INVITE types
                  type: array
                  items:
                    $ref: "#/components/schemas/UpdateSetting"
                autoAcceptWorkspaceInvites:
                  description: The setting applies only when receiving updates via API v2. Sets whether the bot will automatically accept workspace invites. Default is false
                  example: "false"
                  default: false
                  type: boolean
                updateApiVersion:
                  description: API version through which the bot receives updates via the getUpdates method or webhooks. Can be 1 or 2
                  example: "1"
                  type: integer
              required:
                - updateSettings
                - updateApiVersion
      responses:
        "200":
          description: Received update types have been saved
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getMyWorkspaceInvites:
    post:
      description: Get the list of workspace invites for the bot
      tags:
        - me
      operationId: getMyWorkspaceInvites
      responses:
        "200":
          description: Array of WorkspaceInvite objects. Limited to 100 elements
          content:
            application/json:
              schema:
                properties:
                  workspaceInvites:
                    type: array
                    items:
                      $ref: "#/components/schemas/WorkspaceInvite"
                required:
                  - workspaceInvites
        "403":
          description: Authentication error
        "429":
          description: Rate limit exceeded
  /public/v2/acceptWorkspaceInvite:
    post:
      description: Accept a workspace invite
      tags:
        - me
      operationId: acceptWorkspaceInvite
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  type: string
                  description: ID of the workspace the invite was sent from
                  example: BIQffAsGi9
              required:
                - workspaceId
      responses:
        "200":
          description: Invite accepted successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication error or no invite to this workspace was found
        "429":
          description: Rate limit exceeded
  /public/v2/rejectAllWorkspaceInvites:
    post:
      description: Reject all existing workspace invites
      tags:
        - me
      operationId: rejectAllWorkspaceInvites
      responses:
        "200":
          description: All invites have been rejected
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication error
        "429":
          description: Rate limit exceeded
  /public/v2/getMessages:
    post:
      description: Get the list of messages from a chat
      tags:
        - message
      operationId: getMessages
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat to get messages from
                  type: string
                pageSize:
                  example: "25"
                  description: Number of messages returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                anchorMessageId:
                  example: ADK5NyCqIK
                  description: ID of the message before/after which messages will be searched. If not specified, the latest messages in the chat are returned
                  type: string
                getBefore:
                  example: "true"
                  default: true
                  description: Direction of the message search when anchorMessageId is specified. Default is true, meaning messages sent before anchorMessageId will be returned
                  type: boolean
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: List of messages
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetMessagesResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getPinnedMessages:
    post:
      description: Get the list of pinned messages in a chat, ordered by pin date
      tags:
        - message
      operationId: getPinnedMessages
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat to get pinned messages for
                  type: string
                pageSize:
                  example: "25"
                  description: Number of pinned messages returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                pageToken:
                  example: AIQffAsGi4
                  description: Token of the next/previous page of the pinned messages list
                  type: string
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: List of pinned messages in the chat
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetPinnedMessagesResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getMessageById:
    post:
      description: Get detailed information about a message by its ID
      tags:
        - message
      operationId: getMessageById
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the message belongs to
                  type: string
                messageId:
                  example: AIQffAsGi8
                  description: Message ID
                  type: string
              required:
                - workspaceId
                - chatId
                - messageId
      responses:
        "200":
          description: Message information
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Message"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/sendMessage:
    post:
      description: Send a message to a chat
      tags:
        - message
      operationId: sendMessage
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the message is sent in
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the message is sent to
                  type: string
                text:
                  example: Hi!
                  description: Message in Markdown format
                  type: string
                fileIds:
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  description: Array of file IDs to be attached to the message
                  type: array
                  items:
                    type: string
                buttonBar:
                  description: Button bar
                  $ref: "#/components/schemas/ButtonBar"
                poll:
                  description: Poll
                  $ref: "#/components/schemas/SendPoll"
                replyTo:
                  example: gIQffAsGi8
                  description: ID of the message the sent message refers to (reply to a message)
                  type: string
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: Message sent successfully
          content:
            application/json:
              schema:
                properties:
                  messageId:
                    example: gIQffAsGi8
                    description: ID of the sent message
                    type: string
                required:
                  - messageId
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/editMessage:
    post:
      description: Edit a message
      tags:
        - message
      operationId: editMessage
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: gIQffAsGi8
                  description: ID of the workspace the message is edited in
                  type: string
                chatId:
                  example: w:gIQffAsGi8
                  description: ID of the chat the message is edited in
                  type: string
                messageId:
                  example: gIQffAsGi8
                  description: ID of the message being edited
                  type: string
                text:
                  example: Hi!
                  description: Message in Markdown format
                  type: string
                fileIds:
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  description: Array of file IDs to be attached to the message
                  type: array
                  items:
                    type: string
                buttonBar:
                  description: Button bar
                  $ref: "#/components/schemas/ButtonBar"
              required:
                - workspaceId
                - chatId
                - messageId
      responses:
        "200":
          description: Message edited
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/deleteMessages:
    post:
      description: Delete messages
      tags:
        - message
      operationId: deleteMessages
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: gIQffAsGi8
                  description: ID of the workspace the messages are deleted in
                  type: string
                chatId:
                  example: fIQffAsGi8
                  description: ID of the chat the messages are deleted in
                  type: string
                messageIds:
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  description: Array of IDs of the messages to delete
                  type: array
                  items:
                    type: string
              required:
                - workspaceId
                - chatId
                - messageIds
      responses:
        "200":
          description: Information about the deleted messages
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteMessagesResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/forwardMessage:
    post:
      description: Forward a message
      tags:
        - message
      operationId: forwardMessage
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the message is forwarded to
                  type: string
                sourceChatId:
                  example: w:AIQffAsGi7
                  description: ID of the chat the message is forwarded from
                  type: string
                sourceMessageIds:
                  description: IDs of the messages being forwarded
                  type: array
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  items:
                    type: string
                targetChatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the message is forwarded to
                  type: string
                text:
                  example: Take a look at this
                  description: Caption for the forwarded message in Markdown format
                  type: string
              required:
                - workspaceId
                - sourceChatId
                - sourceMessageIds
                - targetChatId
      responses:
        "200":
          description: Message forwarded successfully
          content:
            application/json:
              schema:
                properties:
                  messageId:
                    example: gIQffAsGi8
                    description: ID of the forwarded message
                    type: string
                required:
                  - messageId
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/pinMessage:
    post:
      description: Pin a message in a chat
      tags:
        - message
      operationId: pinMessage
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the message is pinned in
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the message is pinned in
                  type: string
                messageId:
                  example: dIQffAsGi7
                  description: ID of the message being pinned
                  type: string
              required:
                - workspaceId
                - chatId
                - messageId
      responses:
        "200":
          description: Message pinned
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/toggleReaction:
    post:
      description: Add a reaction to a message, or remove the reaction if it was previously added
      tags:
        - message
      operationId: toggleReaction
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the message belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the message belongs to
                  type: string
                messageId:
                  example: dIQffAsGi7
                  description: Message ID
                  type: string
                emoji:
                  description: "Emoji in the form :+1:"
                  example: ":heart:"
                  type: string
              required:
                - workspaceId
                - chatId
                - messageId
                - emoji
      responses:
        "200":
          description: Reaction added or removed successfully
          content:
            application/json:
              schema:
                properties:
                  reactionAdded:
                    example: "true"
                    description: True if the reaction was added, false if it was removed
                    type: boolean
                required:
                  - reactionAdded
        "403":
          description: Authentication or authorization error, or the chat is archived
        "404":
          description: Message not found
        "429":
          description: Rate limit exceeded
  /public/v2/unpinMessage:
    post:
      description: Unpin a message in a chat
      tags:
        - message
      operationId: unpinMessage
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the message is unpinned in
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the message is unpinned in
                  type: string
                messageId:
                  example: dIQffAsGi7
                  description: ID of the message being unpinned
                  type: string
              required:
                - workspaceId
                - chatId
                - messageId
      responses:
        "200":
          description: Message unpinned
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/createWorkspaceChat:
    post:
      description: Create a chat in a workspace
      tags:
        - chat
      operationId: createWorkspaceChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat is created in
                  type: string
                name:
                  example: News
                  description: Chat name
                  type: string
                participants:
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  description: Array of Membership IDs of the members being invited. No more than 100 members in the initial request
                  type: array
                  items:
                    type: string
                announce:
                  description: Whether the chat is an announcement chat. Default is false
                  example: "true"
                  type: boolean
                autoJoinNewMembers:
                  description: Whether to automatically add new workspace members to the chat. Default is false
                  example: "true"
                  type: boolean
                workspaceChatType:
                  description: Chat type; only PUBLIC or PRIVATE can be set
                  $ref: "#/components/schemas/WorkspaceChatType"
                description:
                  example: Company news
                  description: Chat description
                  type: string
              required:
                - workspaceId
                - name
                - workspaceChatType
      responses:
        "200":
          description: Chat created
          content:
            application/json:
              schema:
                properties:
                  chatId:
                    description: ID of the created chat
                    example: w:BDK5NyCqIK
                    type: string
                required:
                  - chatId
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getOrCreatePersonalChat:
    post:
      description: Create or get an existing personal chat with another member
      tags:
        - chat
      operationId: getOrCreatePersonalChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                participant:
                  example: ADK5NyCqIK
                  description: Membership ID of the chat member
                  type: string
              required:
                - workspaceId
                - participant
      responses:
        "200":
          description: Chat created or found
          content:
            application/json:
              schema:
                properties:
                  chatId:
                    description: ID of the personal chat
                    example: p:BDK5NyCqIK
                    type: string
                required:
                  - chatId
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getOrCreateUserEventsChat:
    post:
      description: Create or get an existing chat with personal notifications
      tags:
        - chat
      operationId: getOrCreateUserEventsChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                eventsType:
                  example: CALLS
                  description: Type of events sent to the chat
                  type: string
                  enum:
                    - CALLS
                    - MENTIONS
              required:
                - workspaceId
      responses:
        "200":
          description: Chat created or found
          content:
            application/json:
              schema:
                properties:
                  chatId:
                    description: ID of the chat with personal notifications
                    example: u:BDK5NyCqIK
                    type: string
                required:
                  - chatId
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getOrCreateThreadChat:
    post:
      description: Create or get an existing thread under a message
      tags:
        - chat
      operationId: getOrCreateThreadChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the thread belongs to
                  type: string
                parentChatId:
                  example: w:aIQffAsGia
                  description: ChatId of the parent chat where the parent message is located
                  type: string
                parentMessageId:
                  example: bIQffAsGia
                  description: MessageId of the parent message the thread belongs to
                  type: string
              required:
                - workspaceId
                - parentChatId
                - parentMessageId
      responses:
        "200":
          description: Thread created or found
          content:
            application/json:
              schema:
                properties:
                  chatId:
                    description: Thread ID
                    example: t:BDK5NyCqIK
                    type: string
                required:
                  - chatId
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getWorkspaceChats:
    post:
      description: Get the list of chats in a workspace. Archived chats are not included in the list
      tags:
        - chat
      operationId: getWorkspaceChats
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace to get the chat list for
                  type: string
                pageSize:
                  example: "25"
                  description: Number of chatId values returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                pageToken:
                  example: AIQffAsGi4
                  description: Token of the next/previous page of the chat list
                  type: string
              required:
                - workspaceId
      responses:
        "200":
          description: Array of ChatId values for the given workspace
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetChatsResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getMyWorkspaceChats:
    post:
      description: Get the list of workspace chats the bot is a member of. Archived chats are not included in the list
      tags:
        - chat
      operationId: getMyWorkspaceChats
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace to get the chat list for
                  type: string
                pageSize:
                  example: "25"
                  description: Number of chatId values returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                pageToken:
                  example: AIQffAsGi4
                  description: Token of the next/previous page of the chat list
                  type: string
              required:
                - workspaceId
      responses:
        "200":
          description: Array of ChatId values for the given workspace that the bot is a member of
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetChatsResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getChatsInfo:
    post:
      description: Get detailed information about chats. Chats the bot is not a member of are ignored and no information is returned for them
      tags:
        - chat
      operationId: getChatsInfo
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chats belong to
                  type: string
                chatIds:
                  description: Array of chat identifiers (ChatId)
                  type: array
                  example: "[w:ADK5NyCqIK, w:BDK5NyCqIK]"
                  items:
                    type: string
              required:
                - workspaceId
                - chatIds
      responses:
        "200":
          description: Array of ChatMembership objects containing information about the chat and the bot's role in it
          content:
            application/json:
              schema:
                properties:
                  chatMemberships:
                    type: array
                    items:
                      $ref: "#/components/schemas/ChatMembership"
                required:
                  - chatMemberships
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/inviteToChat:
    post:
      description: Invite members to a chat. Used only for Workspace chats. Inviting members who are already in the chat has no effect
      tags:
        - chat
      operationId: inviteToChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace where the new members are invited
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the new members are invited to
                  type: string
                membershipIds:
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  description: Array of Membership IDs of the members being invited. No more than 100 members
                  type: array
                  items:
                    type: string
              required:
                - workspaceId
                - chatId
                - membershipIds
      responses:
        "200":
          description: New members invited successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/kickFromChat:
    post:
      description: Remove members from a chat. Used only for Workspace chats. Removing members who are not in the chat has no effect
      tags:
        - chat
      operationId: kickFromChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace where the members are removed
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the members are removed from
                  type: string
                membershipIds:
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  description: Array of Membership IDs of the members being removed. No more than 100 members
                  type: array
                  items:
                    type: string
              required:
                - workspaceId
                - chatId
                - membershipIds
      responses:
        "200":
          description: Members removed successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/leaveChat:
    post:
      description: Leave a chat. Used only for Workspace chats
      tags:
        - chat
      operationId: leaveChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat to leave
                  type: string
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: Left the chat successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/archiveChat:
    post:
      description: Archive a chat. Used only for Workspace chats
      tags:
        - chat
      operationId: archiveChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat to archive
                  type: string
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: Chat archived successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/unrchiveChat:
    post:
      description: Restore an archived chat. Used only for Workspace chats
      tags:
        - chat
      operationId: unarchiveChat
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the chat belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat to restore
                  type: string
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: Chat restored successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/setChatMemberRole:
    post:
      description: Set a new role for a member. Used only for Workspace chats
      tags:
        - chat
      operationId: setChatMemberRole
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace where the role is changed
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat the role is changed for
                  type: string
                membershipId:
                  example: gIQffAsGi8
                  description: ID of the member whose role is changed
                  type: string
                role:
                  $ref: "#/components/schemas/ChatRole"
              required:
                - workspaceId
                - chatId
                - membershipId
                - role
      responses:
        "200":
          description: Role assigned successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getChatMembersList:
    post:
      description: Get the list of chat members by chatId. Returns an array of membershipId values of the members in the specified chat
      tags:
        - chat
      operationId: getChatMembersList
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: Workspace ID
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat to get the member list for
                  type: string
                pageSize:
                  example: "25"
                  description: Number of membershipId values returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                pageToken:
                  example: AIQffAsGi4
                  description: Token of the next/previous page of the member list
                  type: string
              required:
                - workspaceId
                - chatId
      responses:
        "200":
          description: List of chat members
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetChatMembersListResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getMembers:
    post:
      description: Get the list of workspace members
      tags:
        - member
      operationId: getMembers
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace to get the member list for
                  type: string
                pageSize:
                  example: "25"
                  description: Number of membershipId values returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                pageToken:
                  example: AIQffAsGi4
                  description: Token of the next/previous page of the member list
                  type: string
              required:
                - workspaceId
      responses:
        "200":
          description: List of workspace members
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetMembersResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/inviteMember:
    post:
      description: Invite a new member to a workspace
      tags:
        - member
      operationId: inviteMember
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the member is invited to
                  type: string
                emails:
                  example: "[ivanov@example.com,sidorov@example.com]"
                  description: Array of user emails the invite is sent to. No more than 100 users per request
                  type: array
                  items:
                    type: string
              required:
                - workspaceId
                - emails
      responses:
        "200":
          description: Invite sent successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/removeMember:
    post:
      description: Remove a member from a workspace. The bot must have administrator rights to perform this. After removal, the member is removed from the contacts list and personal chats
      tags:
        - member
      operationId: removeMember
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the member is removed from
                  type: string
                membershipId:
                  example: gIQffAsGi8
                  description: ID of the member to remove from the workspace
                  type: string
              required:
                - workspaceId
                - membershipId
      responses:
        "200":
          description: Member removed successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/setWorkspaceMemberRole:
    post:
      description: Assign a role to a workspace member. A guest role cannot be assigned
      tags:
        - member
      operationId: setWorkspaceMemberRole
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the member is removed from
                  type: string
                membershipId:
                  example: gIQffAsGi8
                  description: ID of the member to remove from the workspace
                  type: string
                role:
                  $ref: "#/components/schemas/WorkspaceRole"
              required:
                - workspaceId
                - membershipId
                - role
      responses:
        "200":
          description: Role assigned successfully
          content:
            application/json:
              schema:
                type: object
                nullable: true
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getMembersInfo:
    post:
      description: Get information about workspace members
      tags:
        - member
      operationId: getMembersInfo
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the members belong to
                  type: string
                membershipIds:
                  example: "[gIQffAsGi8,gIQffAsGi9]"
                  description: IDs of the workspace members to get detailed information for. No more than 100 members per request
                  type: array
                  items:
                    type: string
              required:
                - workspaceId
                - membershipIds
      responses:
        "200":
          description: Information about the members
          content:
            application/json:
              schema:
                properties:
                  members:
                    description: Array of member data
                    type: array
                    items:
                      $ref: "#/components/schemas/MemberInfo"
                required:
                  - members
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getFileUploadUrl:
    post:
      description: "Get an upload URL for a file. The response contains a URL to which the file is sent via an HTTP PUT request. Example of sending the request via cURL: curl -X PUT -T \"/path/to/file\" \"URL_FROM_RESPONSE\""
      tags:
        - file
      operationId: getFileUploadUrl
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the file is uploaded in
                  type: string
                accessChatId:
                  example: w:IQffAsGi8
                  description: ID of the chat whose members will have access to the file. If the field is not set, all workspace members will have access to the file
                  type: string
                fileName:
                  example: image.png
                  description: Name of the uploaded file
                  type: string
              required:
                - workspaceId
                - fileName
      responses:
        "200":
          description: Information for uploading the file
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileUploadResponse"
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/getFileDownloadUrl:
    post:
      description: Get a download link for a file
      tags:
        - file
      operationId: getFileDownloadUrl
      requestBody:
        content:
          application/json:
            schema:
              properties:
                fileId:
                  example: AIQffAsGi8
                  description: ID of the file to download
                  type: string
              required:
                - fileId
      responses:
        "200":
          description: URL for downloading the file
          content:
            application/json:
              schema:
                properties:
                  url:
                    example: "true"
                    description: URL for downloading the file
                    type: string
                required:
                  - url
        "403":
          description: Authentication or authorization error, or no access to the file
        "404":
          description: No file with this ID was found
        "429":
          description: Rate limit exceeded
  /public/v2/getVoiceNoteTranscription:
    post:
      description: Get the transcription of a voice message.
      tags:
        - transcription
      operationId: getVoiceNoteTranscription
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: Workspace ID
                  type: string
                chatId:
                  example: w:BIQffAsGi8
                  description: Chat ID
                  type: string
                messageId:
                  example: CIQffAsGi8
                  description: ID of the message containing the voice message
                  type: string
              required:
                - workspaceId
                - chatId
                - messageId
      responses:
        "200":
          description: Transcription of the voice message
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VoiceNoteTranscriptionResponse"
        "403":
          description: Authentication or authorization error, or no access to the message
        "404":
          description: The message was not found, does not contain a voice message, or the transcription is unavailable
        "429":
          description: Rate limit exceeded
  /public/v2/getConferenceTranscription:
    post:
      description: Get the transcription of a call recording.
      tags:
        - transcription
      operationId: getConferenceTranscription
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: Workspace ID
                  type: string
                conferenceId:
                  example: gIQffAsGi8
                  description: ID of the conference (call)
                  type: string
              required:
                - workspaceId
                - conferenceId
      responses:
        "200":
          description: Transcription of the call recording
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConferenceTranscriptionResponse"
        "403":
          description: Authentication or authorization error, or no access to the recording
        "404":
          description: The conference was not found, has no recording, or the transcription is unavailable
        "429":
          description: Rate limit exceeded
  /public/v2/getMe:
    post:
      description: Get information about the bot, including the list of workspaces the bot is a member of and the bot's profile information
      tags:
        - me
      operationId: getMe
      responses:
        "200":
          description: Bot information
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeInfo"
        "403":
          description: Authentication error
        "429":
          description: Rate limit exceeded
  /public/v2/getWorkspaceInfo:
    post:
      description: Get information about the workspaces the bot is a member of, including the organization identifier. Workspaces the bot is not a member of are ignored
      tags:
        - workspace
      operationId: getWorkspacesInfo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                workspaceIds:
                  description: Array of workspace identifiers. Maximum 100 elements
                  type: array
                  maxItems: 100
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                  items:
                    type: string
              required:
                - workspaceIds
      responses:
        "200":
          description: Information about the workspaces
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetWorkspacesInfoResponse"
        "403":
          description: Authentication error
        "429":
          description: Rate limit exceeded
  /public/v2/setWebhook:
    post:
      description: Sets the webhook that update events will be sent to
      operationId: setWebhook
      tags:
        - webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SetWebhookRequest"
      responses:
        "200":
          description: Webhook saved
          content:
            application/json:
              schema:
                type: object
                nullable: true
  /public/v2/deleteWebhook:
    delete:
      description: Deletes the webhook that update events were sent to
      operationId: deleteWebhook
      tags:
        - webhook
      responses:
        "200":
          description: Webhook deleted
          content:
            application/json:
              schema:
                type: object
                nullable: true
  /public/v2/getWebhookInfo:
    get:
      description: Get information about the registered webhook
      operationId: getWebhookInfo
      tags:
        - webhook
      responses:
        "200":
          description: Information about the found webhook
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookInfo"
        "404":
          description: Webhook not found
          content:
            application/json:
              schema:
                type: object
                nullable: true
  /public/v2/votePoll:
    post:
      description: Vote in a poll
      tags:
        - poll
      operationId: votePoll
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the poll belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat containing the poll message
                  type: string
                messageId:
                  example: gIQffAsGi8
                  description: ID of the poll message
                  type: string
                options:
                  description: Array of indices of the selected answer options (starting from 0)
                  type: array
                  example:
                    - 0
                    - 2
                  items:
                    type: integer
              required:
                - workspaceId
                - chatId
                - messageId
                - options
      responses:
        "200":
          description: Vote counted successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VotePollResponse"
        "403":
          description: Authentication or authorization error
        "404":
          description: Poll message not found
        "429":
          description: Rate limit exceeded
  /public/v2/getPollInfo:
    post:
      description: Get information about a poll
      tags:
        - poll
      operationId: getPollInfo
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the poll belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat containing the poll message
                  type: string
                pollId:
                  example: gIQffAsGi8
                  description: Poll ID
                  type: string
              required:
                - workspaceId
                - chatId
                - pollId
      responses:
        "200":
          description: Poll information
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetPollInfoResponse"
        "403":
          description: Authentication or authorization error
        "404":
          description: Poll not found
        "429":
          description: Rate limit exceeded
  /public/v2/getPollVotes:
    post:
      description: Get individual votes in a non-anonymous poll
      tags:
        - poll
      operationId: getPollVotes
      requestBody:
        content:
          application/json:
            schema:
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the poll belongs to
                  type: string
                chatId:
                  example: w:AIQffAsGi8
                  description: ID of the chat containing the poll message
                  type: string
                messageId:
                  example: gIQffAsGi8
                  description: ID of the poll message
                  type: string
                pageSize:
                  example: 25
                  description: Number of votes returned. Allowed range from 1 to 100. Default is 20
                  type: integer
                pageToken:
                  example: AIQffAsGi4
                  description: Token of the next/previous page of the votes list
                  type: string
              required:
                - workspaceId
                - chatId
                - messageId
      responses:
        "200":
          description: List of votes in the poll
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetPollVotesResponse"
        "400":
          description: The poll is anonymous
        "403":
          description: Authentication or authorization error
        "404":
          description: Poll message not found
        "429":
          description: Rate limit exceeded
  /public/v2/searchMessages:
    post:
      description: Full-text search across messages in a workspace
      tags:
        - search
      operationId: searchMessages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Full-text message search request
              required:
                - workspaceId
                - query
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: ID of the workspace the search is performed in
                  type: string
                query:
                  example: search query
                  description: Search query text
                  type: string
                  minLength: 1
                  maxLength: 255
                chatIds:
                  description: Array of chat IDs to search in. If not specified, the search is performed across all accessible chats
                  type: array
                  items:
                    type: string
                  example: "[w:ADK5NyCqIK, w:BDK5NyCqIK]"
                from:
                  description: Start of the search period
                  example: "2024-01-01T00:00:00.000+03:00"
                  type: string
                  format: date-time
                to:
                  description: End of the search period
                  example: "2024-12-31T23:59:59.000+03:00"
                  type: string
                  format: date-time
                sortBy:
                  description: Result sort type. DATE - by date (default), RELEVANCE - by relevance
                  $ref: "#/components/schemas/SearchSortBy"
                authorMembershipIds:
                  description: Array of MembershipId values of message authors to filter by
                  type: array
                  items:
                    type: string
                  example: "[ADK5NyCqIK, BDK5NyCqIK]"
                pageSize:
                  description: Number of results per page. Maximum 100, default 20
                  example: 20
                  type: integer
                  minimum: 1
                  maximum: 100
                pageToken:
                  description: Pagination token. Use nextPageToken or prevPageToken from the previous response
                  type: string
      responses:
        "200":
          description: Message search results
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchMessagesResponse"
        "400":
          description: Invalid request
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/searchRecordings:
    post:
      description: Search across conference recordings (transcriptions, summaries, titles)
      tags:
        - search
      operationId: searchRecordings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Conference recordings search request
              required:
                - workspaceId
                - query
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: Workspace ID
                  type: string
                query:
                  example: transcription
                  description: Search query text
                  type: string
                  minLength: 1
                  maxLength: 255
                chatIds:
                  description: Array of chat IDs to filter by
                  type: array
                  items:
                    type: string
                from:
                  description: Start of the search period
                  type: string
                  format: date-time
                to:
                  description: End of the search period
                  type: string
                  format: date-time
                sortBy:
                  description: Result sort type
                  $ref: "#/components/schemas/SearchSortBy"
                searchTargets:
                  description: Recording content types to search. If not specified, the search covers all types
                  type: array
                  items:
                    $ref: "#/components/schemas/OccurrenceType"
                pageSize:
                  description: Number of results per page. Maximum 100, default 20
                  example: 20
                  type: integer
                  minimum: 1
                  maximum: 100
                pageToken:
                  description: Pagination token
                  type: string
      responses:
        "200":
          description: Recording search results
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchRecordingsResponse"
        "400":
          description: Invalid request
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/searchMembers:
    post:
      description: Search workspace members by name, email, position, or department
      tags:
        - search
      operationId: searchMembers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Workspace members search request
              required:
                - workspaceId
                - query
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: Workspace ID
                  type: string
                query:
                  example: Smith
                  description: Search query text
                  type: string
                  minLength: 1
                  maxLength: 255
                searchBy:
                  description: Search criteria. If not specified, the search is by name
                  type: array
                  items:
                    $ref: "#/components/schemas/MemberSearchBy"
                includeGuests:
                  description: Include guests in the results. Default is false
                  type: boolean
                  default: false
                pageSize:
                  description: Number of results per page. Maximum 100, default 20
                  example: 20
                  type: integer
                  minimum: 1
                  maximum: 100
                pageToken:
                  description: Pagination token
                  type: string
      responses:
        "200":
          description: Member search results
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchMembersResponse"
        "400":
          description: Invalid request
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
  /public/v2/searchChats:
    post:
      description: Search workspace chats by name
      tags:
        - search
      operationId: searchChats
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Workspace chats search request by name
              required:
                - workspaceId
                - query
              properties:
                workspaceId:
                  example: AIQffAsGi8
                  description: Workspace ID
                  type: string
                query:
                  example: Documentation
                  description: Search query text for the chat name
                  type: string
                  minLength: 1
                  maxLength: 255
                archivedFilter:
                  description: Filter by chat archived state. Default is UNARCHIVED_ONLY
                  $ref: "#/components/schemas/ArchivedFilter"
                pageSize:
                  description: Number of results per page. Maximum 100, default 20
                  example: 20
                  type: integer
                  minimum: 1
                  maximum: 100
                pageToken:
                  description: Pagination token
                  type: string
      responses:
        "200":
          description: Chat search results
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchChatsResponse"
        "400":
          description: Invalid request
        "403":
          description: Authentication or authorization error
        "429":
          description: Rate limit exceeded
components:
  schemas:
    Update:
      type: object
      description: An object of some event (update) related to the bot. Contains an identifier and one of the populated fields depending on the event type.
      properties:
        updateId:
          description: Update identifier, monotonically increasing. Later updates have a larger identifier
          type: integer
          format: int64
        message:
          description: Update object - message
          $ref: "#/components/schemas/Message"
        notification:
          description: Update object - notification
          $ref: "#/components/schemas/Notification"
        messageAction:
          description: Update object - interactive message action (button press)
          $ref: "#/components/schemas/messageAction"
        workspaceInvite:
          description: Update object - invite to a new workspace
          $ref: "#/components/schemas/WorkspaceInvite"
    Notification:
      type: object
      description: Update type - notification. Contains the workspace ID, creation time, and one populated field depending on the notification kind
      required:
        - workspaceId
        - timestamp
      properties:
        workspaceId:
          example: AIQffAsGi8
          description: ID of the workspace the notification relates to
          type: string
        timestamp:
          description: Notification creation time
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        memberJoinedEvent:
          type: object
          description: Notification that a new member has joined the workspace
          required:
            - memberId
          properties:
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the member who joined
              type: string
        memberInvitedEvent:
          type: object
          description: Notification that a new member has been invited to the workspace
          required:
            - memberId
          properties:
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the invited member
              type: string
        memberLeftEvent:
          type: object
          description: Notification that a member has left the workspace
          required:
            - memberId
          properties:
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the member who left the workspace
              type: string
        memberChangedRoleEvent:
          type: object
          description: Notification that a member's role in the workspace has changed
          required:
            - memberId
            - newRole
          properties:
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the member with the new role
              type: string
            newRole:
              description: Member's new role
              $ref: "#/components/schemas/WorkspaceRole"
        chatCreatedEvent:
          type: object
          description: Notification that a new chat has been created in the workspace
          required:
            - chatId
            - metadata
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the created chat
              type: string
            metadata:
              $ref: "#/components/schemas/ChatMetadata"
        reactionToggledEvent:
          type: object
          description: Notification that a reaction to a message has been added/removed
          required:
            - chatId
            - messageId
            - emoji
            - reactedBy
            - wasSet
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat containing the message with the reaction
              type: string
            messageId:
              example: bIQffAsGia
              description: Message ID of the message with the reaction
              type: string
            emoji:
              description: "Emoji in the form :+1:"
              example: ":heart:"
              type: string
            reactedBy:
              example: ADK5NyCqIK
              description: Membership ID of the member who added or removed the reaction
              type: string
            wasSet:
              example: "true"
              description: If true, the reaction was added; otherwise it was removed
              type: boolean
        messageEditedEvent:
          type: object
          description: Notification that a message has been edited
          required:
            - chatId
            - messageId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat containing the edited message
              type: string
            messageId:
              example: bIQffAsGia
              description: Message ID of the edited message
              type: string
        messageDeletedEvent:
          type: object
          description: Notification that a message has been deleted
          required:
            - chatId
            - messageId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat that contained the deleted message
              type: string
            messageId:
              example: bIQffAsGia
              description: Message ID of the deleted message
              type: string
        chatMemberJoinedEvent:
          type: object
          description: Notification of a new member in the chat
          required:
            - chatId
            - memberId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat where the new member appeared
              type: string
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the new chat member
              type: string
        chatMemberLeftEvent:
          type: object
          description: Notification that a member has left the chat
          required:
            - chatId
            - memberId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat the member left
              type: string
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the member who left the chat
              type: string
        chatMemberInvitedEvent:
          type: object
          description: Notification that a new member has been invited to the chat
          required:
            - chatId
            - memberId
            - inviterMemberId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat the new member was invited to
              type: string
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the invited member
              type: string
            inviterMemberId:
              example: ADK5NyCqIK
              description: Membership ID of the inviting member
              type: string
        chatMemberChangedRoleEvent:
          type: object
          description: Notification that a member's role in the chat has changed
          required:
            - chatId
            - memberId
            - newRole
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat that contained the deleted message
              type: string
            memberId:
              example: ADK5NyCqIK
              description: Membership ID of the new chat member
              type: string
            newRole:
              description: Member's new role
              $ref: "#/components/schemas/ChatRole"
        chatArchivedEvent:
          type: object
          description: Notification that the chat has been archived
          required:
            - chatId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat that was archived
              type: string
        chatUnarchivedEvent:
          type: object
          description: Notification that the chat has been unarchived
          required:
            - chatId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat that was unarchived
              type: string
        pollVotedEvent:
          type: object
          description: Notification that poll votes have been updated
          required:
            - chatId
            - messageId
            - pollId
            - summary
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat containing the poll
              type: string
            messageId:
              example: bIQffAsGia
              description: Message ID of the poll message
              type: string
            pollId:
              example: AIQffAsGi8
              description: Poll ID
              type: string
            summary:
              $ref: "#/components/schemas/PollSummary"
            myVote:
              description: Indices of the options the current user voted for
              type: array
              items:
                type: integer
    messageAction:
      type: object
      description: Update type - interactive user action on a message
      required:
        - workspaceId
        - chatId
        - messageId
      properties:
        workspaceId:
          example: AIQffAsGi8
          description: ID of the workspace the message belongs to
          type: string
        chatId:
          example: w:AIQffAsGi8
          description: ID of the chat the message belongs to
          type: string
        messageId:
          example: gIQffAsGi8
          description: Message ID
          type: string
        pressedButtonCommand:
          description: Command of the button that was pressed
          $ref: "#/components/schemas/CommandButton"
    WorkspaceInvite:
      type: object
      description: Update type - invite to a new workspace
      required:
        - workspaceId
        - inviterName
        - inviterEmail
      properties:
        workspaceId:
          example: AIQffAsGi8
          description: ID of the workspace the bot was invited to
          type: string
        inviterName:
          description: Name of the member who sent the invite
          example: John Smith
          type: string
        inviterEmail:
          description: Email of the member who sent the invite
          example: ivanov@example.org
          type: string
    GetMessagesResponse:
      type: object
      description: Data about the requested message list
      required:
        - messages
      properties:
        messages:
          description: Array of Message objects
          type: array
          items:
            $ref: "#/components/schemas/Message"
    GetPinnedMessagesResponse:
      type: object
      description: Data about the chat's pinned messages
      required:
        - messages
      properties:
        messages:
          description: Array of pinned messages, ordered by pin date
          type: array
          items:
            $ref: "#/components/schemas/Message"
        prevPageToken:
          description: Token of the previous page of the pinned messages list
          type: string
          example: BDK5NyCqI4
        nextPageToken:
          description: Token of the next page of the pinned messages list
          type: string
          example: BDK5NyCqI4
    DeleteMessagesResponse:
      type: object
      description: Information about the deleted messages
      required:
        - updatedAt
        - deletedMessageIds
      properties:
        updatedAt:
          description: Time the messages were deleted
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        deletedMessageIds:
          description: Array of messageId values that were deleted
          type: array
          example: "[ADK5NyCqIK, BDK5NyCqIK]"
          items:
            type: string
    GetChatMembersListResponse:
      type: object
      description: Response to the chat members list request
      required:
        - membershipIds
      properties:
        membershipIds:
          description: Array of membershipId values of the chat members
          type: array
          example: "[ADK5NyCqIK, BDK5NyCqIK]"
          items:
            type: string
        prevPageToken:
          description: Token of the previous page of the chat members list
          type: string
          example: BDK5NyCqI4
        nextPageToken:
          description: Token of the next page of the chat members list
          type: string
          example: BDK5NyCqI4
    GetMembersResponse:
      type: object
      description: Response to the members list request
      required:
        - membershipIds
      properties:
        membershipIds:
          description: Array of membershipId values present in the specified workspace
          type: array
          example: "[ADK5NyCqIK, BDK5NyCqIK]"
          items:
            type: string
        prevPageToken:
          description: Token of the previous page of the workspace members list
          type: string
          example: BDK5NyCqI4
        nextPageToken:
          description: Token of the next page of the workspace members list
          type: string
          example: BDK5NyCqI4
    GetChatsResponse:
      type: object
      description: Response to the workspace chat list request
      required:
        - chatIds
      properties:
        chatIds:
          description: Array of chatId values present in the specified workspace
          type: array
          example: "[w:ADK5NyCqIK, w:BDK5NyCqIK]"
          items:
            type: string
        prevPageToken:
          description: Token of the previous page of the workspace chat list
          type: string
          example: BDK5NyCqI4
        nextPageToken:
          description: Token of the next page of the workspace chat list
          type: string
          example: BDK5NyCqI4
    VoiceNoteTranscriptionResponse:
      type: object
      description: Transcription of the voice message
      required:
        - state
      properties:
        text:
          description: Transcription text
          type: string
          example: Hi, how are you?
        state:
          description: Transcription state
          type: string
          enum:
            - READY
            - PROCESSING
            - NOT_AVAILABLE
          example: READY
        language:
          description: Detected transcription language (ISO 639-1)
          type: string
          example: ru
    ConferenceTranscriptionResponse:
      type: object
      description: Transcription of the call recording broken down by participant
      required:
        - state
      properties:
        state:
          description: Transcription state
          type: string
          enum:
            - READY
            - PROCESSING
            - NOT_AVAILABLE
          example: READY
        summary:
          description: Brief summary of the call (if available)
          type: string
          example: Discussed the plan for the week and assigned tasks
        segments:
          description: Transcription segments with participants and timestamps
          type: array
          items:
            $ref: "#/components/schemas/ConferenceTranscriptionSegment"
    ConferenceTranscriptionSegment:
      type: object
      description: Call transcription segment
      required:
        - text
        - startTimeMs
        - endTimeMs
      properties:
        memberId:
          description: Member (membership) ID, if known
          type: string
          example: ADK5NyCqIK
        participantName:
          description: Participant name
          type: string
          example: John Smith
        text:
          description: Text spoken by the participant
          type: string
          example: Let's start by discussing the plan
        startTimeMs:
          description: Segment start time from the beginning of the recording (milliseconds)
          type: integer
          format: int64
          example: 5000
        endTimeMs:
          description: Segment end time from the beginning of the recording (milliseconds)
          type: integer
          format: int64
          example: 8500
    FileUploadResponse:
      type: object
      description: Information for uploading the file
      required:
        - fileId
        - uploadUrl
      properties:
        fileId:
          description: Identifier of the file being uploaded
          example: BDK5NyCqIK
          type: string
        uploadUrl:
          description: URL to which a PUT request must be made to upload the file
          type: string
          example: "https://yuchat-files-presigned.storage.net/d2f19302"
    MeInfo:
      type: object
      description: Information about the bot, including the list of workspaces the bot is a member of and the bot's profile information
      required:
        - profile
        - workspaces
        - updateApiVersion
        - updateSettings
        - autoAcceptWorkspaceInvites
        - scope
      properties:
        profile:
          description: Bot profile
          $ref: "#/components/schemas/Profile"
        workspaces:
          description: Array of workspaceId values the bot is a member of
          type: array
          example: "[ADK5NyCqIK, BDK5NyCqIK]"
          items:
            type: string
        updateApiVersion:
          description: API version through which the bot receives updates via the getUpdates method or webhooks. Can be 1 or 2
          example: "1"
          type: integer
        updateSettings:
          description: Settings apply only when receiving updates via API v2. Array of UpdateSetting values the bot receives. By default the bot receives the MESSAGE and WORKSPACE_INVITE types
          type: array
          items:
            $ref: "#/components/schemas/UpdateSetting"
        autoAcceptWorkspaceInvites:
          description: The setting applies only when receiving updates via API v2. Sets whether the bot will automatically accept workspace invites. Default is false
          example: "false"
          default: false
          type: boolean
        memberships:
          description: Array of the bot's membershipId in each workspace. Allows the bot to learn its membershipId without sending messages
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceMembership"
        scope:
          description: Bot scope - defines which spaces the bot can operate in
          $ref: "#/components/schemas/BotScope"
    GetWorkspacesInfoResponse:
      type: object
      description: Response to the workspace information request
      required:
        - workspaces
      properties:
        workspaces:
          description: Array of WorkspaceInfo objects. Contains only workspaces the bot is a member of
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceInfo"
    WorkspaceInfo:
      type: object
      description: Workspace information
      required:
        - workspaceId
        - organizationId
        - displayName
        - membersCount
        - type
        - createdAt
      properties:
        workspaceId:
          description: Workspace identifier
          type: string
          example: RBhSX3OSNk
        organizationId:
          description: Identifier of the organization the workspace belongs to
          type: string
          example: pFs0S4EZwO
        displayName:
          description: Display name of the workspace
          type: string
          example: DevTeam
        membersCount:
          description: Number of members in the workspace
          type: integer
          format: int64
          example: 42
        type:
          description: Workspace type
          $ref: "#/components/schemas/WorkspaceType"
        createdAt:
          description: Date and time the workspace was created
          type: string
          format: date-time
          example: "2024-01-15T10:00:00Z"
    WorkspaceType:
      type: string
      description: Workspace type
      enum:
        - REGULAR
        - UBER
      example: REGULAR
    WorkspaceMembership:
      type: object
      description: "The bot's relationship to a workspace: workspaceId and the corresponding membershipId"
      required:
        - workspaceId
        - membershipId
      properties:
        workspaceId:
          description: Workspace identifier
          type: string
          example: ADK5NyCqIK
        membershipId:
          description: The bot's member identifier (membershipId) in this workspace
          type: string
          example: YKcsFqDNXk
    Profile:
      description: Member profile information
      type: object
      required:
        - accountId
        - createdAt
        - updatedAt
        - accountType
      properties:
        accountId:
          description: Account identifier
          example: AIQffAsGi8
          type: string
        email:
          description: Email address
          example: i.ivanov@example.ru
          type: string
        createdAt:
          description: Date and time the account was created
          example: "2023-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        updatedAt:
          description: Date and time the account was last modified
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        fullName:
          description: Display name
          example: John A. Smith
          type: string
        accountType:
          $ref: "#/components/schemas/AccountType"
        accountDetails:
          $ref: "#/components/schemas/AccountDetails"
    AccountDetails:
      description: Additional user data
      type: object
      properties:
        position:
          description: Position
          example: Analyst
          type: string
        department:
          description: Department
          example: B2B
          type: string
        phoneNumber:
          description: Phone number
          example: "88001234567"
          type: string
        location:
          $ref: "#/components/schemas/AccountLocation"
        bio:
          description: Brief information
          example: Do not disturb after 8 PM
          type: string
        status:
          example: On a business trip
          description: Status
          type: string
        customFields:
          description: Arbitrary custom profile fields defined by the user. The order of elements is significant.
          type: array
          items:
            $ref: "#/components/schemas/UserProfileCustomField"
    UserProfileCustomField:
      description: Custom profile field (key-value pair)
      type: object
      required:
        - key
        - value
      properties:
        key:
          description: Field name
          example: telegram
          type: string
          maxLength: 64
        value:
          description: Field value
          example: "@ivanov"
          type: string
          maxLength: 256
    MemberInfo:
      description: User data within the workspace
      type: object
      required:
        - membershipId
        - profile
        - createdAt
        - updatedAt
        - presence
        - memberStatus
      properties:
        membershipId:
          example: gIQffAsGi8
          description: Member ID within the workspace
          type: string
        profile:
          $ref: "#/components/schemas/Profile"
        createdAt:
          description: Date and time the member was created
          example: "2023-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        updatedAt:
          description: Date and time the member information was last modified
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        joinedAt:
          description: Date and time the member joined the workspace
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        workspaceRole:
          $ref: "#/components/schemas/WorkspaceRole"
        presence:
          $ref: "#/components/schemas/Presence"
        timeZone:
          example: Europe/Moscow
          description: Member's time zone ID
          type: string
        memberStatus:
          $ref: "#/components/schemas/MemberStatus"
        leftAt:
          description: Date and time the member was removed from the workspace
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
    Presence:
      description: Information about the member's online status
      type: object
      required:
        - online
        - onCall
        - since
      properties:
        online:
          description: Member is online
          example: "true"
          type: boolean
        onCall:
          description: Member is on a call
          example: "true"
          type: boolean
        since:
          description: Date and time the status was last changed
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
    SendPoll:
      description: Poll to send
      type: object
      required:
        - question
        - options
      properties:
        question:
          description: Poll question
          example: What is your favorite programming language?
          type: string
          maxLength: 255
        options:
          description: Answer options
          type: array
          minItems: 2
          maxItems: 20
          items:
            type: string
            maxLength: 100
          example:
            - Kotlin
            - Java
            - Python
        isMultiple:
          description: Whether multiple answer options can be selected
          type: boolean
          default: false
        isAnonymous:
          description: Anonymous voting (it is not possible to see who voted for what)
          type: boolean
          default: true
    ButtonBar:
      description: Button bar
      type: object
      required:
        - buttonGroups
      properties:
        buttonGroups:
          description: Row of buttons
          type: array
          items:
            $ref: "#/components/schemas/ButtonGroup"
    ButtonGroup:
      description: Row of buttons
      type: object
      required:
        - buttons
      properties:
        buttons:
          description: Buttons
          type: array
          items:
            $ref: "#/components/schemas/Button"
    Button:
      description: Button. One of the fields is populated depending on the button type.
      type: object
      properties:
        commandButton:
          $ref: "#/components/schemas/CommandButton"
        linkButton:
          $ref: "#/components/schemas/LinkButton"
    CommandButton:
      description: Command button
      type: object
      required:
        - displayText
        - commandKey
      properties:
        displayText:
          example: Press the button
          description: Text on the button
          type: string
        commandKey:
          example: /button_pushed
          description: Command sent when the button is pressed
          type: string
    LinkButton:
      type: object
      required:
        - displayText
        - link
      properties:
        displayText:
          example: Press the button
          description: Text on the button
          type: string
        link:
          example: "https://www.yuchat.ai"
          description: Link opened when the button is pressed
          type: string
    AccountType:
      description: Account type
      example: REGULAR
      type: string
      enum:
        - REGULAR
        - BOT
        - GUEST
    AccountLocation:
      description: Location
      example: OFFICE
      type: string
      enum:
        - NOT_SET
        - OFFICE
        - HOME
        - VACATION
    Message:
      type: object
      description: Message object
      required:
        - workspaceId
        - chatId
        - messageId
        - messageType
        - membershipId
        - createdAt
        - updatedAt
        - content
      properties:
        workspaceId:
          example: AIQffAsGi8
          description: ID of the workspace the message was sent in
          type: string
        chatId:
          example: w:AIQffAsGi8
          description: ID of the chat the message was sent to
          type: string
        messageId:
          example: gIQffAsGi8
          description: Message ID
          type: string
        messageType:
          $ref: "#/components/schemas/MessageType"
        inReplyToMessageId:
          example: gIQffAsGi8
          description: ID of the message this message replied to
          type: string
        membershipId:
          example: gIQffAsGi8
          description: ID of the message author
          type: string
        createdAt:
          description: Date and time the message was created
          example: "2023-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        updatedAt:
          description: Date and time the message was last modified
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        content:
          $ref: "#/components/schemas/MessageContent"
        reactions:
          description: Array of reactions to the message
          type: array
          items:
            $ref: "#/components/schemas/Reaction"
        threadId:
          example: t:AIQffAsGi8
          description: ID of the thread under this message
          type: string
        pinnedAt:
          description: Date and time the message was pinned
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
    Reaction:
      type: object
      description: Content of the reaction to the message
      required:
        - emoji
        - count
      properties:
        emoji:
          description: "Emoji in the form :+1:"
          example: ":heart:"
          type: string
        count:
          description: Number of reactions
          example: "5"
          type: integer
    MessageContent:
      type: object
      description: Message content. At least one field is non-empty
      properties:
        text:
          example: Hi!
          description: Message in Markdown format
          type: string
        fileIds:
          example: "[ADK5NyCqIK, BDK5NyCqIK]"
          description: Array of file IDs attached to the message
          type: array
          items:
            type: string
        conferenceId:
          example: gIQffAsGi8
          description: Conference ID
          type: string
        systemEvent:
          $ref: "#/components/schemas/SystemEvent"
        forwardedContent:
          $ref: "#/components/schemas/ForwardedContent"
        userEvent:
          $ref: "#/components/schemas/UserEvent"
        pollId:
          example: gIQffAsGi8
          description: Poll ID, if the message contains a poll
          type: string
    SystemEvent:
      type: object
      description: System message content. At least one field is non-empty
      properties:
        chatCreated:
          type: object
          description: "System message: chat created"
          required:
            - creatorMembershipId
          properties:
            creatorMembershipId:
              example: ADK5NyCqIK
              description: Membership ID of the chat creator
              type: string
            membershipIds:
              example: "[ADK5NyCqIK, BDK5NyCqIK]"
              description: Array of Membership IDs of the created chat's members
              type: array
              items:
                type: string
        chatConvertedToPrivate:
          type: object
          description: "System message: chat created"
          required:
            - initiatorMembershipId
          properties:
            initiatorMembershipId:
              example: ADK5NyCqIK
              description: Membership ID of the initiator of converting the chat to private
              type: string
        membersJoined:
          type: object
          description: "System message: new members joined the chat"
          required:
            - membershipIds
          properties:
            inviterMembershipId:
              example: ADK5NyCqIK
              description: Membership ID of the member who invited the new members
              type: string
            membershipIds:
              example: "[ADK5NyCqIK, BDK5NyCqIK]"
              description: Array of Membership IDs of the invited members
              type: array
              items:
                type: string
        membersLeft:
          type: object
          description: "System message: members removed from the chat"
          required:
            - membershipIds
          properties:
            kickerMembershipId:
              example: ADK5NyCqIK
              description: Membership ID of the member who removed the members
              type: string
            membershipIds:
              example: "[ADK5NyCqIK, BDK5NyCqIK]"
              description: Array of Membership IDs of the removed members
              type: array
              items:
                type: string
        chatRenamed:
          type: object
          description: "System message: chat renamed"
          required:
            - initiatorMembershipId
            - newName
          properties:
            initiatorMembershipId:
              example: ADK5NyCqIK
              description: Membership ID of the member who renamed the chat
              type: string
            newName:
              example: Documentation
              description: New chat name
              type: string
    UserEvent:
      type: object
      description: Personal notification content. At least one field is non-empty
      properties:
        conferenceMissed:
          type: object
          description: Personal notification about a missed conference
          required:
            - conferenceId
            - conferenceTarget
            - startedAt
          properties:
            conferenceId:
              example: ADK5NyCqIK
              description: Conference identifier
              type: string
            inviterMemberId:
              example: ADK5NyCqIK
              description: Membership ID of the conference initiator
              type: string
            conferenceTarget:
              $ref: "#/components/schemas/ConferenceTarget"
            startedAt:
              description: Date and time the conference started
              example: "2023-02-26T18:58:36.154+03:00"
              type: string
              format: date-time
        conferenceDeclined:
          type: object
          description: Personal notification about a declined conference
          required:
            - conferenceId
            - conferenceTarget
            - startedAt
          properties:
            conferenceId:
              example: ADK5NyCqIK
              description: Conference identifier
              type: string
            inviterMemberId:
              example: ADK5NyCqIK
              description: Membership ID of the conference initiator
              type: string
            conferenceTarget:
              $ref: "#/components/schemas/ConferenceTarget"
            startedAt:
              description: Date and time the conference started
              example: "2023-02-26T18:58:36.154+03:00"
              type: string
              format: date-time
        conferenceDirectInvite:
          type: object
          description: Personal notification about a direct conference invite
          required:
            - conferenceId
            - conferenceTarget
            - startedAt
          properties:
            conferenceId:
              example: ADK5NyCqIK
              description: Conference identifier
              type: string
            inviterMemberId:
              example: ADK5NyCqIK
              description: Membership ID of the conference initiator
              type: string
            conferenceTarget:
              $ref: "#/components/schemas/ConferenceTarget"
            startedAt:
              description: Date and time the conference started
              example: "2023-02-26T18:58:36.154+03:00"
              type: string
              format: date-time
        conferenceAnnounce:
          type: object
          description: Personal notification about the start of an available conference
          required:
            - conferenceId
            - conferenceTarget
            - startedAt
          properties:
            conferenceId:
              example: ADK5NyCqIK
              description: Conference identifier
              type: string
            inviterMemberId:
              example: ADK5NyCqIK
              description: Membership ID of the conference initiator
              type: string
            conferenceTarget:
              $ref: "#/components/schemas/ConferenceTarget"
            startedAt:
              description: Date and time the conference started
              example: "2023-02-26T18:58:36.154+03:00"
              type: string
              format: date-time
        chatMessageMention:
          type: object
          description: Personal notification about a mention in a chat
          required:
            - chatId
            - chatMessage
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat the message was sent to
              type: string
            chatMessage:
              $ref: "#/components/schemas/Message"
    ConferenceTarget:
      type: object
      description: Conference data. At least one field is non-empty
      properties:
        channelCall:
          type: object
          description: Conference in a chat
          required:
            - chatId
          properties:
            chatId:
              example: w:AIQffAsGi8
              description: ID of the chat where the conference was initiated
              type: string
        watercooler:
          type: object
          description: Personal call
          required:
            - scope
            - membershipIds
          properties:
            scope:
              description: Conference type. PUBLIC - public, other members can join without invites; PRIVATE - access by invite only
              example: PUBLIC
              type: string
              enum:
                - PRIVATE
                - PUBLIC
            membershipIds:
              example: "[ADK5NyCqIK, BDK5NyCqIK]"
              description: Array of Membership IDs of the conference participants
              type: array
              items:
                type: string
    ForwardedContent:
      type: object
      description: Content of the forwarded message
      required:
        - sourceWorkspaceId
        - sourceChatId
        - forwardedMessages
      properties:
        sourceWorkspaceId:
          example: AIQffAsGi8
          description: ID of the workspace the message is forwarded from
          type: string
        sourceChatId:
          example: w:AIQffAsGi8
          description: ID of the chat the message is forwarded from
          type: string
        forwardedMessages:
          description: Array of forwarded messages. The messages will not include information about reactions, threads, pinning, or whether the message is a reply to another message
          type: array
          items:
            $ref: "#/components/schemas/Message"
    ChatMembership:
      type: object
      description: Contains information about the chat and the bot's role in it
      required:
        - chatId
        - workspaceId
        - metadata
        - createdAt
        - updatedAt
      properties:
        chatId:
          example: w:AIQffAsGia
          description: Chat ID
          type: string
        workspaceId:
          example: w:AIQffAsGi8
          description: ID of the workspace the chat belongs to
          type: string
        metadata:
          $ref: "#/components/schemas/ChatMetadata"
        createdAt:
          description: Date and time the chat was created
          example: "2023-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        updatedAt:
          description: Date and time the chat was last modified. The field is used only for Workspace chats
          example: "2023-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        archivedAt:
          description: Date and time the chat was archived. The field is used only for Workspace chats
          example: "2023-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
        archivedBy:
          example: fIQffAsGi8
          description: MembershipId of the member who archived the chat
          type: string
        chatRole:
          description: The bot's role in the chat. The field is used only for Workspace chats
          $ref: "#/components/schemas/ChatRole"
        chatPermissions:
          description: Array of the bot's ChatPermission values in this chat. The field is used only for Workspace chats
          type: array
          items:
            $ref: "#/components/schemas/ChatPermission"
    ChatMetadata:
      type: object
      description: Contains chat-type-specific information. One of the fields is populated depending on the chat type
      properties:
        personal:
          $ref: "#/components/schemas/PersonalChatMetadata"
        workspace:
          description: Information about the workspace chat
          $ref: "#/components/schemas/WorkspaceChatMetadata"
        thread:
          description: Thread information
          $ref: "#/components/schemas/ThreadChatMetadata"
        conference:
          description: Conference chat information
          $ref: "#/components/schemas/ConferenceChatMetadata"
        userEvents:
          description: Information about the chat with personal notifications
          $ref: "#/components/schemas/UserEventsChatMetadata"
    PersonalChatMetadata:
      type: object
      description: Contains information about the personal chat
      required:
        - otherMembershipId
      properties:
        otherMembershipId:
          example: aIQffAsGia
          description: MembershipId of the other party
          type: string
    UserEventsChatMetadata:
      type: object
      description: Contains information about personal notifications
      required:
        - owner
      properties:
        owner:
          example: aIQffAsGia
          description: MembershipId of the owner
          type: string
    WorkspaceChatMetadata:
      type: object
      description: Contains information about the workspace chat
      required:
        - name
        - announce
        - chatType
        - autoJoinNewMembers
        - memberCount
      properties:
        name:
          example: News
          description: Chat name
          type: string
        announce:
          description: Whether the chat is an announcement chat
          example: "true"
          type: boolean
        chatType:
          description: Chat type
          $ref: "#/components/schemas/WorkspaceChatType"
        autoJoinNewMembers:
          description: Whether new workspace members are automatically added to the chat
          example: "true"
          type: boolean
        description:
          example: Company news
          description: Chat description
          type: string
        memberCount:
          description: Number of members
          example: "5"
          type: integer
    ThreadChatMetadata:
      type: object
      description: Contains information about the thread
      required:
        - parentChatId
        - parentMessageId
      properties:
        parentChatId:
          example: w:aIQffAsGia
          description: ChatId of the parent chat where the parent message is located
          type: string
        parentMessageId:
          example: bIQffAsGia
          description: MessageId of the parent message the thread belongs to
          type: string
    ConferenceChatMetadata:
      type: object
      description: Contains information about the conference chat
      required:
        - conferenceId
      properties:
        conferenceId:
          example: dIQffAsGia
          description: Identifier of the conference the chat relates to
          type: string
    ChatPermission:
      description: Permission for an action in the chat
      example: CHANGE_ROLE
      type: string
      enum:
        - CHANGE_ROLE
        - ARCHIVE_CHAT
        - RENAME_CHAT
        - UPDATE_CONFIG
        - KICK_FROM_CHAT
        - SEND_MESSAGES_TO_ANNOUNCE_CHANNEL
        - PIN_CHAT_MESSAGE
        - SCHEDULE_CONFERENCE
        - DELETE_CHAT_MESSAGE
        - UPDATE_PERMISSIONS
        - FORWARD_MESSAGES
    MessageType:
      description: Message type - from a user or system
      example: USER
      type: string
      enum:
        - USER
        - SYSTEM
    ChatRole:
      description: Member's role in the chat
      example: ADMIN
      type: string
      enum:
        - MEMBER
        - ADMIN
        - OWNER
    WorkspaceRole:
      description: Member's role in the workspace. GUEST - a guest invited to the space via a link, GUEST_CALLER - a guest invited to a call via a link
      example: ADMIN
      type: string
      enum:
        - MEMBER
        - ADMIN
        - OWNER
        - GUEST
        - GUEST_CALLER
    WorkspaceChatType:
      description: Type of chat in the workspace. PUBLIC - public, other members can join without invites; PRIVATE - access by invite only; GENERAL - the workspace's main chat, created by default
      example: PUBLIC
      type: string
      enum:
        - PRIVATE
        - PUBLIC
        - GENERAL
    MemberStatus:
      description: Member's status in the workspace. ACTIVE - active, PENDING - awaiting acceptance of the join invite, SUSPENDED - the member has been removed from the space
      example: ACTIVE
      type: string
      enum:
        - ACTIVE
        - PENDING
        - SUSPENDED
    UpdateSetting:
      description: Update type the bot can receive
      example: MESSAGE
      type: string
      enum:
        - MESSAGE
        - MESSAGE_ACTION
        - NOTIFICATION
        - WORKSPACE_INVITE
    BotScopeType:
      type: string
      description: Bot scope type
      enum:
        - pub
        - org
        - ws
      example: org
    BotScope:
      type: object
      description: Bot scope. Defines which spaces the bot can operate in. For type=PUB no additional fields are required; the bot can be invited to any workspace of any organization. For type=ORG an organizationId is required; the bot can be invited to any workspace of the organization it was created in. For type=WS a workspaceId is required; the bot cannot be invited to any workspace.
      required:
        - type
      properties:
        type:
          $ref: "#/components/schemas/BotScopeType"
        organizationId:
          type: string
          description: Organization identifier (required for type=ORG)
          example: AIQffAsGi8
        workspaceId:
          type: string
          description: Workspace identifier (required for type=WS)
          example: BIQffAsGi9
    WebhookInfo:
      type: object
      required:
        - url
        - hasCustomCertificate
      properties:
        url:
          type: string
          description: URL that events will be sent to
          example: https://webhook.me
        hasCustomCertificate:
          type: boolean
          description: Whether a self-signed certificate is set for the webhook
          example: "true"
        pendingUpdateCount:
          type: integer
          description: Number of available unreceived events
          example: "5"
        lastErrorDate:
          type: string
          format: date-time
          description: Date and time of the last failed webhook request
          example: "2024-02-26T18:58:36.154+03:00"
        lastErrorMessage:
          type: string
          description: Error message from the last failed webhook request
          example: 500 Internal server error
    SetWebhookRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          description: URL that events will be sent to
          example: https://webhook.me
        certificate:
          type: string
          description: Full contents of the .pem certificate, Base64-encoded (including BEGIN/END CERTIFICATE). Set if a self-signed certificate is used for the webhook
          example: c2FkZmdoamdnZnJkZ2VzZmFkZmdkaGZqZ2Zkc2ZnZGg=
        secretToken:
          type: string
          description: If set, it will be included in the "X-YuChat-Bot-Api-Secret-Token" header
          example: MIIDXTCCAkWgAwIBAgIUeKd8rP8XJGjH5Z2Q6VJq3m8Qk8AwDQYJKoZIhvcNAQEL
    VotePollResponse:
      type: object
      description: Result of voting in the poll
      required:
        - summary
        - myVote
      properties:
        summary:
          $ref: "#/components/schemas/PollSummary"
        myVote:
          description: Array of indices of the selected answer options
          type: array
          items:
            type: integer
    GetPollInfoResponse:
      type: object
      description: Poll information
      required:
        - pollId
        - messageId
        - question
        - options
        - isMultiple
        - isAnonymous
        - summary
        - myVote
      properties:
        pollId:
          example: gIQffAsGi8
          description: Poll ID
          type: string
        messageId:
          example: gIQffAsGi8
          description: ID of the message the poll was created in
          type: string
        question:
          example: Which option do you choose?
          description: Text of the poll question
          type: string
        options:
          description: Array of answer options
          type: array
          example:
            - Option 1
            - Option 2
            - Option 3
          items:
            type: string
        isMultiple:
          description: Whether multiple answer options can be selected
          type: boolean
          example: true
        isAnonymous:
          description: Anonymous voting
          type: boolean
          example: false
        summary:
          $ref: "#/components/schemas/PollSummary"
        myVote:
          description: Array of indices of the answer options selected by the current user
          type: array
          items:
            type: integer
    PollSummary:
      type: object
      description: Summary of the poll results
      required:
        - votes
        - totalVoters
      properties:
        votes:
          description: Array of vote counts per answer option
          type: array
          items:
            $ref: "#/components/schemas/OptionVoteCount"
        totalVoters:
          description: Total number of voters
          example: 42
          type: integer
          format: int64
        firstVotedMemberIds:
          description: Array of membershipId values of the first members who voted
          type: array
          items:
            type: string
    OptionVoteCount:
      type: object
      description: Number of votes for an answer option
      required:
        - option
        - votesCount
      properties:
        option:
          description: Index of the answer option (starting from 0)
          example: 0
          type: integer
        votesCount:
          description: Number of votes for this option
          example: 15
          type: integer
          format: int64
    GetPollVotesResponse:
      type: object
      description: List of individual votes in the poll
      required:
        - votes
        - totalVoters
        - allResultCount
      properties:
        votes:
          description: Array of votes
          type: array
          items:
            $ref: "#/components/schemas/PollVote"
        totalVoters:
          description: Total number of voters
          example: 42
          type: integer
        allResultCount:
          description: Total number of vote records (for pagination)
          example: 100
          type: integer
          format: int64
        prevPageToken:
          description: Previous page token
          type: string
          example: BDK5NyCqI4
        nextPageToken:
          description: Next page token
          type: string
          example: BDK5NyCqI4
    PollVote:
      type: object
      description: An individual vote in the poll
      required:
        - memberId
        - option
      properties:
        memberId:
          example: ADK5NyCqIK
          description: Membership ID of the member who voted
          type: string
        option:
          description: Index of the selected answer option
          type: integer
    SearchMessagesResponse:
      type: object
      description: Message search results
      required:
        - messages
        - allResultCount
      properties:
        messages:
          description: Array of found messages
          type: array
          items:
            $ref: "#/components/schemas/FoundMessage"
        nextPageToken:
          description: Next page token
          type: string
        prevPageToken:
          description: Previous page token
          type: string
        allResultCount:
          description: Total number of results found
          type: integer
          format: int64
    FoundMessage:
      type: object
      description: A found message with match highlighting
      required:
        - chatId
        - message
        - searchResult
      properties:
        chatId:
          example: w:AIQffAsGi8
          description: ID of the chat the message belongs to
          type: string
        message:
          description: Found message
          $ref: "#/components/schemas/Message"
        searchResult:
          description: Match text with highlighting (using == markers)
          example: Hi, this is a ==search query==
          type: string
    SearchRecordingsResponse:
      type: object
      description: Conference recordings search results
      required:
        - recordings
        - allResultCount
      properties:
        recordings:
          description: Array of found recordings
          type: array
          items:
            $ref: "#/components/schemas/FoundRecording"
        nextPageToken:
          description: Next page token
          type: string
        prevPageToken:
          description: Previous page token
          type: string
        allResultCount:
          description: Total number of results found
          type: integer
          format: int64
    FoundRecording:
      type: object
      description: A found conference recording with matches
      required:
        - recording
        - searchOccurrences
      properties:
        recording:
          $ref: "#/components/schemas/Recording"
        searchOccurrences:
          description: Array of found matches in the recording
          type: array
          items:
            $ref: "#/components/schemas/SearchOccurrence"
    Recording:
      type: object
      description: Conference recording information
      required:
        - recordingId
        - conferenceId
        - createdAt
      properties:
        recordingId:
          example: AIQffAsGi8
          description: Recording ID
          type: string
        conferenceId:
          example: BIQffAsGi8
          description: Conference ID
          type: string
        chatId:
          example: w:AIQffAsGi8
          description: ID of the conference chat
          type: string
        title:
          example: Weekly meeting
          description: Recording title
          type: string
        createdAt:
          description: Date and time the recording was created
          example: "2024-02-26T18:58:36.154+03:00"
          type: string
          format: date-time
    SearchOccurrence:
      type: object
      description: A search query match in the recording
      required:
        - phrase
        - occurrence
        - type
      properties:
        phrase:
          description: Original text
          example: transcription text
          type: string
        occurrence:
          description: Match text with highlighting
          example: "==transcription== text"
          type: string
        fromStart:
          description: Offset from the start of the recording in ISO 8601 Duration format
          example: PT1M30S
          type: string
        membershipId:
          description: MembershipId of the speaker
          example: AIQffAsGi8
          type: string
        guestId:
          description: Conference guest ID
          example: AIQffAsGi8
          type: string
        type:
          description: Type of content in which the match was found
          $ref: "#/components/schemas/OccurrenceType"
    SearchMembersResponse:
      type: object
      description: Member search results
      required:
        - members
        - allResultCount
      properties:
        members:
          description: Array of MemberInfo of the found members
          type: array
          items:
            $ref: "#/components/schemas/MemberInfo"
        nextPageToken:
          description: Next page token
          type: string
        prevPageToken:
          description: Previous page token
          type: string
        allResultCount:
          description: Total number of results found
          type: integer
          format: int64
    SearchChatsResponse:
      type: object
      description: Chat search results
      required:
        - chats
        - allResultCount
      properties:
        chats:
          description: Array of found chats
          type: array
          items:
            $ref: "#/components/schemas/ChatMembership"
        nextPageToken:
          description: Next page token
          type: string
        prevPageToken:
          description: Previous page token
          type: string
        allResultCount:
          description: Total number of results found
          type: integer
          format: int64
    SearchSortBy:
      description: Search result sort type
      example: DATE
      type: string
      enum:
        - DATE
        - RELEVANCE
    OccurrenceType:
      description: Type of content in which the match was found
      example: TRANSCRIPTION
      type: string
      enum:
        - TRANSCRIPTION
        - SUMMARY
        - TITLE
    MemberSearchBy:
      description: Member search criterion
      example: FULL_NAME
      type: string
      enum:
        - FULL_NAME
        - EMAIL
        - POSITION
        - DEPARTMENT
    ArchivedFilter:
      description: Filter by chat archived state
      example: UNARCHIVED_ONLY
      type: string
      enum:
        - UNARCHIVED_ONLY
        - ARCHIVED_ONLY
        - ALL
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: "A token that can be obtained from aibot@yuchat.ai using the /botcreate command."
security:
  - bearerAuth: []
