Skip to content

Referral Programs

Referral programs reward customers for bringing in new users, creating organic growth loops.

  1. Create a referral program

    Terminal window
    curl -X POST https://api.storelayer.io/v1/referral-programs \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
    "name": "Invite a Friend",
    "referrerReward": {"type": "points", "amount": 500},
    "refereeReward": {"type": "points", "amount": 250},
    "maxReferrals": 20
    }'
  2. Generate referral links

    Each customer gets a unique code:

    Terminal window
    curl -X GET https://api.storelayer.io/v1/referrals/{customerId}/code \
    -H "Authorization: Bearer YOUR_API_KEY"
  3. Apply referral on signup

    When a new user signs up with a referral code:

    Terminal window
    curl -X POST https://api.storelayer.io/v1/referrals/apply \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
    "code": "JANE-X7K2",
    "refereeId": "cust_new456"
    }'
  4. Track performance

    Terminal window
    curl -X GET https://api.storelayer.io/v1/referrals/{customerId}/history \
    -H "Authorization: Bearer YOUR_API_KEY"
TypeDescription
pointsAward points to the wallet
discountGive a discount code
free_itemAward a catalog item