> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# キーを作成

> 新しいAPI keyを作成します。



## OpenAPI

````yaml /ja/_specs/cloud-openapi.json post /v1/organizations/{organizationId}/keys
openapi: 3.0.1
info:
  contact:
    email: support@clickhouse.com
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-299828
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Service
  - name: Backup
  - name: OpenAPI
  - name: Prometheus
  - name: ClickPipes
paths:
  /v1/organizations/{organizationId}/keys:
    post:
      tags:
        - OpenAPI
      summary: キーを作成
      description: 新しいAPI keyを作成します。
      parameters:
        - description: keyを所有する組織のID。
          in: path
          name: organizationId
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyPostRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  requestId:
                    description: 各リクエストに割り当てられる一意のID。UUIDv4
                    format: uuid
                    type: string
                  result:
                    $ref: '#/components/schemas/ApiKeyPostResponse'
                  status:
                    description: HTTPステータスコード。
                    example: 200
                    type: number
                type: object
          description: 成功時のレスポンス
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    description: エラーの詳細説明。
                    type: string
                  status:
                    description: HTTPステータスコード。
                    example: 400
                    type: number
                type: object
          description: server が client error とみなされる何らかの理由により、リクエストを処理できないか、または処理しません。
components:
  schemas:
    ApiKeyPostRequest:
      properties:
        expireAt:
          description: キーの有効期限を示すタイムスタンプ。存在しない場合、`null` の場合、または空の場合、キーは無期限です。ISO-8601。
          format: date-time
          nullable: true
          type: string
        hashData:
          $ref: '#/components/schemas/ApiKeyHashData'
        ipAccessList:
          description: このキーを使用して API へのアクセスを許可する IP アドレスの一覧
          items:
            $ref: '#/components/schemas/IpAccessListEntry'
          type: array
        name:
          description: キーの名前。
          type: string
        roles:
          description: キーに割り当てられたロールの一覧。少なくとも 1 つの要素を含みます。
          items:
            enum:
              - admin
              - developer
              - query_endpoints
            type: string
          type: array
        state:
          description: 'キーの初期状態: ''enabled''、''disabled''。指定しない場合、新しいキーは ''enabled'' になります。'
          enum:
            - enabled
            - disabled
          type: string
    ApiKeyPostResponse:
      properties:
        key:
          $ref: '#/components/schemas/ApiKey'
        keyId:
          description: 生成されたキー ID。リクエストに 'hashData' がない場合にのみ提供されます。
          type: string
        keySecret:
          description: 生成されたキー シークレット。リクエストに 'hashData' がない場合にのみ提供されます。
          type: string
    ApiKeyHashData:
      properties:
        keyIdHash:
          description: キーIDのハッシュ。
          type: string
        keyIdSuffix:
          description: >-
            キーIDの下4桁。アルゴリズム: echo -n "yourpassword" | sha256sum | tr -d '-' |
            xxd -r -p | base64
          type: string
        keySecretHash:
          description: >-
            キーシークレットのハッシュ。アルゴリズム: echo -n "yourpassword" | sha256sum | tr -d '-'
            | xxd -r -p | base64
          type: string
    IpAccessListEntry:
      properties:
        description:
          description: アクセスを許可する IPv4 アドレスまたは IPv4 CIDR の任意の説明
          type: string
        source:
          description: IP または CIDR
          type: string
    ApiKey:
      properties:
        createdAt:
          description: キーの作成タイムスタンプ。ISO-8601。
          format: date-time
          type: string
        expireAt:
          description: キーの有効期限タイムスタンプ。存在しない場合、`null` の場合、または空の場合、キーの有効期限はありません。ISO-8601。
          format: date-time
          nullable: true
          type: string
        id:
          description: 一意の API キー ID。
          format: uuid
          type: string
        ipAccessList:
          description: このキーを使用してAPIにアクセスできるIPアドレスの一覧
          items:
            $ref: '#/components/schemas/IpAccessListEntry'
          type: array
        keySuffix:
          description: キーの末尾 4 文字。
          type: string
        name:
          description: キーの名前
          type: string
        roles:
          description: キーに割り当てられたロールの一覧。少なくとも 1 つの要素を含みます。
          items:
            enum:
              - admin
              - developer
              - query_endpoints
            type: string
          type: array
        state:
          description: 'キーの状態: ''enabled''、''disabled''。'
          enum:
            - enabled
            - disabled
          type: string
        usedAt:
          description: キーが最後に使用されたタイムスタンプ。存在しない場合、そのキーは一度も使用されていません。ISO-8601。
          format: date-time
          type: string
  securitySchemes:
    basicAuth:
      description: >-
        ClickHouse Cloud console で取得した key ID と key secret を使用してください:
        https://clickhouse.com/docs/cloud/manage/openapi
      scheme: basic
      type: http

````