Skip to main content
PATCH
Update coupon

Authorizations

Authorization
string
header
required

Use your Shoppex API key in the Authorization header.

Headers

If-Match
string

The revision of the resource as last read, e.g. "3". The write runs only while the resource still has it; otherwise 409 REVISION_CONFLICT with current_revision and nothing changes. An MCP tool call without it only replays the stored answer of a key that already ran.

Pattern: ^"?[1-9][0-9]{0,14}"?$

Path Parameters

id
string
required

Body

code
string

Coupon code. Stored trimmed and lowercased (SUMMER10 becomes summer10); buyers can enter it in any case.

Required string length: 1 - 64
discount_value
number
Required range: x >= 1e-9
discount_type
enum<string>
Available options:
PERCENTAGE,
FIXED
max_uses
integer | null
first_order_only
boolean
products_bound
string[]
variants_bound
string[]
products_excluded
string[]

'all_except' coupons: the products the coupon does not discount.

product_discounts
object[]

'selected' coupons: a bound product's own discount instead of the coupon's. max_discount and min_order_amount still apply to the whole coupon. Sent, exactly these products get their own discount.

applies_to
enum<string>

Which products the coupon discounts: 'all', 'selected' (only products_bound and variants_bound), or 'all_except' (every product but products_excluded). Without it, a write that sends a list stores 'all_except' when products are excluded, 'selected' when any item is bound and 'all' when neither is. A 'selected' coupon whose products and variants were all deleted applies to nothing.

Available options:
all,
selected,
all_except
min_order_amount
number | null
max_discount
number | null
valid_from
valid_until
subscription_duration
enum<string>

How many subscription payments the coupon discounts: the first one, the first subscription_payments (REPEATING), or every payment. Send subscription_duration and subscription_payments together: a PATCH without subscription_duration keeps both stored values, and subscription_payments alone is refused with VALIDATION_ERROR. To change the count of a REPEATING coupon, send subscription_duration: REPEATING with the new count.

Available options:
ONCE,
REPEATING,
FOREVER
subscription_payments
integer | null

The number of discounted payments for REPEATING, 2 to 36; null otherwise. Send subscription_duration and subscription_payments together: a PATCH without subscription_duration keeps both stored values, and subscription_payments alone is refused with VALIDATION_ERROR. To change the count of a REPEATING coupon, send subscription_duration: REPEATING with the new count.

Required range: 2 <= x <= 36
is_active
boolean

Response

Response for status 200

data
object
required