Coupons API
Create and manage discount codes.
Overview
Create and manage discount codes programmatically.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/admin/promotions | List all promotions |
POST | /api/admin/promotions | Create a new promotion |
GET | /api/admin/promotions/[id] | Get promotion details with usage stats |
PUT | /api/admin/promotions/[id] | Update a promotion |
DELETE | /api/admin/promotions/[id] | Delete a promotion |
Validating a code at checkout
The storefront uses POST /api/promotions/validate to check if a discount code is valid, active, and hasn't exceeded its usage limit before applying it to the cart.
