Skip to main content

Add Catalog Rule

POST 

/api/admin/portal/catalogs/:catalog/rules

Add an include/exclude rule to a catalog. Exclusions always win.

Required scope: customers:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Body:

  • rule_type (required) — include_product, exclude_product, include_category, exclude_category, include_brand, exclude_brand, include_lifecycle_state or exclude_lifecycle_state.
  • ref_id (integer, min 1) — the product, category or brand id. Required for product, category and brand rules; must be omitted for lifecycle-state rules.
  • ref_key (string, max 40) — the product lifecycle state key (e.g. phasing_out, discontinued, or a custom state). Required for include_lifecycle_state / exclude_lifecycle_state; must be omitted for every other rule type. An unknown key is a 422 ("That lifecycle state does not exist.").

A lifecycle-state rule matches every product currently in that state, so it follows products as their state changes — e.g. exclude_lifecycle_state + discontinued hides discontinued products from this catalog's buyers.

The returned rule includes ref_kind (product, category, brand or lifecycle_state) and ref_key; ref_label/ref_sku are resolved when you fetch the catalog via Get Catalog.

Request​

Responses​

Created

Response Headers
    Content-Type