> ## 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 GET /api/token/{id}를 사용해 인증된 계정의 API 키 레코드 1개를 ID로 조회합니다.

이 엔드포인트를 사용해 ID로 API 키 레코드 1개를 조회합니다.

<Note>
  [Console → Personal Settings](https://www.cometapi.com/console/personal)에서 personal access token을 생성한 다음, 이를 원시 `Authorization` 헤더 값으로 전송하세요. `Bearer` 접두사는 붙이지 마세요.
</Note>

`id` 경로 매개변수는 [API 키 목록 조회](./list-api-keys)에서 반환되는 숫자 키 ID입니다.

## API 키 상태

| Status | Meaning |
| ------ | ------- |
| `1`    | 활성화됨    |
| `2`    | 비활성화됨   |
| `3`    | 만료됨     |
| `4`    | 소진됨     |

## 반환 필드

| Field                  | Type           | Description                                                                                                                         |
| ---------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `id`                   | integer        | 숫자 API 키 ID입니다. 이 값을 [API 키 업데이트](./update-api-key) 및 [API 키 삭제](./delete-api-key)와 함께 사용하세요.                                       |
| `key`                  | string         | 관리 API가 반환하는 API 키 값입니다. 비밀 값으로 취급하고, 모델 요청에는 `Authorization: Bearer $COMETAPI_KEY`로 사용하세요.                                         |
| `status`               | integer        | 운영 상태입니다. `1`만 키가 모델 요청에 사용 가능함을 의미합니다.                                                                                             |
| `name`                 | string         | 사용자가 읽을 수 있는 키의 표시 이름입니다.                                                                                                           |
| `created_time`         | integer        | 키가 생성된 시점의 Unix 타임스탬프(초)입니다.                                                                                                        |
| `accessed_time`        | integer        | 키가 마지막으로 사용된 시점의 Unix 타임스탬프(초)입니다.                                                                                                  |
| `expired_time`         | integer        | 키가 만료되는 시점의 Unix 타임스탬프(초)입니다. `-1`은 만료되지 않음을 의미합니다.                                                                                 |
| `remain_quota`         | integer        | CometAPI 내부 quota 단위 기준의 남은 quota입니다.                                                                                               |
| `used_quota`           | integer        | 이 키가 이미 사용한 CometAPI 내부 quota 단위입니다.                                                                                                |
| `unlimited_quota`      | boolean        | 이 키가 남은 quota 검사 제한을 우회하는지 여부입니다.                                                                                                   |
| `model_limits_enabled` | boolean        | 이 키에 대해 모델 제한이 활성화되어 있는지 여부입니다.                                                                                                     |
| `model_limits`         | string         | `model_limits_enabled`가 `true`일 때 이 키에 허용된 model ID의 쉼표 구분 목록입니다. 비어 있으면 구성된 모델 목록이 없음을 의미합니다.                                      |
| `allow_ips`            | string or null | 한 줄바꿈으로 구분된 단일 문자열 형태의 IP 허용 목록입니다. 각 항목은 단일 IPv4 주소, 단일 IPv6 주소, IPv4 CIDR 또는 IPv6 CIDR일 수 있습니다. `null` 또는 `""`는 IP 제한이 없음을 의미합니다. |
| `group`                | string         | 계정 그룹 제한입니다. 비어 있으면 명시적인 그룹 제한이 없음을 의미합니다.                                                                                          |
| `cross_group_retry`    | boolean        | 자동 그룹 라우팅을 위해 cross-group retry가 활성화되어 있는지 여부입니다.                                                                                   |


## OpenAPI

````yaml api/openapi/api-keys/get-api-key.openapi.json GET /api/token/{id}
openapi: 3.1.0
info:
  title: Get API Key
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - accessTokenAuth: []
paths:
  /api/token/{id}:
    get:
      summary: Get a single API key
      description: Retrieve one API key record by ID for the authenticated account.
      operationId: getApiKey
      parameters:
        - name: id
          in: path
          required: true
          description: Numeric API key ID returned by the list endpoint.
          schema:
            type: integer
      responses:
        '200':
          description: API key record.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - message
                  - data
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/ApiKey'
              examples:
                success:
                  summary: API key record
                  value:
                    success: true
                    message: ''
                    data:
                      id: 1234
                      user_id: 5678
                      key: $COMETAPI_KEY
                      status: 1
                      name: production
                      created_time: 1766102400
                      accessed_time: 1766102400
                      expired_time: -1
                      remain_quota: 100000
                      unlimited_quota: false
                      model_limits_enabled: false
                      model_limits: ''
                      allow_ips: null
                      used_quota: 0
                      group: ''
                      cross_group_retry: false
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl https://api.cometapi.com/api/token/1234 \
              -H "Authorization: your-access-token"
components:
  schemas:
    ApiKey:
      type: object
      properties:
        id:
          type: integer
          description: >-
            Numeric API key ID. Use this value with the get, update, and delete
            endpoints.
          example: 1234
        user_id:
          type: integer
          description: Account user ID that owns the key.
          example: 5678
        key:
          type: string
          description: >-
            API key value returned by the management API. Treat it as a secret
            and use it as `Authorization: Bearer $COMETAPI_KEY` for model
            requests.
          example: $COMETAPI_KEY
        status:
          type: integer
          description: >-
            Operational status for the key. `1` means enabled, `2` disabled, `3`
            expired, and `4` exhausted. Only enabled keys are accepted by model
            endpoints.
          enum:
            - 1
            - 2
            - 3
            - 4
          example: 1
        name:
          type: string
          description: User-readable display name for the API key.
          example: production
          maxLength: 50
        created_time:
          type: integer
          description: Unix timestamp in seconds when the key was created.
          example: 1766102400
        accessed_time:
          type: integer
          description: >-
            Unix timestamp in seconds when the key was last used. Newly created
            keys may show the creation time until first use.
          example: 1766102400
        expired_time:
          type: integer
          description: >-
            Unix timestamp in seconds when the key expires. `-1` means no
            expiration.
          example: -1
        remain_quota:
          type: integer
          description: >-
            Remaining quota for this key in CometAPI internal quota units. When
            this reaches `0` and `unlimited_quota` is `false`, model requests
            are rejected as quota exhausted.
          example: 100000
        unlimited_quota:
          type: boolean
          description: Whether the key bypasses remaining-quota checks.
          example: false
        model_limits_enabled:
          type: boolean
          description: >-
            Whether model restrictions are active for this key. When `false`,
            `model_limits` is ignored.
          example: false
        model_limits:
          type: string
          description: >-
            Comma-separated model IDs allowed by this key when
            `model_limits_enabled` is `true`. Empty means no configured model
            list.
          example: ''
        allow_ips:
          type:
            - string
            - 'null'
          description: >-
            Optional IP allowlist stored as one newline-separated string. Each
            entry can be a single IPv4 address, single IPv6 address, IPv4 CIDR,
            or IPv6 CIDR. Example:
            `198.51.100.10\n203.0.113.0/24\n2001:db8::/32`. `null` or `""` means
            IP restrictions are disabled.
          example: |-
            198.51.100.10
            203.0.113.0/24
            2001:db8::/32
        used_quota:
          type: integer
          description: Quota already consumed by this key in CometAPI internal quota units.
          example: 0
        group:
          type: string
          description: >-
            Account group restriction for this key. Empty means no explicit
            group restriction.
          example: ''
        cross_group_retry:
          type: boolean
          description: >-
            Whether cross-group retry is enabled for automatic group routing.
            This is only meaningful when the key uses an auto-routed group such
            as `auto`.
          example: false
      additionalProperties: true
  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`.

````