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

# Create discount

> Creates a new reusable discount.



## OpenAPI

````yaml /openapi.yaml post /v1/discounts
openapi: 3.0.3
info:
  title: Quentli REST API
  version: 1.0.0
  description: OpenAPI spec for Quentli REST endpoints.
servers:
  - url: https://api.quentli.com
    description: Production API
  - url: https://api.staging.quentli.com
    description: Staging API for production-like validation
  - url: https://api.demo.quentli.com
    description: Demo API hostname served by staging
security:
  - organizationApiKey: []
tags:
  - name: Auth
  - name: Billing
  - name: Catalog
  - name: Customers
  - name: Invoices
  - name: Payment Methods
  - name: Payment Sessions
  - name: Payments
  - name: Subscriptions
  - name: Tax Invoices
  - name: Webhooks
paths:
  /v1/discounts:
    post:
      tags:
        - Catalog
      summary: Create discount
      description: Creates a new reusable discount.
      operationId: discounts_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDiscountArgs'
      responses:
        '200':
          description: Discount created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDiscountPayload'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
components:
  schemas:
    CreateDiscountArgs:
      type: object
      properties:
        input:
          type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 140
              description: Display name of the discount.
              example: Buen Fin 20%
            description:
              type: string
              nullable: true
              description: Optional description.
              example: null
            codes:
              type: array
              items:
                type: string
                minLength: 1
                maxLength: 140
              description: >-
                Redeemable codes that grant this discount. Codes are uppercased
                automatically.
              example:
                - BUEN-FIN-2025
            type:
              type: string
              enum:
                - FIXED
                - PERCENTAGE
              description: >-
                Whether the discount is a fixed amount (FIXED) or a percentage
                (PERCENTAGE).
              example: PERCENTAGE
            amountOff:
              type: integer
              nullable: true
              minimum: 0
              maximum: 99999999999
              description: >-
                Fixed discount amount in minor currency units. Required when
                type is FIXED.
              example: null
            percentageOff:
              type: number
              nullable: true
              minimum: 0
              maximum: 100
              description: >-
                Percentage to discount (0-100). Required when type is
                PERCENTAGE.
              example: 20
            active:
              type: boolean
              description: Whether the discount is active.
              example: true
            oneOff:
              type: boolean
              description: Whether this discount is single-use.
              example: false
            expiresAt:
              type: string
              nullable: true
              format: date-time
              description: Optional expiration date.
              example: null
            maxApplications:
              type: integer
              nullable: true
              minimum: 1
              description: Maximum number of times this discount can be applied.
              example: null
          required:
            - name
            - type
          additionalProperties: false
      required:
        - input
      additionalProperties: false
      description: Request body for creating a discount.
    CreateDiscountPayload:
      type: object
      properties:
        discount:
          $ref: '#/components/schemas/Discount'
      required:
        - discount
      description: Newly created discount.
    UserError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - error
      additionalProperties: false
      description: Standard user-facing error response envelope.
    Discount:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the discount.
          example: disc_1234567890abcdefghij
        createdAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
          description: When the discount was created.
          example: '2025-01-01T00:00:00.000Z'
        updatedAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
          description: When the discount was last updated.
          example: '2025-01-01T00:00:00.000Z'
        deletedAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
            - nullable: true
          description: When the discount was deleted, if applicable.
          example: null
        name:
          type: string
          description: Display name of the discount.
          example: Buen Fin 20%
        description:
          type: string
          nullable: true
          description: Optional description of the discount.
          example: null
        organizationId:
          type: string
          description: Identifier of the owning organization.
          example: org_1234567890abcdefghij
        type:
          type: string
          enum:
            - FIXED
            - PERCENTAGE
          description: >-
            Whether the discount is a fixed amount (FIXED) or a percentage
            (PERCENTAGE).
          example: PERCENTAGE
        amountOff:
          type: integer
          nullable: true
          description: >-
            Fixed discount amount in minor currency units. Only set when type is
            FIXED.
          example: 30000
        percentageOff:
          type: number
          nullable: true
          description: Percentage to discount. Only set when type is PERCENTAGE.
          example: 20
        active:
          type: boolean
          description: Whether the discount is currently available for new applications.
          example: true
        oneOff:
          type: boolean
          description: Whether this discount was created for a single-use custom charge.
          example: false
        expiresAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
            - nullable: true
          description: Optional date after which the discount can no longer be applied.
          example: null
        maxApplications:
          type: integer
          nullable: true
          description: >-
            Maximum total number of times this discount can be applied across
            all customers.
          example: 3
      required:
        - id
        - createdAt
        - updatedAt
        - deletedAt
        - name
        - description
        - organizationId
        - type
        - amountOff
        - percentageOff
        - active
        - oneOff
        - expiresAt
        - maxApplications
      description: A reusable discount that can be applied to invoices or subscriptions.
  securitySchemes:
    organizationApiKey:
      type: http
      scheme: bearer
      description: 'Organization API key using `Authorization: Bearer sk_...`.'

````