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

# サービスユーザーのAPIキーを作成

> サービスユーザー用の新しい APIキーを作成します。

呼び出し元には ManageAccountServiceUsers 権限が必要です。

<div id="permissions">
  ## 権限
</div>

Enterprise レベルの `ManageAccountServiceUsers` 権限を持つサービスユーザーが必要です。


## OpenAPI

````yaml ja/v3-openapi.yaml POST /v3beta1/enterprise/service-users/{service_user_id}/api-keys
openapi: 3.1.0
info:
  description: Service User 認証および RBAC に対応した Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/enterprise/service-users/{service_user_id}/api-keys:
    post:
      tags:
        - service_user_api_keys
      summary: サービスユーザーのAPIキーを作成
      description: |-
        サービスユーザー用の新しい APIキーを作成します。

        呼び出し元には ManageAccountServiceUsers 権限が必要です。
      operationId: >-
        handle_create_service_user_api_key_v3beta1_enterprise_service_users__service_user_id__api_keys_post
      parameters:
        - description: 'サービスユーザー ID（プレフィックス: service-user-）'
          in: path
          name: service_user_id
          required: true
          schema:
            example: service-user-abc123def456
            title: Service User Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiKeyRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyWithTokenResponse'
          description: 成功レスポンス
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 検証エラー
components:
  schemas:
    CreateApiKeyRequest:
      properties:
        expires_at:
          anyOf:
            - type: integer
            - type: 'null'
          description: 省略可能な有効期限です。秒単位のUNIXタイムスタンプで指定します。指定する場合は未来の時刻である必要があります。
          title: Expires At
        name:
          maxLength: 256
          minLength: 1
          title: Name
          type: string
      required:
        - name
      title: CreateApiKeyRequest
      type: object
    ApiKeyWithTokenResponse:
      description: APIキーの作成/ローテーションに関する共通レスポンスモデル（1回限りのトークンを含む）。
      properties:
        api_key_id:
          title: Api Key Id
          type: string
        api_key_name:
          title: Api Key Name
          type: string
        token:
          description: 生のAPIトークンです。これは作成時またはローテーション時に1回だけ表示されます。
          title: Token
          type: string
      required:
        - api_key_id
        - api_key_name
        - token
      title: ApiKeyWithTokenResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearerAuth:
      description: 'サービスユーザーの認証情報（接頭辞: cog_）'
      scheme: bearer
      type: http

````