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

# Create coupon

> Use when creating a discount (e.g. promo code or referral). Ideal for percent or fixed value, with optional validity and usage limits.



## OpenAPI

````yaml /api-reference/openapi.json post /coupons
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /coupons:
    post:
      tags:
        - Coupons
      summary: Create coupon
      description: >-
        Use when creating a discount (e.g. promo code or referral). Ideal for
        percent or fixed value, with optional validity and usage limits.
      operationId: createCoupon
      requestBody:
        description: Coupon request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCouponRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CouponResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
components:
  schemas:
    CreateCouponRequest:
      required:
        - cadence
        - name
        - type
      type: object
      properties:
        amount_off:
          type: string
        cadence:
          $ref: '#/components/schemas/types.CouponCadence'
        currency:
          type: string
        duration_in_periods:
          type: integer
        max_redemptions:
          type: integer
        metadata:
          type: object
          additionalProperties:
            type: string
        name:
          type: string
        percentage_off:
          type: string
        redeem_after:
          type: string
        redeem_before:
          type: string
        rules:
          type: object
          additionalProperties: true
        type:
          $ref: '#/components/schemas/types.CouponType'
    CouponResponse:
      type: object
      properties:
        amount_off:
          type: string
        cadence:
          $ref: '#/components/schemas/types.CouponCadence'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        currency:
          type: string
        duration_in_periods:
          type: integer
        environment_id:
          type: string
        id:
          type: string
        max_redemptions:
          type: integer
        metadata:
          type: object
          additionalProperties:
            type: string
        name:
          type: string
        percentage_off:
          type: string
        redeem_after:
          type: string
        redeem_before:
          type: string
        rules:
          type: object
          additionalProperties: true
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        total_redemptions:
          type: integer
        type:
          $ref: '#/components/schemas/types.CouponType'
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    errors.ErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - not_found
            - already_exists
            - version_conflict
            - validation_error
            - invalid_operation
            - permission_denied
            - http_client_error
            - database_error
            - system_error
            - internal_error
            - service_unavailable
        details:
          type: object
          additionalProperties:
            type: object
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.CouponCadence:
      type: string
      enum:
        - once
        - repeated
        - forever
      x-enum-varnames:
        - CouponCadenceOnce
        - CouponCadenceRepeated
        - CouponCadenceForever
      x-speakeasy-name-override: CouponCadence
    types.CouponType:
      type: string
      enum:
        - fixed
        - percentage
      x-enum-varnames:
        - CouponTypeFixed
        - CouponTypePercentage
      x-speakeasy-name-override: CouponType
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````