API reference
Coupons
1-to-1 affiliate discount codes used for attribution.
List coupons
GET
/v1/programs/:programId/couponsread scopeLists every affiliate coupon code in the program, with its owner and usage count.
Path parameters
| programIdrequuid | From `GET /v1/me`. |
Response
json
{
"coupons": [
{
"id": "5c8a...",
"code": "KRISTIN10",
"discountType": "percentage",
"discountValue": 10,
"isActive": true,
"usageCount": 42,
"externalCouponId": "wc_881",
"affiliate": { "name": "Kristin Richards", "email": "...", "referralCode": "a8f2k1x9" }
}
]
}Assign a coupon
POST
/v1/programs/:programId/couponswrite scopeMaps a coupon code to an affiliate so orders using it are attributed to them.
Path parameters
| programIdrequuid | From `GET /v1/me`. |
Body parameters
| affiliateIdrequuid | Must belong to this program. |
| codereqstring | 2–32 chars, `A-Z 0-9 _ -`. |
| discountType'percentage' | 'flat' | Defaults to `percentage`. |
| discountValuenumber | Defaults to 20. |
| externalCouponIdstring | Your store's coupon id, for reconciliation. |
Response
json
{
"id": "5c8a...",
"code": "KRISTIN10",
"discountType": "percentage",
"discountValue": 10,
"isActive": true,
"storeSyncRequired": true
}- **This does not create the discount in your store.** SmoothProfit records the code→affiliate mapping for attribution; creating the actual coupon is your store's job. Pass `externalCouponId` once you have.