> ## 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.

# Xóa một API key

> Sử dụng CometAPI DELETE /api/token/{id} để xóa một API key theo ID cho tài khoản đã xác thực.

Sử dụng endpoint này để xóa một API key theo ID.

<Note>
  Tạo personal access token tại [Console → Personal Settings](https://www.cometapi.com/console/personal), sau đó gửi nó dưới dạng giá trị thô của header `Authorization`. Không thêm tiền tố `Bearer`.
</Note>

Sau khi xóa, key này sẽ không còn dùng được cho các yêu cầu model. Phản hồi chỉ xác nhận việc xóa có thành công hay không.

Tham số đường dẫn `id` là ID key dạng số được trả về bởi [List API keys](./list-api-keys). Việc xóa một key là vĩnh viễn đối với giá trị key đó; hãy tạo API key mới nếu tích hợp cần lại thông tin xác thực.


## 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`.

````