> ## 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.

# Update discount

> Updates editable fields of an existing discount by id.



## OpenAPI

````yaml /openapi.yaml patch /v1/discounts/{id}
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/{id}:
    patch:
      tags:
        - Catalog
      summary: Update discount
      description: Updates editable fields of an existing discount by id.
      operationId: discounts_update
      parameters:
        - schema:
            type: string
            description: Identifier of the discount.
          required: true
          description: Identifier of the discount.
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDiscountArgs'
      responses:
        '200':
          description: Discount updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateDiscountPayload'
        '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'
        '404':
          description: Discount not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
components:
  schemas:
    UpdateDiscountArgs:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Display name of the discount.
          example: Buen Fin 25%
        description:
          type: string
          nullable: true
          description: Optional description.
          example: null
        codes:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 140
          description: >-
            Replaces all existing codes with this list. 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: 25
        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
      additionalProperties: false
      description: Request body for updating a discount. All fields are optional.
    UpdateDiscountPayload:
      type: object
      properties:
        discount:
          $ref: '#/components/schemas/Discount'
      required:
        - discount
      description: Updated 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_...`.'

````