Skip to main content
PUT
Node.js

Authorizations

Authorization
string
header
required

A secret API key, made under Developers in the dashboard: Authorization: Bearer shoply_sk_...

Headers

Idempotency-Key
string

A word of your own for this one change, up to 180 letters, digits, dots, dashes, underscores and colons. Sent again with the same key, the request is not carried out twice: the first answer comes back, with Idempotent-Replay: true.

Path Parameters

storeId
string
required

The store's ID. A key reaches the store it was made in: GET /key answers which.

couponId
string
required

The coupon.

Query Parameters

tz
string

The time zone a bare date in expiresAt is read in, as an IANA name. Left out, UTC.

Example:

"Europe/Berlin"

Body

application/json
code
string
required

What a buyer types. 3 to 64 letters, digits, hyphens or underscores, kept in capitals. One coupon a code in a store.

Example:

"WELCOME10"

value
number
required

How much comes off: 1 to 100 for percent, an amount for fixed.

Example:

10

discountType
enum<string>
default:percent

A share of the order, or an amount in the store's currency.

Available options:
percent,
fixed
maxUses
integer
default:0

How many orders may use it. 0 is no limit.

minSubtotal
number
default:0

The smallest order it works on, before discounts. 0 is any order.

expiresAt
string

When it stops working: a date (2026-12-31, good to the end of that day) or a date and time. Empty is never.

Example:

"2026-12-31"

active
boolean
default:true

Whether buyers can use it.

categoryId
string

The coupon category it is filed in. Left out, it goes in the store's Default category.

appliesTo
enum<string>
default:all

Every product, or only the ones in targets.

Available options:
all,
some
targets
object[]

The products it works on when appliesTo is some. Each names a product, and optionally one variant of it.

customerTag
string

Who may use it: empty for anybody with the code, vip, or the ID of one of the store's tags. The buyer's email has to wear the tag when the code is applied and when they pay.

expectedUpdatedAt
string

The updatedAt you last read. Sent, the change is refused with stale_write if the record has changed since. Left out, it is saved whatever happened in between.

Response

It worked.

success
boolean
message
unknown
code
unknown
data
object