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

# ユーザーの削除

> 指定したユーザーを削除します。



## OpenAPI

````yaml delete /users/{user_id}
openapi: 3.0.0
info:
  title: Rheel Chat API
  version: 1.0.1
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  description: >-
    RheelのChat API仕様です。主に以下の2種類のエンドポイントを提供し、 認証方式によって利用方法が異なります。

    1. **Server Request**

    管理者（あるいはバックエンドサーバー）が、管理画面で発行したアプリケーション独自のAPI Key を用いた、ユーザー管理 (ユーザー作成・削除など)
    やセッショントークンの発行などを行う際のエンドポイントです。


    2. **User Request**

    セッショントークン発行のエンドポイントを介して取得したセッショントークンを用いた、メッセージの投稿やチャンネルの閲覧・参加などのエンドポイントです。


    ![ユーザーリクエストとサーバーリクエストの概念図](./images/request-image.png)


    ---

    ## 認証の流れ

    1. 管理画面からアプリケーション独自の API Key を取得します。

    これはサーバーサイド(管理系)の認証に使用します。


    2. エンドユーザーがログインすると、上記の API Key を用いてユーザーごとに

    セッショントークンを発行します。


    3. ユーザーは、フロントエンド (Web クライアントやモバイルアプリなど) から

    セッショントークンを利用してチャットサービスにアクセスし、メッセージの送受信や

    チャンネルの閲覧・参加を行います。



    Webhookのイベントやユーザーの作成・削除、権限管理などについて、詳しくはヘルプページをご覧ください。
servers:
  - url: https://<application_id>.chat.rheel.net/v1
    description: 本番サーバー
    variables:
      application_id:
        default: YOUR_APP_ID（RheelチャットインスタンスのアプリケーションID）
security: []
tags:
  - name: Users
  - name: Channels
  - name: Messages
  - name: Bots
paths:
  /users/{user_id}:
    delete:
      tags:
        - Users
      summary: ユーザーの削除
      description: 指定したユーザーを削除します。
      operationId: Users_deleteUser
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UserId'
      responses:
        '200':
          description: ユーザー削除完了
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users.DeleteUserResponse'
        '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:
        - ServerApiKeyAuth: []
components:
  schemas:
    UserId:
      type: string
      minLength: 1
      maxLength: 100
      pattern: ^[a-zA-Z0-9_-]+$
    Users.DeleteUserResponse:
      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: サーバーでエラーが発生しました。時間をおいて再度お試しください。
    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:
    ServerApiKeyAuth:
      type: apiKey
      in: header
      name: X-Rheel-API-Key
      description: 管理系API呼び出し用のAPIキーを指定します

````