Skip to main content

Rules API Reference

Full reference for the rule object and its fields. Use the Examples article to see complete JSON payloads for common scenarios.

Type

The first step in creating a rule is to choose the correct type. The table below lists all possible types with example scenarios.

Rule applies toActionRule TypeDescription
productdisabledisableProductUsed to control time-based offers, such as a lunch offer only available between 11:00–14:00. Can also limit pickup options, e.g. disabling curbside orders after 18:00.
productenableenableProductUsed to enable normally disabled products.
productupsellupsellProductUsed to trigger the upsell screen based on a list of products.
productstockoutstockoutProductUsed when stores can no longer produce a certain product.
categorydisabledisableCategoryUsed to disable a whole category, e.g. breakfast might only be served at certain stores and disabled for the rest.
categoryenableenableCategoryUsed to enable normally disabled categories.
categoryupsellupsellCategoryUsed to trigger the upsell screen when a product from one of the listed categories is added to the basket.
product/categoryupsellupsellReplacementOfferUsed to perform plus-menu upsells and to offer replacement products when the chosen product is no longer available. See Replacement offer below.
storedisabledisableStoreUsed to close a store that has problems, or to close all or specific stores over a holiday.
storeenableenableStoreUsed to enable a store once it has been fully configured.

For stockout-specific operational requirements, see Stockout.

Fields

comment

Write a short explanation of what the rule is supposed to do, for example:

"activate breakfast category at 07:00 for all stores, during the weekend"

A good comment provides context that is useful long after the rule was created. In the example above it is clear that:

  • The rule targets a breakfast category
  • It applies to all stores
  • It is active from 07:00 on weekends

recommendations

Used for upsell rule types (upsellProduct, upsellCategory, upsellReplacementOffer). Fields:

FieldDescription
triggerEventWhen the upsell is triggered. productAdd triggers when a product is added to the basket; checkout triggers when the guest presses the checkout button.
shownOnPageControls the order when multiple upsell steps are configured for the same trigger. Lower numbers appear first.
ifInBasketWhether the upsell is shown if the recommended product is already in the basket.
productIdsArray of product IDs to recommend. Used for upsellProduct.
categoryIdsArray of category IDs to recommend. Used for upsellCategory.

Replacement offer

When creating a upsellReplacementOffer, do not use productIds or categoryIds. Instead, provide a replacementOffer object with the following properties (all arrays):

PropertyDescription
source1Product IDs that trigger the replacement offer (first pairing). E.g. a small beverage.
source2Product IDs that trigger the replacement offer (second pairing). E.g. small fries. Optional if only one pair is needed.
destination1Product IDs to offer instead of source1. E.g. a medium beverage.
destination2Product IDs to offer instead of source2. E.g. medium fries. Optional if only one pair is needed.

Example: to offer vegan protein as a meal replacement, use only one source/destination pair.

filter

The filter object defines more granular triggering criteria — for example, a rule that only applies to specific stores, certain days of the week, or particular order types.

Every property inside filter shares the same structure:

{
"appliesTo": "all" | "specific" | "allExceptSpecific",
"values": [ ... ] // required when appliesTo is "specific" or "allExceptSpecific"
}
appliesTo valueBehaviour
allThe filter condition matches everything; values is not used.
specificOnly the items listed in values are matched.
allExceptSpecificEverything except the items listed in values is matched.

Available filter properties:

Filter propertyValue typeData type
productsProduct IDsint
categoriesCategory IDsint
storesStore IDsstring
storeCountryIsoCodesISO 3166 Alpha-2 country codesstring
orderClassesNotSet, TakeAway, Delivery, EatIn, DriveThrough, KioskTakeAway, KioskEatInstring
daysOfWeekmonday, tuesday, wednesday, thursday, friday, saturday, sundaystring

activeDuring

Controls when the rule is active.

  • timeOfDay — set applies to always, or to between and provide startTime and endTime in hh:mm:ss format.
  • dates — set applies to always, or to between and provide startDate and endDate as RFC 3339 date-time strings (e.g. 2022-05-13T06:00:00Z).

executionIndex

Sets the priority order in which rules are evaluated. A lower index is evaluated first. The last rule evaluated for a given product, category, or store wins.

Example: if index 1 says "show cola" and index 42 says "hide cola", the cola will be hidden because index 42 is evaluated last.