Skip to content

Public API v2: Rules & publishing

  1. Write. POST, PUT, PATCH, DELETE and bulk requests save to the app. You see the result in the app at once.
  2. Publish. POST /api/v2/<module>/rules/upload sends every enabled rule of the module to the storefront, as the Upload button of the app does. Disabled rules are not sent.
  3. Live. Shoppers see the rules after the upload.

Two modules differ: Auto Tag rules apply as soon as they are saved and have no upload; Discount Code codes work at checkout as soon as they are saved, and the upload only refreshes the code box and share page. See Upload.

  • A rule applies to a shopper and a product when its customer, product, market and schedule conditions all match.
  • When several rules of a module match, the one with the lowest priority applies (0 is the highest priority). If the priorities are equal, the oldest rule applies.
  • Priority only ranks rules within one module. Rules of different modules work side by side.
  • A disabled rule never applies; use it to prepare a rule before it goes live.
  • Customers: apply_to chooses who is included; exclude_from leaves some of them out, and an excluded customer stays out even when included.
  • Products: product_condition_type chooses the products; exc_product_type leaves some of them out.
  • Markets: market_condition_type: by_ids limits the rule to the listed Shopify markets.
  • Schedule: start_at and end_at are UTC. Leave start_at out to start at once and end_at out to never end.
  • Details and the modules that have each condition: Common objects.
  • PUT replaces the whole rule: send every field you want to keep. Optional fields left out go back to their defaults, and lists or table rows left out are removed.
  • A deleted rule cannot be read or changed again: its id answers 404.
  • The API never changes a rule you did not name in the request.
  • Create rules disabled, read them back, and enable them when they are right.
  • Until you upload, writes do not reach the storefront (except Auto Tag and Discount Code codes).
  • Use a development store with the app installed to try uploads.