PATCH
Update a discount rule

Authorizations

Authorization
string
header
required

A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.

Headers

Idempotency-Key
string
required

A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.

Path Parameters

discountId
string
required
ruleId
string
required

Body

application/json

Every value is an absolute target, so replaying converges, and values REPLACES the whole set rather than adding to it. The attribute, operator and value set are checked as MERGED with what is already stored, so a patch naming only the operator is refused when the stored attribute cannot honour it. kind is not settable: moving an eligibility rule to buy or target does not narrow the discount, it removes the gate and makes the discount unconditional again. Eligibility is evaluated at checkout time rather than snapshotted onto the cart, so narrowing a rule changes what a shopper already in checkout pays, with no notification.

attribute
enum<string>

Required on create. The cart fact this rule tests, from the closed set the checkout evaluator understands. subtotal is MINOR UNITS of the cart's own currency and carries no currency label, so "5000" is 50.00 in a two-decimal currency and "50" is fifty cents. buy and target rules are matched one cart line at a time and can only use items.product.id and items.product.collection_id.

Available options:
subtotal,
currency_code,
items.product.id,
items.product.collection_id,
customer.groups.id
operator
enum<string>

Required on create, and restricted per attribute to what the evaluator can compute: the id and group attributes accept only in and nin, currency_code accepts only the equality operators, and gt/gte/lt/lte compare against exactly one value. An unevaluable pair is refused rather than stored.

Available options:
eq,
ne,
in,
nin,
gt,
gte,
lt,
lte
values
string[]

Required on create, never empty, at most 200 entries of at most 128 characters. Strings for every attribute including subtotal, because the column is text and the evaluator parses it. On a patch the whole set is REPLACED; there is no add or remove.

description
string | null

Merchant notes. Nothing reads it.

Response

Success

data
object