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

# Create coupon

> Creates a coupon. **Side effect:** a Stripe Coupon + Promotion Code are created. Restrictions: percentage discounts must be 1-100; `duration=repeating` requires `durationMonths`; `discountType=fixed_amount` requires `applicablePlanIds`; plans in `applicablePlanIds` must already have a Stripe product and share a currency.



## OpenAPI

````yaml /api-reference/openapi.json post /public/api/v1/billing/coupons
openapi: 3.1.0
info:
  contact:
    email: support@gennia.ai
    name: Gennia Support
    url: https://gennia.ai
  description: >-
    Workspace-scoped API authenticated via workspace API key (header `X-Api-Key:
    gsk_...` or `Authorization: Bearer gsk_...`).
  title: Gennia Public API
  version: v1
servers:
  - description: Production
    url: https://api.gennia.ai
security:
  - workspaceApiKey: []
tags:
  - description: Slash commands available inside the agent chat.
    name: Agent Commands
  - description: Link skills to an agent.
    name: Agent Skills
  - description: Read/rename/delete workspace knowledge sources.
    name: Knowledge Sources
  - description: Link knowledge sources to an agent.
    name: Agent Knowledge Sources
  - description: Workspace CRUD for HTTP/DB/Custom tools.
    name: HTTP Tools
  - description: Read/write the agent's model selection + capabilities.
    name: Agent Model
  - description: Discover trigger types available for Native MCP toolkits.
    name: Native MCP Triggers
  - description: Discover and toggle capability features.
    name: Agent Features
  - description: Hub access settings.
    name: Hub Access
  - description: Read conversation history and delete conversations.
    name: Conversations
  - description: Send messages to a published agent.
    name: Messages
  - description: Workspace CRUD for External MCP servers.
    name: External MCPs
  - description: Hub billing — plans, coupons, credit packages.
    name: Billing
  - description: External links shown in the hub menu.
    name: Hub External Links
  - description: Link Native MCP (Composio) instances to an agent.
    name: Agent Native MCPs
  - description: Manage AI agents in the workspace bound to the API key.
    name: Agents
  - description: Read published version snapshots and restore.
    name: Agent Versions
  - description: Read/rename/delete workspace skills.
    name: Skills
  - description: Manage hub end-customers (client workspaces).
    name: Clients
  - description: Hub domain (subdomain) management.
    name: Hub Domain
  - description: Read/write the agent's prompt context.
    name: Agent Prompt
  - description: Scheduled / trigger-based runs of an agent.
    name: Agent Automations
  - description: Link HTTP/DB/Custom tools to an agent.
    name: Agent HTTP Tools
  - description: Hub identity, branding, logos and overall configuration.
    name: Hub
  - description: Discover AI models available to this workspace.
    name: AI Models
  - description: Discover channel types and their config schemas.
    name: Channel Types
  - description: Connect agents to messaging surfaces.
    name: Agent Channels
  - description: Link workspace-registered External MCP servers to an agent.
    name: Agent External MCPs
  - description: Workspace-scoped public API (API key authentication)
    name: Public API
  - description: Dynamic-prompt variable definitions.
    name: Agent Variables
  - description: Link sub-agents as delegation targets.
    name: Agent Sub-agents
paths:
  /public/api/v1/billing/coupons:
    post:
      tags:
        - Billing
      summary: Create coupon
      description: >-
        Creates a coupon. **Side effect:** a Stripe Coupon + Promotion Code are
        created. Restrictions: percentage discounts must be 1-100;
        `duration=repeating` requires `durationMonths`;
        `discountType=fixed_amount` requires `applicablePlanIds`; plans in
        `applicablePlanIds` must already have a Stripe product and share a
        currency.
      operationId: createCoupon
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePublicCouponRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicCouponDTO'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicCouponDTO'
          description: Validation failed; business rule violation
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicCouponDTO'
          description: Missing or invalid API key
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicCouponDTO'
          description: Stripe API failure (rollback)
      security:
        - workspaceApiKey: []
components:
  schemas:
    CreatePublicCouponRequest:
      description: Body for creating a new discount coupon.
      properties:
        applicablePlanIds:
          description: >-
            Required when scope = SPECIFIC. Plan public IDs the coupon applies
            to.
          items:
            format: uuid
            type: string
          type: array
        code:
          description: >-
            Public coupon code shared with customers. Letters, numbers and
            underscores only.
          example: WELCOME10
          maxLength: 50
          minLength: 3
          pattern: ^[A-Za-z0-9_]+$
          type: string
        discountType:
          description: Discount type (percentage or fixed amount).
          enum:
            - percentage
            - fixed_amount
          type: string
        discountValue:
          description: >-
            Discount amount. For PERCENTAGE: 1..100. For FIXED_AMOUNT: amount in
            the smallest currency unit (cents).
          example: 10
          format: int32
          minimum: 1
          type: integer
        duration:
          description: How the discount is applied across billing cycles.
          enum:
            - once
            - repeating
            - forever
          type: string
        durationMonths:
          description: >-
            Required when duration = REPEATING. Number of months the discount
            lasts (1..36).
          example: 3
          format: int32
          maximum: 36
          minimum: 1
          type: integer
        maxUses:
          description: Maximum total redemptions of this coupon. Omit for unlimited.
          example: 100
          format: int32
          minimum: 1
          type: integer
        name:
          description: Optional internal display name for the coupon.
          example: Welcome 10% off
          maxLength: 100
          minLength: 0
          type: string
        scope:
          description: Whether the coupon applies to all plans or a specific list.
          enum:
            - hub
            - plans
          type: string
        validFrom:
          description: Start of the validity window. Defaults to now when omitted.
          example: '2026-06-01T00:00:00Z'
          format: date-time
          type: string
        validUntil:
          description: End of the validity window. Must be in the future when provided.
          example: '2026-12-31T23:59:59Z'
          format: date-time
          type: string
      required:
        - discountType
        - discountValue
        - duration
        - scope
      type: object
    PublicCouponDTO:
      properties:
        active:
          type: boolean
        applicablePlans:
          items:
            $ref: '#/components/schemas/PlanRef'
          type: array
        code:
          type: string
        createdAt:
          format: date-time
          type: string
        currency:
          type: string
        discountType:
          enum:
            - percentage
            - fixed_amount
          type: string
        discountValue:
          format: int32
          type: integer
        duration:
          enum:
            - once
            - repeating
            - forever
          type: string
        durationMonths:
          format: int32
          type: integer
        isExhausted:
          type: boolean
        isExpired:
          type: boolean
        maxUses:
          format: int32
          type: integer
        name:
          type: string
        publicId:
          format: uuid
          type: string
        scope:
          enum:
            - hub
            - plans
          type: string
        stripeCouponId:
          type: string
        stripePromotionCodeId:
          type: string
        timesUsed:
          format: int32
          type: integer
        updatedAt:
          format: date-time
          type: string
        validFrom:
          format: date-time
          type: string
        validUntil:
          format: date-time
          type: string
      type: object
    PlanRef:
      properties:
        billingIntervalMonths:
          format: int32
          type: integer
        billingType:
          enum:
            - one_time
            - recurring
          type: string
        creditsIncluded:
          format: int32
          type: integer
        currency:
          type: string
        name:
          type: string
        priceCents:
          format: int32
          type: integer
        publicId:
          format: uuid
          type: string
      type: object
  securitySchemes:
    workspaceApiKey:
      in: header
      name: X-Api-Key
      type: apiKey

````