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

# 创建促销码

> Create a promotion code for a coupon.



## OpenAPI

````yaml POST /promotion-code/{id}
openapi: 3.1.0
info:
  title: Clink API
  description: >-
    Official API documentation for Clink's payment processing platform. This API
    enables merchants to create and manage payment sessions, handle
    subscriptions, and process transactions.
  version: 1.0.0
servers:
  - url: https://uat-api.clinkbill.com/api/
security:
  - ApiKeyAuth: []
paths:
  /promotion-code/{id}:
    post:
      summary: Create Promotion Code
      description: Create a promotion code for a coupon.
      operationId: createPromotionCode
      parameters:
        - $ref: '#/components/parameters/TimestampHeader'
        - name: id
          in: path
          description: Unique identifier of the coupon
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromotionCodeCreateRequest'
            examples:
              example:
                value:
                  code: SUMMER2026
                  firstOrderOnly: true
                  maxRedemptionLimit: 100
                  validPeriodStart: 1780660800000
                  validPeriodEnd: 1783252800000
      responses:
        '200':
          description: Promotion code created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RPromotionCodeInfoResponse'
            '*/*':
              schema:
                $ref: '#/components/schemas/RPromotionCodeInfoResponse'
        '401':
          description: Unauthorized
          content:
            '*/*':
              schema:
                type: string
components:
  parameters:
    TimestampHeader:
      name: X-Timestamp
      in: header
      required: true
      description: >-
        Current timestamp in milliseconds since Unix epoch (required for request
        signing)
      schema:
        type: string
        example: '1783513683000'
  schemas:
    PromotionCodeCreateRequest:
      type: object
      description: Parameters required to create a promotion code
      properties:
        code:
          type: string
          description: >-
            Customer-facing promotion code. If omitted, a code can be generated
            by the platform.
          pattern: ^[a-zA-Z0-9]{1,32}$
          example: SUMMER2026
        firstOrderOnly:
          type: boolean
          description: Whether this promotion code is limited to first orders only
        restrictedCustomerIds:
          type: array
          description: >-
            Customer IDs allowed to redeem this promotion code. Empty means
            unrestricted.
          items:
            type: string
        minimumSpend:
          type: object
          description: Minimum spend by currency. Key is an ISO currency code.
          additionalProperties:
            type: number
          example:
            USD: 10
            EUR: 9
        perCustomerRedemptionLimit:
          type: integer
          format: int32
          description: Redemption limit per customer
        maxRedemptionLimit:
          type: integer
          format: int32
          description: Maximum total redemptions for this promotion code
        validPeriodStart:
          type: integer
          format: int64
          description: >-
            Promotion code validity start time as a 13-digit Unix timestamp in
            milliseconds
          example: 1780660800000
        validPeriodEnd:
          type: integer
          format: int64
          description: >-
            Promotion code validity end time as a 13-digit Unix timestamp in
            milliseconds
          example: 1780660800000
    RPromotionCodeInfoResponse:
      type: object
      properties:
        code:
          type: integer
          description: Response status code, 200 when success
          format: int32
          example: 200
        msg:
          type: string
          example: success
          description: Brief description of what happened, 'success' when happy case
        data:
          $ref: '#/components/schemas/PromotionCodeInfoResponse'
      description: Body of the response message
    PromotionCodeInfoResponse:
      type: object
      properties:
        couponId:
          type: string
          description: Associated coupon ID
        promotionCodeId:
          type: string
          description: Unique identifier of the promotion code
        code:
          type: string
          description: Customer-facing promotion code
        status:
          type: string
          description: Promotion code status
          enum:
            - active
            - inactive
            - archived
          example: active
        firstOrderOnly:
          type: boolean
          description: Whether this promotion code is limited to first orders only
        redemptionCount:
          type: integer
          format: int32
          description: Number of times this promotion code has been redeemed
        maxRedemptionLimit:
          type: integer
          format: int32
          description: Maximum total redemptions for this promotion code
        validPeriodEnd:
          type: integer
          format: int64
          description: >-
            Promotion code validity end time as a 13-digit Unix timestamp in
            milliseconds
          example: 1754819711382
        createTime:
          type: integer
          format: int64
          description: >-
            Promotion code creation time as a 13-digit Unix timestamp in
            milliseconds
          example: 1754819711382
        mirroring:
          type: boolean
          description: Whether this record is mirrored data
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Your secret API key obtained from the Clink dashboard (Developers
        section)

````