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

# Create Coupon

> Mint a coupon.

Naming a `userId` makes it that user's coupon and emails them the code;
without one it is a campaign code anyone can redeem, which the caller
distributes. `totalCount` caps how many times it can be redeemed.



## OpenAPI

````yaml https://api.primeintellect.ai/openapi.json post /api/admin/coupons
openapi: 3.1.0
info:
  title: PI API
  version: 0.1.0
servers:
  - url: https://api.primeintellect.ai
security: []
paths:
  /api/admin/coupons:
    post:
      tags:
        - admin-coupons
      summary: Create Coupon
      description: |-
        Mint a coupon.

        Naming a `userId` makes it that user's coupon and emails them the code;
        without one it is a campaign code anyone can redeem, which the caller
        distributes. `totalCount` caps how many times it can be redeemed.
      operationId: create_coupon_api_admin_coupons_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse_dict_'
        '401':
          description: Authorization failed
        '403':
          description: Insufficient permissions
        '422':
          description: Invalid request data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    CouponRequest:
      properties:
        amount:
          type: integer
          exclusiveMinimum: 0
          title: Amount
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
        expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Expires At
        total_count:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Total Count
        currency:
          type: string
          title: Currency
          default: USD
        coupon_value:
          anyOf:
            - type: string
            - type: 'null'
          title: Coupon Value
        type:
          anyOf:
            - $ref: '#/components/schemas/CouponTypeEnum'
            - type: 'null'
        campaign_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Campaign Name
      type: object
      required:
        - amount
      title: CouponRequest
    GenericResponse_dict_:
      properties:
        data:
          anyOf:
            - type: object
            - type: 'null'
          title: Data
          description: Response data
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Response status
      type: object
      title: GenericResponse[dict]
    ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Errors
      type: object
      required:
        - errors
      title: ErrorResponse
    CouponTypeEnum:
      type: string
      enum:
        - USER
        - TEAM
      title: CouponTypeEnum
    ErrorDetail:
      properties:
        param:
          type: string
          title: Param
        details:
          type: string
          title: Details
      type: object
      required:
        - param
        - details
      title: ErrorDetail
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````