---
title: "Create Stacking Rules"
method: POST
path: "/management/v1/projects/{projectId}/stacking-rules"
tags: ["Management"]
---

# Create Stacking Rules

`POST /management/v1/projects/{projectId}/stacking-rules`

Overwrites the default stacking rules.

If new stacking rules have been created for the project earlier (e.g. in the user interface), it returns an error. Use [Update stacking rules](/api-reference/management/update-stacking-rules) endpoint to change the rules.

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

## Request body

- ManagementProjectsStackingRulesCreateRequestBody — Object representing basic stacking rule parameters.
  - `exclusive_categories` string[] — 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.
  - `joint_categories` string[] — Lists the IDs of the joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns.
  - `redeemables_limit` integer — Defines how many redeemables can be sent in one request. Note: more redeemables means more processing time.
  - `applicable_redeemables_limit` integer — 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`.
  - `applicable_redeemables_per_category_limit` integer, nullable — 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`.
  - `applicable_redeemables_category_limits` object — Lists categories by category IDs (keys) and defines their limits (values) of applicable redeemables that belong to campaigns with that category.
  - `applicable_exclusive_redeemables_limit` integer — 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`.
  - `applicable_exclusive_redeemables_per_category_limit` integer, nullable — 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`.
  - `discount_calculation_mode` 'INITIAL_AMOUNT' | 'DISCOUNTED_AMOUNT' — Defines if the discounts are applied by taking into account the initial order amount or the discounted order amount.
  - `initial_amount_mode_categories` string[] — Lists the IDs of the categories that apply a discount based on the initial amount.
  - `discounted_amount_mode_categories` string[] — Lists the IDs of the categories that apply a discount based on the discounted amount.
  - `redeemables_application_mode` 'ALL' | 'PARTIAL' — 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.
  - `redeemables_sorting_rule` 'CATEGORY_HIERARCHY' | 'REQUESTED_ORDER' — 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.
  - `redeemables_products_application_mode` 'STACK' | 'ONCE' — 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.
  - `redeemables_no_effect_rule` 'REDEEM_ANYWAY' | 'SKIP' — 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.
  - `no_effect_skip_categories` string[] — 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`.
  - `no_effect_redeem_anyway_categories` string[] — 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`.
  - `redeemables_rollback_order_mode` 'WITH_ORDER' | 'WITHOUT_ORDER' — 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.

## Response `200`

Returns the details about the stacking rules assigned to the project.

- ManagementProjectsStackingRulesCreateResponseBody — Object representing basic stacking rule parameters.
  - `id` string — The unique identifier of the stacking rules.
  - `exclusive_categories` string[], required — 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.
  - `joint_categories` string[], required — Lists the IDs of the joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns.
  - `redeemables_limit` integer, required — Defines how many redeemables can be sent in one request. Note: more redeemables means more processing time.
  - `applicable_redeemables_limit` integer, required — 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`.
  - `applicable_redeemables_per_category_limit` integer, nullable, required — 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`.
  - `applicable_redeemables_category_limits` object, required — Lists categories by category IDs (keys) and defines their limits (values) of applicable redeemables that belong to campaigns with that category.
  - `applicable_exclusive_redeemables_limit` integer, required — 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`.
  - `applicable_exclusive_redeemables_per_category_limit` integer, nullable, required — 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`.
  - `discount_calculation_mode` 'INITIAL_AMOUNT' | 'DISCOUNTED_AMOUNT', required — Defines if the discounts are applied by taking into account the initial order amount or the discounted order amount.
  - `initial_amount_mode_categories` string[], required — Lists the IDs of the categories that apply a discount based on the initial amount.
  - `discounted_amount_mode_categories` string[], required — Lists the IDs of the categories that apply a discount based on the discounted amount.
  - `redeemables_application_mode` 'ALL' | 'PARTIAL', required — 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.
  - `redeemables_sorting_rule` 'CATEGORY_HIERARCHY' | 'REQUESTED_ORDER', required — 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.
  - `redeemables_products_application_mode` 'STACK' | 'ONCE', required — 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.
  - `redeemables_no_effect_rule` 'REDEEM_ANYWAY' | 'SKIP', required — 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.
  - `no_effect_skip_categories` string[], required — 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`.
  - `no_effect_redeem_anyway_categories` string[], required — 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`.
  - `redeemables_rollback_order_mode` 'WITH_ORDER' | 'WITHOUT_ORDER', required — 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.
  - `created_at` string, date-time — Timestamp representing the date and time when the stacking rules were created. The value for this parameter is shown in the ISO 8601 format.
  - `updated_at` string, date-time — Timestamp representing the date and time when the stacking rules were updated. The value for this parameter is shown in the ISO 8601 format.

## Other responses

- `400` — Returns an error if the payload has incorrect values, e.g. integer limits.
- `401` — Returns an error if an invalid token was provided.
- `402` — Returns an error if the current plan does not include the Management API feature.
- `404` — Returns an error when a resource could not be found.
- `409` — Returns an error if the stacking rules have been already created for the project.

---

[API](https://skmtc.net/voucherifyio/apis/voucherify-api-async-actions.md) · [All operations](https://skmtc.net/voucherifyio/apis/voucherify-api-async-actions/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/voucherifyio/voucherify-api-async-actions/revisions/4982266e0494/schema)
