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

# Update a discount

> Update an existing discount's details.
    
    You can modify the name, amount, expiration, and other properties. 
    Note: Changing the discount code may affect customers who have saved the old code.



## OpenAPI

````yaml /api-reference/api-docs.yaml patch /v0/discounts/{discountId}/update
openapi: 3.1.0
info:
  title: Fungies API v0
  version: 0.3.5
servers:
  - url: https://api.fungies.io
security: []
tags:
  - name: discounts
    description: Discounts related endpoints
  - name: keys
    description: Offer product keys related endpoints
  - name: orders
    description: Orders related endpoints
  - name: payments
    description: Payments related endpoints
  - name: offers
    description: Offers related endpoints
  - name: products
    description: Products related endpoints
  - name: subscriptions
    description: Subscriptions related endpoints
  - name: users
    description: Users related endpoints
  - name: variants
    description: Product variants related endpoints
  - name: plans
    description: Product plans related endpoints
  - name: elements
    description: Elements related endpoints
paths:
  /v0/discounts/{discountId}/update:
    patch:
      tags:
        - discounts
      summary: Update a discount
      description: |-
        Update an existing discount's details.
            
            You can modify the name, amount, expiration, and other properties. 
            Note: Changing the discount code may affect customers who have saved the old code.
      operationId: PatchV0DiscountsDiscountIdUpdate
      parameters:
        - name: discountId
          in: path
          required: true
          description: PATCH /v0/discounts/:discountId/update Parameter
          schema:
            $ref: >-
              #/components/schemas/PatchV0DiscountsDiscountIdUpdateParameterDiscountId
      requestBody:
        description: PATCH /v0/discounts/:discountId/update Request body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchV0DiscountsDiscountIdUpdateRequestBody'
      responses:
        '200':
          description: PATCH /v0/discounts/:discountId/update Positive response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchV0DiscountsDiscountIdUpdatePositiveResponse
        '400':
          description: PATCH /v0/discounts/:discountId/update Negative response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchV0DiscountsDiscountIdUpdateNegativeResponse
              examples:
                example1:
                  value:
                    status: error
                    error:
                      message: Sample error message
      security:
        - APIKEY_1: []
          APIKEY_2: []
components:
  schemas:
    PatchV0DiscountsDiscountIdUpdateParameterDiscountId:
      type: string
      format: uuid
    PatchV0DiscountsDiscountIdUpdateRequestBody:
      type: object
      properties:
        type:
          oneOf:
            - type: string
              const: code
            - type: string
              const: sale
        name:
          type: string
        amount:
          type: number
          format: double
          minimum: 1
          maximum: 1.7976931348623157e+308
        amountType:
          type: string
          enum:
            - fixed
            - percentage
        discountCode:
          type: string
        validFrom:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
          maximum: 9007199254740991
        validUntil:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
          maximum: 9007199254740991
        purchaseLimit:
          oneOf:
            - type: string
              minLength: 1
            - type: number
              format: double
              minimum: 1
              maximum: 1.7976931348623157e+308
        excludedOffers:
          type: array
          items:
            type: string
        includedOffers:
          type: array
          items:
            type: string
        currency:
          type: string
          enum:
            - AFN
            - ALL
            - DZD
            - AOA
            - ARS
            - AMD
            - AWG
            - AUD
            - AZN
            - BSD
            - BDT
            - BBD
            - BZD
            - BMD
            - BOB
            - BAM
            - BWP
            - BRL
            - BHD
            - GBP
            - BND
            - BGN
            - BIF
            - BYN
            - KHR
            - CAD
            - CVE
            - KYD
            - KWD
            - XAF
            - XPF
            - CLP
            - CNY
            - COP
            - KMF
            - CDF
            - CRC
            - HRK
            - CZK
            - DKK
            - DJF
            - DOP
            - XCD
            - EGP
            - ETB
            - EUR
            - FKP
            - FJD
            - GMD
            - GEL
            - GIP
            - GTQ
            - GNF
            - GYD
            - HTG
            - HNL
            - HKD
            - HUF
            - ISK
            - INR
            - IDR
            - ILS
            - JMD
            - JPY
            - JOD
            - KZT
            - KES
            - KGS
            - LAK
            - LBP
            - LSL
            - LRD
            - MOP
            - MKD
            - MGA
            - MWK
            - MYR
            - MVR
            - MRO
            - MUR
            - MXN
            - MDL
            - MNT
            - MAD
            - MZN
            - MMK
            - NAD
            - NPR
            - ANG
            - TWD
            - NZD
            - NIO
            - NGN
            - NOK
            - OMR
            - PKR
            - PAB
            - PGK
            - PYG
            - PEN
            - PHP
            - PLN
            - QAR
            - RON
            - RUB
            - RWF
            - SHP
            - SVC
            - WST
            - STD
            - SAR
            - RSD
            - SCR
            - SLL
            - SGD
            - SBD
            - SOS
            - ZAR
            - KRW
            - LKR
            - SRD
            - SZL
            - SEK
            - CHF
            - TJS
            - TZS
            - THB
            - TND
            - TOP
            - TTD
            - TRY
            - UGX
            - UAH
            - AED
            - UYU
            - USD
            - UZS
            - VUV
            - VEF
            - VND
            - XOF
            - YER
            - ZMW
            - SLE
            - XCG
            - SSP
            - VES
            - MRU
            - STN
            - VED
        status:
          type: string
          enum:
            - active
            - inactive
        includesAllOffers:
          type: boolean
        timezone:
          type: string
        id:
          type: string
          format: uuid
      required:
        - id
    PatchV0DiscountsDiscountIdUpdatePositiveResponse:
      type: object
      properties:
        status:
          type: string
          const: success
        data:
          type: object
          properties:
            discount:
              type: object
              properties:
                object:
                  type: string
                  enum:
                    - discount
                  default: discount
                id:
                  type: string
                  format: uuid
                type:
                  type: string
                  enum:
                    - code
                    - sale
                name:
                  type:
                    - string
                    - 'null'
                  default: null
                amount:
                  oneOf:
                    - type: string
                    - type: number
                      format: double
                      minimum: -1.7976931348623157e+308
                      maximum: 1.7976931348623157e+308
                amountType:
                  type: string
                  enum:
                    - fixed
                    - percentage
                discountCode:
                  type:
                    - string
                    - 'null'
                  default: null
                validFrom:
                  type:
                    - integer
                    - 'null'
                  format: int64
                  minimum: 0
                  maximum: 9007199254740991
                  default: null
                validUntil:
                  type:
                    - integer
                    - 'null'
                  format: int64
                  minimum: 0
                  maximum: 9007199254740991
                  default: null
                purchaseLimit:
                  type:
                    - integer
                    - 'null'
                  format: int64
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                  default: null
                timesUsed:
                  type: integer
                  format: int64
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                  default: 0
                status:
                  type: string
                  enum:
                    - active
                    - inactive
                includesAllOffers:
                  type: boolean
                  default: false
                excludedOffers:
                  type: array
                  items:
                    type: string
                currency:
                  type: string
                  enum:
                    - AFN
                    - ALL
                    - DZD
                    - AOA
                    - ARS
                    - AMD
                    - AWG
                    - AUD
                    - AZN
                    - BSD
                    - BDT
                    - BBD
                    - BZD
                    - BMD
                    - BOB
                    - BAM
                    - BWP
                    - BRL
                    - BHD
                    - GBP
                    - BND
                    - BGN
                    - BIF
                    - BYN
                    - KHR
                    - CAD
                    - CVE
                    - KYD
                    - KWD
                    - XAF
                    - XPF
                    - CLP
                    - CNY
                    - COP
                    - KMF
                    - CDF
                    - CRC
                    - HRK
                    - CZK
                    - DKK
                    - DJF
                    - DOP
                    - XCD
                    - EGP
                    - ETB
                    - EUR
                    - FKP
                    - FJD
                    - GMD
                    - GEL
                    - GIP
                    - GTQ
                    - GNF
                    - GYD
                    - HTG
                    - HNL
                    - HKD
                    - HUF
                    - ISK
                    - INR
                    - IDR
                    - ILS
                    - JMD
                    - JPY
                    - JOD
                    - KZT
                    - KES
                    - KGS
                    - LAK
                    - LBP
                    - LSL
                    - LRD
                    - MOP
                    - MKD
                    - MGA
                    - MWK
                    - MYR
                    - MVR
                    - MRO
                    - MUR
                    - MXN
                    - MDL
                    - MNT
                    - MAD
                    - MZN
                    - MMK
                    - NAD
                    - NPR
                    - ANG
                    - TWD
                    - NZD
                    - NIO
                    - NGN
                    - NOK
                    - OMR
                    - PKR
                    - PAB
                    - PGK
                    - PYG
                    - PEN
                    - PHP
                    - PLN
                    - QAR
                    - RON
                    - RUB
                    - RWF
                    - SHP
                    - SVC
                    - WST
                    - STD
                    - SAR
                    - RSD
                    - SCR
                    - SLL
                    - SGD
                    - SBD
                    - SOS
                    - ZAR
                    - KRW
                    - LKR
                    - SRD
                    - SZL
                    - SEK
                    - CHF
                    - TJS
                    - TZS
                    - THB
                    - TND
                    - TOP
                    - TTD
                    - TRY
                    - UGX
                    - UAH
                    - AED
                    - UYU
                    - USD
                    - UZS
                    - VUV
                    - VEF
                    - VND
                    - XOF
                    - YER
                    - ZMW
                    - SLE
                    - XCG
                    - SSP
                    - VES
                    - MRU
                    - STN
                    - VED
              required:
                - id
                - type
                - amount
                - amountType
                - status
                - excludedOffers
                - currency
          required:
            - discount
      required:
        - status
        - data
    PatchV0DiscountsDiscountIdUpdateNegativeResponse:
      type: object
      properties:
        status:
          type: string
          const: error
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - status
        - error
  securitySchemes:
    APIKEY_1:
      type: apiKey
      in: header
      name: x-fngs-public-key
    APIKEY_2:
      type: apiKey
      in: header
      name: x-fngs-secret-key

````