> ## 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 post /channels
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:
    post:
      tags:
        - Client Channels
      summary: チャンネルの作成
      description: 新規チャンネルを作成します。
      operationId: ClientChannels_createChannel
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Channels.CreateChannelRequest'
      responses:
        '200':
          description: チャンネルの作成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Channels.Channel'
        '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:
    Channels.CreateChannelRequest:
      type: object
      required:
        - name
        - channel_type
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/ChannelId'
          description: チャンネルID（任意のIDを指定できます。指定しない場合は自動生成されます）
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: チャンネル名
        channel_type:
          allOf:
            - $ref: '#/components/schemas/Channels.ChannelType'
          description: 公開チャンネルか秘密チャンネルか
        metadata:
          type: object
          additionalProperties: {}
          nullable: true
          description: 任意の追加メタデータ
      description: チャンネル作成時のリクエストボディ
    Channels.Channel:
      type: object
      required:
        - name
        - channel_type
        - is_archived
        - created_at
        - updated_at
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/ChannelId'
          description: チャンネルID
          readOnly: true
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: チャンネル名
        channel_type:
          allOf:
            - $ref: '#/components/schemas/Channels.ChannelType'
          description: 公開チャンネルか秘密チャンネルか
        metadata:
          type: object
          additionalProperties: {}
          nullable: true
          description: 任意の追加メタデータ
        is_archived:
          type: boolean
          description: アーカイブ済みかどうか
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: 作成日時
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: 更新日時
          readOnly: true
    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: サーバーでエラーが発生しました。時間をおいて再度お試しください。
    ChannelId:
      type: string
      minLength: 1
      maxLength: 100
      pattern: ^[a-zA-Z0-9_-]+$
    Channels.ChannelType:
      type: string
      enum:
        - Public
        - Secret
    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トークンとして指定します

````