Coupons

Update a specific coupon

Update a specific coupon by ID.

put/coupons/{couponId}

Request

Path parameters

couponIdstring required
Example:61df12345678900009b7091c

A 24-character system-generated coupon ID, generated using the create coupon endpoint.

Headers

x-fabric-tenant-idstring required

A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.

x-fabric-channel-idstring
Example:12

x-fabric-channel-id identifies the sales channel where the API request is being made; primarily for multichannel use cases. The channel ids are 12 corresponding to US and 13 corresponding to Canada. The default channel id is 12. This field is required.

x-client-idstring

A unique identifier obtained from Copilot for the System app in the fabric ecosystem, essential for OpenID Connect authentication flows.

x-fabric-request-idstring
Example:263e731c-45c8-11ed-b878-0242ac120002

A unique request ID.

Request body

namestring required

Coupon name

startAtstring date-time required

The timestamp in UTC format indicating when the coupon becomes valid.

endAtstring date-time required

The timestamp in UTC format indicating when the coupon becomes invalid.

type'PRODUCT' | 'CART' | 'QUANTITY' | 'SHIPPING' | 'BUYGET' | 'SPEND_GET' required

The type of coupon promotion you want to create. The following are the coupon promotion types you can create:

  • PRODUCT: A SKU coupon promotion. Applies a discount to SKUs based on the value specified in the discount object of the request body.
  • CART: A cart coupon promotion. Applies a discount to the minimum order amount of the cart based on the ORDER_VALUE specified in the condition object of the request body.
  • QUANTITY: A quantity coupon promotion. Provides discounts on items based on the quantity requirement set in the promotion.
  • SHIPPING: A shipping coupon promotion. Provides discounts on the shipping cost.
  • BUYGET: A BuyGet coupon promotion. Specifies the Buy conditions and corresponding Get discounts.
  • SPEND_GET: A SpendGet coupon promotion. Specifies the total order value required to qualify for discounts and the applicable discounts based on the order value.
buyOperator'AND' | 'OR'

Operator for conditions array. It's applied when the coupon type is BUYGET. It's used as an operator between different condition objects mentioned in the conditions array.

isExclusiveboolean
  • true: Makes the coupon exclusive, meaning it can't be applied if another promotion is already applied.
  • false: Allows the coupon to be applied with other promotions.
couponCodesstring[] required

An array containing coupon codes.

shipmentMethodIdsstring[]

Required for Shipping type promotion to provide eligible shipment methods.

eligiblePriceListsinteger[]

Price list IDs to be considered for this promotion.

notestring

A brief note or description of the coupon.

levelinteger

The order in which the coupons must be executed.

stackingType'STACKABLE' | 'EXCLUSIVE' | 'TYPE_EXCLUSIVE' | 'UNIVERSAL'

Defines the rules for how a promotion can be combined with other promotions. This field determines whether a specific promotion can be applied in conjunction with other active promotions during a transaction or if it must be used exclusively. If configured, stackingType will have precedence over the isStackable and isAlwaysApplied Possible values: - STACKABLE: This promotion can be combined with other stackable promotions, allowing multiple discounts to be applied together. The order in which stackable promotions are applied is determined by the level field, with promotions having a higher priority (lower numeric value) being applied before those with a lower priority.

  • EXCLUSIVE: This promotion can't be combined with any other promotions. The level field is used to determine which exclusive promotion will be evaluated and applied first. Once an exclusive promotion is applied, no other promotions can be used in the same transaction.
  • TYPE_EXCLUSIVE: This promotion can't be combined with other promotions of the same type. The level field is used to determine which promotion within the same type will be evaluated and applied first.
  • UNIVERSAL: This promotion can be combined with any other promotions without restrictions. Universal promotions will be evaluated last.
isStackableboolean
  • true: Allows the coupon to be stacked so it can be applied with other coupons.
  • false: Disables coupon stacking.
isAlwaysAppliedboolean

Set true to always apply the coupon, even on non-stackable promotions, or false to apply coupon based on configured conditions.

singleMultiUse'SINGLE_USE' | 'MULTI_USE'

Determines whether the coupon is valid for single use or for multiple uses. The options are:

  • SINGLE_USE: The coupon can be used only once.
  • MULTI_USE: The coupon can be used multiple times.

Example request

{
  "name": "Christmas 2022 coupons",
  "startAt": "2022-08-24T14:15:22Z",
  "endAt": "2019-08-25T14:15:22Z",
  "type": "PRODUCT",
  "buyOperator": "OR",
  "isExclusive": true,
  "couponCodes": [
    "XMAS2022"
  ],
  "details": [
    {
      "discounts": [
        {
          "unit": "PERCENTAGE_OFF",
          "amount": 15,
          "type": "SKU",
          "values": "null",
          "maximumQuantity": 2,
          "includeOperator": "OR",
          "excludeOperator": "AND",
          "discountId": "1",
          "sets": [
            "A"
          ]
        }
      ],
      "targetProducts": [
        {
          "type": "SKU",
          "values": "*",
          "operator": "IN",
          "discountId": "1"
        }
      ],
      "conditions": [
        {
          "id": "634989a78cb443d74e4435d9",
          "operator": "AND",
          "includeOperator": "OR",
          "excludeOperator": "AND",
          "conditions": [
            {
              "type": "SKU",
              "values": "*",
              "operator": "IN"
            }
          ],
          "set": "A"
        }
      ]
    }
  ],
  "limits": [
    {
      "type": "SITE_WIDE",
      "quantity": 30
    }
  ],
  "termsAndConditions": [
    {
      "name": "Terms Applied",
      "description": "Items can't be exchanged"
    }
  ],
  "promotionMessages": [
    {
      "title": "Buy 2 get 1 free",
      "message": "Offer valid at participating stores through September 5, 2023.",
      "pages": [
        "PDP",
        "Cart"
      ],
      "locales": [
        "en-CA",
        "fr-CA"
      ]
    }
  ],
  "proximityMessages": {
    "threshold": 1,
    "localizedMessages": [
      {
        "locales": [
          "en-CA"
        ],
        "message": "Buy some more to get the discount!"
      }
    ]
  },
  "shipmentMethodIds": [
    "1000001"
  ],
  "eligiblePriceLists": [
    10000056
  ],
  "additionalAttributes": [
    {
      "name": "eventName",
      "values": "Store sale"
    }
  ],
  "note": "Independence day sale!",
  "level": 3,
  "stackingType": "STACKABLE",
  "singleMultiUse": "MULTI_USE"
}

Response

OK

idstring required

A 24-character system-generated coupon ID, generated using the create coupon endpoint.

namestring required

The name of the coupon.

status'ACTIVE' | 'SCHEDULED' | 'DISABLED' | 'EXPIRED' required

The status of the coupon.

startAtstring date-time required

The timestamp in UTC format indicating when the coupon becomes valid.

endAtstring date-time required

The timestamp in UTC format indicating when the coupon expires and is no longer valid.

type'PRODUCT' | 'CART' | 'QUANTITY' | 'SHIPPING' | 'BUYGET' | 'SPEND_GET' required

The type of coupon promotion you want to create. The following are the coupon promotion types you can create:

  • PRODUCT: A SKU coupon promotion. Applies a discount to SKUs based on the value specified in the discount object of the request body.
  • CART: A cart coupon promotion. Applies a discount to the minimum order amount of the cart based on the ORDER_VALUE specified in the condition object of the request body.
  • QUANTITY: A quantity coupon promotion. Provides discounts on items based on the quantity requirement set in the promotion.
  • SHIPPING: A shipping coupon promotion. Provides discounts on the shipping cost.
  • BUYGET: A BuyGet coupon promotion. Specifies the Buy conditions and corresponding Get discounts.
  • SPEND_GET: A SpendGet coupon promotion. Specifies the total order value required to qualify for discounts and the applicable discounts based on the order value.
couponCodesCountinteger

The total number of coupon codes.

createdAtstring date-time required

The timestamp in UTC format indicating when the coupon was created.

updatedAtstring date-time required

The timestamp in UTC format indicating when the coupon was last updated.

levelinteger

Coupon execution order

stackingType'STACKABLE' | 'EXCLUSIVE' | 'TYPE_EXCLUSIVE' | 'UNIVERSAL'

Defines the rules for how a promotion can be combined with other promotions. This field determines whether a specific promotion can be applied in conjunction with other active promotions during a transaction or if it must be used exclusively. If configured, stackingType will have precedence over the isStackable and isAlwaysApplied Possible values: - STACKABLE: This promotion can be combined with other stackable promotions, allowing multiple discounts to be applied together. The order in which stackable promotions are applied is determined by the level field, with promotions having a higher priority (lower numeric value) being applied before those with a lower priority.

  • EXCLUSIVE: This promotion can't be combined with any other promotions. The level field is used to determine which exclusive promotion will be evaluated and applied first. Once an exclusive promotion is applied, no other promotions can be used in the same transaction.
  • TYPE_EXCLUSIVE: This promotion can't be combined with other promotions of the same type. The level field is used to determine which promotion within the same type will be evaluated and applied first.
  • UNIVERSAL: This promotion can be combined with any other promotions without restrictions. Universal promotions will be evaluated last.
isStackableboolean
  • true: Allows the coupon to be stacked so it can be applied with other coupons.
  • false: Disables coupon stacking.
isAlwaysAppliedboolean

Set true to always apply the promotion, even on non-stackable promotions, or false to apply promotion based on configured conditions.

singleMultiUse'MULTI_USE' | 'SINGLE_USE'

Determines whether the coupon is valid for single use or for multiple uses. The options are:

  • SINGLE_USE: The coupon can be used only once.
  • MULTI_USE: The coupon can be used multiple times.
couponCodesstring[]

An array containing available coupon codes.

Example response

{
  "id": "6380e7ecb419a30009865fad",
  "name": "Christmas 2022 coupons",
  "status": "SCHEDULED",
  "startAt": "2022-08-24T14:15:22Z",
  "endAt": "2019-08-25T14:15:22Z",
  "type": "PRODUCT",
  "couponCodesCount": 100,
  "createdAt": "2019-08-20T14:15:22Z",
  "updatedAt": "2019-08-20T14:15:22Z",
  "level": 3,
  "stackingType": "STACKABLE",
  "singleMultiUse": "MULTI_USE",
  "couponCodes": [
    "SUMMER1000001"
  ],
  "promotionMessages": [
    {
      "title": "Buy 2 get 1 free",
      "message": "Offer valid at participating stores through September 5, 2023.",
      "pages": [
        "PDP",
        "Cart"
      ],
      "locales": [
        "en-CA",
        "fr-CA"
      ]
    }
  ],
  "additionalAttributes": [
    {
      "name": "type",
      "values": "Birthday",
      "attributeId": 100000
    }
  ]
}

Changes

No recorded changes to this operation across all 2 revisions of this API.