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

# メッセージの削除

> チャンネル内のメッセージを削除します（roleがadminの場合のみ削除可能）。



## OpenAPI

````yaml delete /channels/{channel_id}/messages
openapi: 3.0.0
info:
  title: Rheel Chat Client API
  version: 1.0.0
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  description: |-
    RheelのChat API (Client版) 仕様です。

    このAPIはJWT認証（UserSessionAuth）を使用するクライアント向けのエンドポイントを提供します。
    すべてのエンドポイントは `/client` プレフィックスを持ち、セッショントークンによる認証が必要です。

    ## 認証方式
    - **JWT認証（Bearer Token）**: セッショントークン発行のエンドポイントを介して取得したセッショントークンを
    Authorizationヘッダーに `Bearer {token}` 形式で指定します。

    ## WebSocketについて
    このサービスでは、メッセージや通知をリアルタイムに受信するために WebSocket通信を提供しています。
    接続先は以下のURLです: `wss://<application_id>.chat.rheel.net/v1/ws`
servers:
  - url: https://<application_id>.chat.rheel.net/client/v1
    description: 本番サーバー
    variables:
      application_id:
        default: YOUR_APP_ID（RheelチャットインスタンスのアプリケーションID）
security: []
tags:
  - name: Client Channels
  - name: Client Messages
  - name: Client Users
paths:
  /channels/{channel_id}/messages:
    delete:
      tags:
        - Client Messages
      summary: メッセージの削除
      description: チャンネル内のメッセージを削除します（roleがadminの場合のみ削除可能）。
      operationId: ClientMessages_deleteMessages
      parameters:
        - name: channel_id
          in: path
          required: true
          description: メッセージを削除する対象のチャンネルID
          schema:
            $ref: '#/components/schemas/ChannelId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Messages.DeleteMessagesRequest'
      responses:
        '200':
          description: メッセージの削除完了
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Messages.DeleteMessagesResponse'
        '400':
          description: 入力内容が不正です
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.BadRequestError'
        '401':
          description: 認証に失敗しました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.UnauthorizedError'
        '403':
          description: アクセス権がありません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.ForbiddenError'
        '404':
          description: リソースが存在しません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.NotFoundError'
        '500':
          description: サーバーでエラーが発生しました。時間をおいて再度お試しください。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.InternalServerError'
      security:
        - UserSessionAuth: []
components:
  schemas:
    ChannelId:
      type: string
      minLength: 1
      maxLength: 100
      pattern: ^[a-zA-Z0-9_-]+$
    Messages.DeleteMessagesRequest:
      type: object
      required:
        - message_ids
      properties:
        message_ids:
          type: array
          items:
            $ref: '#/components/schemas/Uuid'
          minItems: 1
          description: 削除するメッセージIDの配列（最低1件以上必要）
      description: メッセージ削除リクエスト
    Messages.DeleteMessagesResponse:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          enum:
            - true
      description: メッセージの削除完了
    Error.BadRequestError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
              enum:
                - BAD_REQUEST
            errors:
              type: array
              items:
                $ref: '#/components/schemas/Error.ValidationError'
          required:
            - message
            - code
      allOf:
        - $ref: '#/components/schemas/TypeSpec.Http.BadRequestResponse'
      description: 入力内容が不正です
    Error.UnauthorizedError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
              enum:
                - UNAUTHORIZED
          required:
            - message
            - code
      allOf:
        - $ref: '#/components/schemas/TypeSpec.Http.UnauthorizedResponse'
      description: 認証に失敗しました
    Error.ForbiddenError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
              enum:
                - FORBIDDEN
          required:
            - message
            - code
      allOf:
        - $ref: '#/components/schemas/TypeSpec.Http.ForbiddenResponse'
      description: アクセス権がありません
    Error.NotFoundError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
              enum:
                - NOT_FOUND
          required:
            - message
            - code
      allOf:
        - $ref: '#/components/schemas/TypeSpec.Http.NotFoundResponse'
      description: リソースが存在しません
    Error.InternalServerError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
              enum:
                - INTERNAL_SERVER_ERROR
          required:
            - message
            - code
      allOf:
        - type: object
          description: ''
      description: サーバーでエラーが発生しました。時間をおいて再度お試しください。
    Uuid:
      type: string
      format: uuid
    Error.ValidationError:
      type: object
      required:
        - field
        - message
        - code
      properties:
        field:
          type: string
        message:
          type: string
        code:
          type: string
      description: バリデーションエラー詳細
    TypeSpec.Http.BadRequestResponse:
      type: object
      description: The server could not understand the request due to invalid syntax.
    TypeSpec.Http.UnauthorizedResponse:
      type: object
      description: Access is unauthorized.
    TypeSpec.Http.ForbiddenResponse:
      type: object
      description: Access is forbidden.
    TypeSpec.Http.NotFoundResponse:
      type: object
      description: The server cannot find the requested resource.
  securitySchemes:
    UserSessionAuth:
      type: http
      scheme: bearer
      description: ユーザーがログインすると発行されるsession_idをBearerトークンとして指定します

````