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

# 查询激活码列表

分页查询指定项目下的激活码列表。支持按状态筛选（`unused` / `used` / `disabled` / `expired`）和按激活码内容的 `search` 关键词搜索。返回字段包含 `id`、`code`、`status`、`is_disabled`、`is_expired`、`expires_at`、`verified_at`、`verified_by`、`created_at`。


## OpenAPI

````yaml api-reference/endpoint/api-reference/openapi.json get /api/v1/projects/{project_id}/codes
openapi: 3.1.0
info:
  title: CodeGate SDK API
  description: CodeGate 激活码管理服务 SDK API - 使用 API Key + HMAC-SHA256 签名认证
  license:
    name: Apache-2.0
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: CodeGate API 服务器
security:
  - apiKeyAuth: []
paths:
  /api/v1/projects/{project_id}/codes:
    get:
      summary: 查询激活码列表
      description: 分页查询激活码，支持状态筛选和关键词搜索
      operationId: listCodes
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: page
          in: query
          schema:
            type: integer
            default: 1
        - name: page_size
          in: query
          schema:
            type: integer
            default: 20
            maximum: 100
        - name: status
          in: query
          description: unused | used | disabled | expired
          schema:
            type: string
            enum:
              - unused
              - used
              - disabled
              - expired
        - name: search
          in: query
          description: 按激活码内容搜索
          schema:
            type: string
      responses:
        '200':
          description: 激活码列表
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeListResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    CodeListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/CodeItem'
        total:
          type: integer
        page:
          type: integer
        page_size:
          type: integer
        total_pages:
          type: integer
    CodeItem:
      type: object
      properties:
        id:
          type: string
        code:
          type: string
        status:
          type: boolean
        is_disabled:
          type: boolean
        is_expired:
          type: boolean
        expires_at:
          type: integer
          nullable: true
        verified_at:
          type: integer
          nullable: true
        verified_by:
          type: string
          nullable: true
        created_at:
          type: integer
  responses:
    Unauthorized:
      description: 认证失败（API Key、签名、时间戳、项目状态）
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
    Forbidden:
      description: project_id 与 API Key 绑定的项目不匹配
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
    NotFound:
      description: 资源不存在
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key + X-Timestamp + X-Signature（HMAC-SHA256）

````