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

# Update a discount

> Update a discount. Only supplied fields change; the code never does. Once redeemed, its amount, type, currency and duration are fixed. A discount with a Stripe coupon also keeps its expiry, redemption limit and products; a name change renames the coupon.



## OpenAPI

````yaml patch /v1/discounts/{id}
openapi: 3.0.0
info:
  title: Creem API
  description: >-
    Creem is an all-in-one platform for managing subscriptions and recurring
    revenue, tailored specifically for today's SaaS companies. It enables you to
    boost revenue, enhance customer retention, and scale your operations
    seamlessly.
  version: v1
  contact:
    name: Creem Support
    url: https://creem.io
    email: support@creem.io
  license:
    name: Commercial
    url: https://creem.io/terms
  termsOfService: https://creem.io/terms
servers:
  - url: https://api.creem.io
    description: Production — live API for processing real transactions and data.
    x-speakeasy-server-id: prod
  - url: https://test-api.creem.io
    description: Test — sandbox API for development and testing with no real charges.
    x-speakeasy-server-id: test
security: []
tags: []
externalDocs:
  description: Creem Documentation
  url: https://docs.creem.io
paths:
  /v1/discounts/{id}:
    patch:
      tags:
        - Discounts
      summary: Update a discount.
      description: >-
        Update a discount. Only supplied fields change; the code never does.
        Once redeemed, its amount, type, currency and duration are fixed. A
        discount with a Stripe coupon also keeps its expiry, redemption limit
        and products; a name change renames the coupon.
      operationId: updateDiscount
      parameters:
        - name: id
          required: true
          in: path
          description: The discount ID
          schema:
            type: string
      requestBody:
        required: true
        description: Discount update payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDiscountRequestEntity'
      responses:
        '200':
          description: Successfully updated the discount
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountEntity'
        '400':
          description: Bad Request - Invalid input parameters
        '401':
          description: Unauthorized - Invalid or missing API key
        '404':
          description: Not Found - Resource does not exist
        '409':
          description: >-
            Conflict. `discount_redeemed`: the discount has been redeemed, or a
            checkout using it was confirmed in the last 7 days, so its amount,
            type, currency and duration are fixed; create a new discount
            instead. `discount_managed_by_stripe`: the discount has a Stripe
            coupon, which keeps its amount, type, currency, duration, expiry,
            redemption limit and products; create a new discount instead.
            `max_redemptions_below_redeemed`: the limit is below the redemptions
            so far. `external_id_taken`: another discount of the store uses this
            `external_id`. Nothing is changed.
      security:
        - ApiKey: []
components:
  schemas:
    UpdateDiscountRequestEntity:
      type: object
      properties:
        name:
          type: string
          description: The name of the discount.
          example: Summer Sale
          maxLength: 40
        type:
          $ref: '#/components/schemas/DiscountType'
        amount:
          type: integer
          description: >-
            The amount of a fixed discount, in minor units (cents) as a whole
            number. Fixed once the discount has been redeemed.
          example: 2000
          minimum: 2
        percentage:
          type: number
          description: >-
            The percentage, for a percentage discount. Fixed once the discount
            has been redeemed.
          example: 15
          minimum: 1
          maximum: 100
        currency:
          type: string
          description: >-
            The currency of a fixed discount. Fixed once the discount has been
            redeemed.
          example: USD
        expiry_date:
          format: date-time
          type: string
          description: >-
            The expiry date of the discount, in the future. `null` removes the
            expiry.
          example: '2026-12-31T23:59:59Z'
          nullable: true
        max_redemptions:
          type: integer
          description: >-
            The maximum number of redemptions. `null` removes the limit. Below
            the redemptions so far answers `409`
            `max_redemptions_below_redeemed`.
          example: 100
          nullable: true
          minimum: 1
          maximum: 2147483647
        duration:
          $ref: '#/components/schemas/CouponDurationType'
        duration_in_months:
          type: integer
          description: >-
            The number of months for a repeating discount. Fixed once the
            discount has been redeemed. A discount that is repeating after the
            update needs it: `null` there, or `duration: repeating` without
            months on a discount that has none, answers `400`
            `invalid_duration_in_months`.
          example: 6
          nullable: true
          minimum: 1
          maximum: 1200
        applies_to_products:
          description: >-
            Product IDs. When this list or `applies_to_product_external_ids` is
            sent, their union replaces the whole product set; when neither is
            sent, the set stays as it is.
          example:
            - prod_123
          type: array
          items:
            type: string
        applies_to_product_external_ids:
          description: >-
            Products named by their `external_id`, at most 100, combined with
            `applies_to_products`. A key no product of your store has answers
            `400` `reference_not_found`.
          example:
            - pro-monthly
          maxItems: 100
          type: array
          items:
            type: string
        external_id:
          type: string
          description: >-
            Your own key for the discount, unique in your store: 1 to 255
            characters: letters, digits, `_`, `-`, `.` and `:`. `null` removes
            it. A key another discount uses answers `409` `external_id_taken`.
          example: spring-2026
          nullable: true
    DiscountEntity:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object.
        mode:
          $ref: '#/components/schemas/EnvironmentMode'
        object:
          type: string
          description: >-
            A string representing the object’s type. Objects of the same type
            share the same value.
          example: discount
        status:
          type: string
          description: The status of the discount (e.g., active, inactive).
          enum:
            - deleted
            - active
            - draft
            - expired
            - scheduled
          example: active
        name:
          type: string
          description: The name of the discount.
          example: Holiday Sale
        code:
          type: string
          description: The discount code. A unique identifier for the discount.
          example: HOLIDAY2024
        type:
          type: string
          description: The type of the discount, either "percentage" or "fixed".
          enum:
            - percentage
            - fixed
          example: percentage
        amount:
          type: number
          description: The amount of the discount. Can be a percentage or a fixed amount.
          example: 20
        currency:
          type: string
          description: The currency of the discount. Only required if type is "fixed".
          example: USD
        percentage:
          type: number
          description: >-
            The percentage of the discount. Only applicable if type is
            "percentage".
          example: 15
        expiry_date:
          format: date-time
          type: string
          description: The expiry date of the discount.
          example: '2024-12-31T23:59:59Z'
        max_redemptions:
          type: number
          description: The maximum number of redemptions allowed for the discount.
          example: 100
        duration:
          type: string
          description: The duration type for the discount.
          enum:
            - forever
            - once
            - repeating
          example: repeating
        duration_in_months:
          type: number
          description: >-
            The number of months the discount is valid for. Only applicable if
            the duration is "repeating" and the product is a subscription.
          example: 6
        applies_to_products:
          description: The list of product IDs to which this discount applies.
          example:
            - prod_123
            - prod_456
          type: array
          items:
            type: string
        redeem_count:
          type: number
          description: The number of times this discount has been redeemed.
          example: 15
        external_id:
          type: string
          description: >-
            Your own key for the discount, unique in your store. `null` when the
            discount has none.
          example: spring-2026
          nullable: true
      required:
        - id
        - mode
        - object
        - status
        - name
        - code
        - type
        - external_id
    DiscountType:
      type: string
      description: >-
        The type of the discount. Fixed once the discount has been redeemed, or
        while a checkout confirmed with it in the last 7 days holds it (`409`
        `discount_redeemed`); the same applies to `amount`, `percentage`,
        `currency`, `duration` and `duration_in_months`. Changing it needs the
        new `amount` or `percentage`.
      enum:
        - percentage
        - fixed
    CouponDurationType:
      type: string
      description: The duration type. Fixed once the discount has been redeemed.
      enum:
        - forever
        - once
        - repeating
    EnvironmentMode:
      type: string
      description: String representing the environment.
      enum:
        - test
        - prod
        - sandbox
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. You can find your API key in the Creem
        dashboard under Settings > API Keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.