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

# Update Stacking Rules

> Updates the stacking rules.

Only the provided fields will be updated. However, if you update an array, the content of the array is overwritten. This means that if you want to add new values to an array and retain existing ones, you need to provide both the existing and new values in the request.

> 📘 Stacking Rules Documentation
>
> Read [the Stacking Rules article]/orchestrate/stacking-rules to learn how they work.



## OpenAPI

````yaml /openapi/management.json put /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId}
openapi: 3.0.1
info:
  title: Voucherify API - Management
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId}:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterProjectId'
        in: path
        name: projectId
        description: Provide the unique identifier of the project.
        required: true
      - schema:
          $ref: '#/components/schemas/ParameterStackingRulesId'
        in: path
        name: stackingRulesId
        description: Provide the unique identifier of the stacking rules.
        required: true
    put:
      tags:
        - Management
      summary: Update Stacking Rules
      description: >-
        Updates the stacking rules.


        Only the provided fields will be updated. However, if you update an
        array, the content of the array is overwritten. This means that if you
        want to add new values to an array and retain existing ones, you need to
        provide both the existing and new values in the request.


        > 📘 Stacking Rules Documentation

        >

        > Read [the Stacking Rules article]/orchestrate/stacking-rules to learn
        how they work.
      operationId: update-stacking-rules
      parameters: []
      requestBody:
        description: Defines the stacking rules to be updated.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/ManagementProjectsStackingRulesUpdateRequestBody
        required: true
      responses:
        '200':
          description: Returns the details about the updated stacking rules.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ManagementProjectsStackingRulesUpdateResponseBody
              examples:
                Example:
                  value:
                    id: stk_0e9bdfd48108548fd3
                    exclusive_categories:
                      - cat_0f2ba1284b565c235c
                      - cat_0d75bdfe4c9030a732
                    joint_categories:
                      - cat_0d74559c3e9030da13
                      - cat_0d507a4d6e8a1b7b97
                    redeemables_limit: 25
                    applicable_redeemables_limit: 10
                    applicable_redeemables_per_category_limit: 2
                    applicable_redeemables_category_limits:
                      cat_0d75bdfe4c9030a732: 1
                      cat_0d7c4d183011d043cc: 2
                    applicable_exclusive_redeemables_limit: 2
                    applicable_exclusive_redeemables_per_category_limit: 2
                    discount_calculation_mode: DISCOUNTED_AMOUNT
                    initial_amount_mode_categories:
                      - cat_0d507a4d6e8a1b7b97
                    discounted_amount_mode_categories:
                      - cat_0d7455f93c1030da4a
                    redeemables_application_mode: PARTIAL
                    redeemables_sorting_rule: CATEGORY_HIERARCHY
                    redeemables_no_effect_rule: REDEEM_ANYWAY
                    no_effect_skip_categories: []
                    no_effect_redeem_anyway_categories: []
                    redeemables_products_application_mode: ONCE
                    redeemables_rollback_order_mode: WITH_ORDER
                    grouped_redeemables_sorting_rule: JOINT_ALWAYS_LAST
                    created_at: '2024-04-16T20:18:38.213Z'
                    updated_at: '2025-08-28T08:28:53.038Z'
        '400':
          description: Returns an error if the payload includes incorrect details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/e_400_invalid_payload'
              examples:
                Invalid payload:
                  value:
                    code: 400
                    key: invalid_payload
                    message: Invalid payload
                    details: Property .redeemables_limit must be <= 30
                    request_id: v-0e9bd9f0628228aa93
        '401':
          description: Returns an error if an invalid token was provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Unauthorized:
                  value:
                    code: 401
                    message: Unauthorized
                    key: unauthorized
        '402':
          description: >-
            Returns an error if the current plan does not include the Management
            API feature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorPaymentRequired'
              examples:
                Example:
                  value:
                    code: 402
                    message: Payment required
                    details: >-
                      Your current plan does not include a feature required to
                      perform this operation.
                    key: missing_required_feature
        '404':
          description: Returns an error when a resource could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Not Found:
                  value:
                    code: 404
                    key: not_found
                    message: Resource not found
                    details: Cannot find stacking_rules with id stk_0d626410861700614
                    request_id: v-0e9bd9b3cd4228aa3e
                    resource_id: stk_0d626410861700614
                    resource_type: stacking_rules
      security:
        - X-Management-Id: []
          X-Management-Token: []
components:
  schemas:
    ParameterProjectId:
      type: string
      example: proj_TrlkLiH4
    ParameterStackingRulesId:
      type: string
      example: stk_0d6264108617006147
    ManagementProjectsStackingRulesUpdateRequestBody:
      type: object
      description: >-
        Request body schema for **PUT**
        `/management/v1/projects/{projectId}/stacking-rules/{stackingRulesId}`.
      allOf:
        - $ref: '#/components/schemas/ManagementProjectsStackingRulesBase'
    ManagementProjectsStackingRulesUpdateResponseBody:
      type: object
      description: >-
        Response body schema for **PUT**
        `/management/v1/projects/{projectId}/stacking-rules/{stackingRulesId}`.
      allOf:
        - $ref: '#/components/schemas/ManagementProjectsStackingRules'
      required:
        - id
        - created_at
        - updated_at
    e_400_invalid_payload:
      title: Invalid Payload
      type: object
      description: 'Error: Bad Request &rarr; Invalid Payload'
      properties:
        code:
          type: integer
          default: 400
          description: Error's HTTP status code.
        key:
          type: string
          default: invalid_payload
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          default: Invalid payload
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a884c6be8c3756f42
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
    Error:
      title: Error Object
      type: object
      description: Error details
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a885062c80375740f
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
        resource_id:
          type: string
          description: >-
            Unique resource ID that can be used in another endpoint to get more
            details.
          example: rf_0c5d710a87c8a31f86
        resource_type:
          type: string
          description: The resource type.
          example: voucher
        error:
          type: object
          description: Includes additional information about the error.
          properties:
            message:
              type: string
              description: The message configured by the user in a validation rule.
      required:
        - code
        - message
    ErrorPaymentRequired:
      title: Payment Required Error
      type: object
      description: 'Error: Payment required - the current plan does not include the feature.'
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
      required:
        - code
        - message
        - details
        - key
    ManagementProjectsStackingRulesBase:
      type: object
      description: Object representing basic stacking rule parameters.
      properties:
        exclusive_categories:
          type: array
          description: >-
            Lists the IDs of exclusive categories. A redeemable from a campaign
            with an exclusive category is the only redeemable to be redeemed
            when applied with redeemables from other campaigns unless these
            campaigns are exclusive or joint.
          items:
            type: string
        joint_categories:
          type: array
          description: >-
            Lists the IDs of the joint categories. A campaign with a joint
            category is always applied regardless of the exclusivity of other
            campaigns.
          items:
            type: string
        redeemables_limit:
          type: integer
          description: >-
            Defines how many redeemables can be sent in one request. Note: more
            redeemables means more processing time.
          minimum: 1
          maximum: 30
        applicable_redeemables_limit:
          type: integer
          description: >-
            Defines how many redeemables can be applied in one request. The
            number must be less than or equal to `redeemables_limit`. For
            example, a user can select 30 discounts but only 5 will be applied
            to the order and the remaining will be `SKIPPED` according to the
            `redeemables_sorting_rule`.
          minimum: 1
          maximum: 30
        applicable_redeemables_per_category_limit:
          type: integer
          nullable: true
          description: >-
            Defines how many redeemables with the same category can be applied
            in one request. The number must be less than or equal to
            `applicable_redeemables_limit`. The ones above the limit will be
            `SKIPPED` according to the `redeemables_sorting_rule`.
          minimum: 1
          maximum: 30
        applicable_redeemables_category_limits:
          type: object
          description: >-
            Lists categories by category IDs (keys) and defines their limits
            (values) of applicable redeemables that belong to campaigns with
            that category.
          additionalProperties:
            type: integer
            description: Limit of applicable redeemables per category.
            minimum: 1
            maximum: 10
        applicable_exclusive_redeemables_limit:
          type: integer
          description: >-
            Defines how many redeemables with an assigned exclusive category can
            be applied in one request. The ones above the limit will be
            `SKIPPED` according to the `redeemables_sorting_rule`.
          minimum: 1
          maximum: 5
        applicable_exclusive_redeemables_per_category_limit:
          type: integer
          nullable: true
          description: >-
            Defines how many redeemables with an assigned exclusive category can
            be applied in one request. The ones above the limit will be
            `SKIPPED` according to the `redeemables_sorting_rule`. The number
            must be less than or equal to
            `applicable_exclusive_redeemables_limit`.
          minimum: 1
          maximum: 30
        discount_calculation_mode:
          type: string
          description: >-
            Defines if the discounts are applied by taking into account the
            initial order amount or the discounted order amount.
          enum:
            - INITIAL_AMOUNT
            - DISCOUNTED_AMOUNT
        initial_amount_mode_categories:
          type: array
          description: >-
            Lists the IDs of the categories that apply a discount based on the
            initial amount.
          items:
            type: string
        discounted_amount_mode_categories:
          type: array
          description: >-
            Lists the IDs of the categories that apply a discount based on the
            discounted amount.
          items:
            type: string
        redeemables_application_mode:
          type: string
          description: >-
            Defines the application mode for redeemables.

            `"ALL"` means that all redeemables must be validated for the
            redemption to be successful.

            `"PARTIAL"` means that only those redeemables that can be validated
            will be redeemed. The redeemables that fail validaton will be
            skipped.
          enum:
            - ALL
            - PARTIAL
        redeemables_sorting_rule:
          type: string
          description: >-
            Defines redeemables sorting rule. `CATEGORY_HIERARCHY` means that
            redeemables are applied oaccording to the category priority.
            `REQUESTED_ORDER` means that redeemables are applied in the sequence
            provided in the request.
          enum:
            - CATEGORY_HIERARCHY
            - REQUESTED_ORDER
        redeemables_products_application_mode:
          type: string
          description: >-
            Defines redeemables products application mode. `STACK` means that
            multiple discounts can be applied to a product. `ONCE` means that
            only one discount can be applied to the same product.
          enum:
            - STACK
            - ONCE
        redeemables_no_effect_rule:
          type: string
          description: >-
            Defines redeemables no effect rule. `REDEEM_ANYWAY` means that the
            redeemable will be redeemed regardless of any restrictions or
            conditions in place. `SKIP` means that the redeemable will be
            processed only when an applicable effect is calculated.
          enum:
            - REDEEM_ANYWAY
            - SKIP
        no_effect_skip_categories:
          type: array
          description: >-
            Lists category IDs. Redeemables with a given category are skipped
            even if the `redeemables_no_effect_rule` is set to `REDEEM_ANYWAY`.
            Category IDs can't overlap with the IDs in
            `no_effect_redeem_anyway_categories`.
          items:
            type: string
        no_effect_redeem_anyway_categories:
          type: array
          description: >-
            Lists category IDs. Redeemables with a given category are redeemed
            anyway even if the `redeemables_no_effect_rule` is set to `SKIP`.
            Category IDs can't overlap with the IDs in
            `no_effect_skip_categories`.
          items:
            type: string
        redeemables_rollback_order_mode:
          type: string
          description: >-
            Defines the rollback mode for the order. `WITH_ORDER` is a default
            setting. The redemption is rolled back together with the data about
            the order, including related discount values. `WITHOUT_ORDER` allows
            rolling the redemption back without affecting order data, including
            the applied discount values.
          enum:
            - WITH_ORDER
            - WITHOUT_ORDER
    ManagementProjectsStackingRules:
      type: object
      description: Object representing the details of the stacking rules.
      allOf:
        - type: object
          properties:
            id:
              type: string
              description: The unique identifier of the stacking rules.
        - $ref: '#/components/schemas/ManagementProjectsStackingRulesBase'
        - type: object
          properties:
            created_at:
              type: string
              description: >-
                Timestamp representing the date and time when the stacking rules
                were created. The value for this parameter is shown in the ISO
                8601 format.
              format: date-time
              example: '2024-01-02T08:31:46.562Z'
            updated_at:
              type: string
              description: >-
                Timestamp representing the date and time when the stacking rules
                were updated. The value for this parameter is shown in the ISO
                8601 format.
              format: date-time
      required:
        - exclusive_categories
        - joint_categories
        - redeemables_limit
        - applicable_redeemables_limit
        - applicable_redeemables_per_category_limit
        - applicable_redeemables_category_limits
        - applicable_exclusive_redeemables_limit
        - applicable_exclusive_redeemables_per_category_limit
        - discount_calculation_mode
        - initial_amount_mode_categories
        - discounted_amount_mode_categories
        - redeemables_application_mode
        - redeemables_sorting_rule
        - redeemables_products_application_mode
        - redeemables_no_effect_rule
        - no_effect_skip_categories
        - no_effect_redeem_anyway_categories
        - redeemables_rollback_order_mode
  securitySchemes:
    X-Management-Id:
      type: apiKey
      name: X-Management-Id
      in: header
    X-Management-Token:
      type: apiKey
      name: X-Management-Token
      in: header

````