API/Affiliate Promo Codes API

Affiliate Promo Codes API

Create, edit and sync Stripe promo codes attached to affiliate partners.

Promo codes are real Stripe coupons plus promotion codes on the organization's connected account. Growth mirrors them so redemptions can be attributed to a partner.

List promo codes

GET /api/v1/affiliate/promo-codes
ParameterTypeDescription
affiliateIdstringOnly codes linked to this partner.
limitnumberRows to return, 1-200 (default 100).
{
  "promoCodes": [
    {
      "id": "p31...",
      "code": "MARIE20",
      "status": "active",
      "discountType": "percent",
      "percentOffBps": 2000,
      "currency": "eur",
      "duration": "forever",
      "redemptionsCount": 14,
      "maxRedemptions": 100,
      "expiresAt": null,
      "affiliate": { "id": "n97...", "name": "Marie Dupont" },
      "stripePromotionCodeId": "promo_..."
    }
  ],
  "sampleLimited": false
}

percentOffBps is hundredths of a percent (2000 = 20%). amountOff is in minor units.

Create a promo code

POST /api/v1/affiliate/promo-codes
FieldTypeDescription
codestringRequired customer-facing code.
discountTypestringRequired percent or fixed.
percentOffBpsnumberRequired for percent, 1-10000.
amountOffnumberRequired for fixed, minor units.
currencystringISO currency. Defaults to the connected account's currency.
affiliateIdstringLinks redemptions to that partner.
durationstringforever (default), once or repeating.
durationInMonthsnumber1-36, required when duration is repeating.
startsAt / expiresAtnumberTimestamps in ms; the end date must be in the future.
maxRedemptionsnumberTotal redemption limit.
curl -X POST -H "x-api-key: org_api_key" -H "Content-Type: application/json" \
  -d '{"code":"MARIE20","discountType":"percent","percentOffBps":2000,"affiliateId":"n97..."}' \
  "https://growth.example.com/api/v1/affiliate/promo-codes"

Update a promo code

PATCH /api/v1/affiliate/promo-codes/:promoCodeId
FieldTypeDescription
statusstringactive or paused.
expiresAtnumber | nullNew deadline, or null to clear it.
maxRedemptionsnumber | nullNew limit, or null to clear it.

Stripe promotion codes are immutable except for active: changing the deadline or the limit archives the Stripe code and recreates one on the same coupon with the same customer-facing string. Growth carries the redemptions over, so lifetime totals stay correct.

Sync codes created in Stripe

POST /api/v1/affiliate/promo-codes/sync

Body: { "limit": 100, "startingAfter": "promo_..." } (both optional). Imports promotion codes created directly in the Stripe dashboard and returns processed, created, updated, skipped, linked, unassigned, hasMore and nextCursor.

Error responses:

StatusMeaning
400Missing/invalid fields, code already in use, or Stripe not connected.
401Missing or invalid API key.
404Unknown promo code or partner.

Notes

  • Creating a code requires a connected Stripe account with charges enabled.
  • A code that already exists in Stripe must be imported with sync before Growth will create it.
  • Codes can exist without a partner and be linked later.
Affiliate Partners APIAffiliate Offers API