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

# 更新 API KEY

通过 UUID 更新指定 API KEY 的信息。

<Note>
  注意：调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证，需要创建后复制进行使用。
</Note>


## OpenAPI

````yaml adminapi.yaml PUT /api_keys/{uuid}
openapi: 3.1.0
info:
  title: 极客智坊 API 文档
  description: 极客智坊 API KEY 管理文档 提供 API KEY 的创建、删除、修改、查询功能
  version: 1.0.0
servers:
  - url: https://geekai.co/api
    description: 国内调用入口
  - url: https://geekai.dev/api
    description: 海外调用入口
security:
  - bearerAuth: []
paths:
  /api_keys/{uuid}:
    put:
      tags:
        - API_KEY
      summary: 修改 API KEY 信息
      description: 通过 UUID 修改指定 API KEY
      operationId: updateApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - group
              properties:
                name:
                  type: string
                  description: 名称，可用于标识 API KEY 的使用场景/用途，便于后续管理/统计费用
                  default: default
                  example: geekai
                group:
                  type: string
                  description: >-
                    代理策略分组，用于区分不同的代理策略，目前支持四个策略：lowcost（低价优先）, balance（均衡）,
                    ha（高可用）, none（不使用代理）
                  enum:
                    - lowcost
                    - balance
                    - ha
                    - none
                  default: balance
                  example: balance
                credit_limit:
                  type: number
                  description: 信用额度，单位：金币（1金币=0.01元），用于限时 API KEY 的消费上限，超出额度后将无法继续使用
                  default: 0
                  example: 10000
                expired_at:
                  type: string
                  format: date
                  description: 过期时间，过期后将无法继续使用
                  default: ''
                  example: '2025-12-31'
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: 成功/失败响应消息
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: API KEY 不存在
          content:
            application/json:
              schema:
                $ref: a2102633-62e7-415c-85ee-4399ed0f9f72
        '500':
          $ref: '#/components/responses/StandardError'
components:
  responses:
    ValidationError:
      description: 参数验证错误
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: validation_error
              message:
                type: string
                example: 参数验证失败
              details:
                type: object
                additionalProperties:
                  type: string
                example:
                  field: 错误描述
    Unauthorized:
      description: 未授权
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: unauthorized
              message:
                type: string
                example: Invalid API key or token
    StandardError:
      description: 标准错误响应
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 错误代码
          example: invalid_request
        message:
          type: string
          description: 错误信息描述
          example: 请求参数不合法
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 系统KEY

````