Skip to content

Referrals

The referral system lets you create growth loops by rewarding customers who bring in new users.

  1. A customer generates a referral code or referral link
  2. A new user signs up using that code
  3. Both the referrer and referee receive rewards
Terminal window
curl -X POST https://api.storelayer.io/v1/referral-programs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Friend Referral",
"referrerReward": {
"type": "points",
"amount": 500
},
"refereeReward": {
"type": "points",
"amount": 250
},
"maxReferrals": 10
}'

Each customer gets a unique referral code:

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

Response:

{
"success": true,
"data": {
"code": "JANE-X7K2",
"url": "https://your-app.com/ref/JANE-X7K2",
"referralsCount": 3,
"maxReferrals": 10
}
}

View a customer’s referral activity:

Terminal window
curl -X GET https://api.storelayer.io/v1/referrals/{customerId}/history \
-H "Authorization: Bearer YOUR_API_KEY"