Added

Manage discount codes through the API

Discounts are now a full V2 resource: list and create them under /api/v2/workspaces/:workspace_id/discounts, then fetch, update and delete a single one at /api/v2/discounts/:id. A discount is the right tool for a coupon code, a percentage or fixed amount off, or a time-boxed sale: the thing you would otherwise fake with a second "sale" price on a product. You can scope one to specific products, variants or collections, require a minimum spend, limit it to one per customer, and schedule it with apply_from and apply_until. Listing supports filter[code], filter[discount_type], filter[discount_method], filter[applies_to] and filter[id], and every response carries the derived active, expired and scheduled flags so you can read a discount's state instead of recomputing it from dates.

Two things to know before you build against it. To stop offering a discount, send expired: true rather than backdating apply_until (which is rejected, since the end must fall after the start); it also cancels one that has not started yet, and expired: false lifts the expiry again, the same as the Expire Discount and Remove Expiration buttons in the app. Once a discount is expired its other fields are frozen and return 422, so editing one means lifting the expiry, changing it, then expiring it again. And a discount that has already been applied to an order cannot be deleted: DELETE returns 422 and you expire it instead, which preserves the order history. redemptions_count: 0 does not mean a discount is deletable, because that counter only tracks completed sales while the delete check looks at every order it is attached to.

The API manages the discount itself, not its use: codes reach an order when a buyer redeems one at checkout or a user applies one in the app.

Agent examples: spin up a launch code, scope it to one product, and expire it when the launch window closes · audit which codes are live, scheduled or expired across a workspace without opening the app.

Resources: Discount
Building with an AI agent? Point it at the Products skill.