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

# 删除一个 API 密钥

> 使用 CometAPI DELETE /api/token/{id} 按 ID 为已认证账户删除一个 API 密钥。

使用此端点按 ID 删除一个 API 密钥。

<Note>
  在 [Console → Personal Settings](https://www.cometapi.com/console/personal) 生成个人访问令牌，然后将其作为原始 `Authorization` 请求头值发送。不要添加 `Bearer` 前缀。
</Note>

删除后，该密钥将无法再用于模型请求。响应仅确认删除是否成功。

`id` 路径参数是在 [列出 API 密钥](./list-api-keys) 中返回的数字型密钥 ID。删除某个密钥后，该密钥值将被永久失效；如果集成再次需要凭证，请创建一个新的 API 密钥。


## OpenAPI

````yaml api/openapi/api-keys/delete-api-key.openapi.json DELETE /api/token/{id}
openapi: 3.1.0
info:
  title: Delete API Key
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - accessTokenAuth: []
paths:
  /api/token/{id}:
    delete:
      summary: Delete an API key
      description: >-
        Delete one API key by ID for the authenticated account. After deletion,
        the key value can no longer be used for model requests.
      operationId: deleteApiKey
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            Numeric API key ID returned by the list endpoint. Deleting this ID
            permanently invalidates that key value.
          schema:
            type: integer
      responses:
        '200':
          description: Delete result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResultEnvelope'
              examples:
                success:
                  summary: Deleted
                  value:
                    success: true
                    message: ''
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl -X DELETE https://api.cometapi.com/api/token/1234 \
              -H "Authorization: your-access-token"
components:
  schemas:
    ResultEnvelope:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          description: Whether the delete operation succeeded.
          example: true
        message:
          type: string
          description: >-
            Backend status message. The value is usually an empty string on
            success.
          example: ''
  securitySchemes:
    accessTokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Personal access token copied from CometAPI Console > Personal Settings.
        Send the raw token value; do not prefix it with `Bearer`.

````