Add Catalog Rule
POST/api/admin/portal/catalogs/:catalog/rules
Add an include/exclude rule to a catalog. Exclusions always win.
customers:writeGrant 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_stateorexclude_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 forinclude_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
- 201
- 401
- 403
- 404
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.