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

# Verify (redeem) code

Verifies (redeems) a code for the project. Request body must include `code` (required); optional `verified_by` records who verified. Succeeds only when the code is unused, not disabled, not expired, and the project is enabled. Response `success=true` means success; when `success=false`, check `error_code` and `message` (e.g. `CODE_ALREADY_USED`, `CODE_EXPIRED`).


## OpenAPI

````yaml en/api-reference/endpoint/en/api-reference/openapi.json post /api/v1/projects/{project_id}/codes/verify
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/verify:
    post:
      summary: 核销激活码
      operationId: verifyCode
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - code
              properties:
                code:
                  type: string
                verified_by:
                  type: string
      responses:
        '200':
          description: 核销结果（success=true 成功，success=false 业务失败）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifyResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    VerifyResponse:
      type: object
      properties:
        success:
          type: boolean
        code_id:
          type: string
          nullable: true
        code:
          type: string
        verified_at:
          type: integer
          nullable: true
        message:
          type: string
        error_code:
          type: string
          nullable: true
  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
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key + X-Timestamp + X-Signature（HMAC-SHA256）

````