Skip to content

Referrals

POST /v1/campaigns/{slug}/referrals

Records a referral event. When a new user signs up using another user’s referral code, both the referrer and referee earn configured rewards.

HeaderRequiredValue
X-API-SecretYesYour secret key
Content-TypeYesapplication/json
FieldTypeRequiredDescription
referrerIdstringYesUser ID of the person who shared the referral
refereeIdstringYesUser ID of the new user who was referred
referralCodestringYesThe referral code used
Terminal window
curl -X POST https://api.gamifyhost.com/v1/campaigns/summer-promo/referrals \
-H "X-API-Secret: sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"referrerId": "user_alice",
"refereeId": "user_bob",
"referralCode": "ALICE2025"
}'

Status: 200 OK

{
"status": "success",
"data": {
"referrerReward": 200,
"refereeReward": 100,
"message": "Referral recorded successfully"
}
}

GET /v1/campaigns/{slug}/referral-code/{userId}

Returns a user’s unique referral code for the campaign. If the user doesn’t have one yet, it is generated automatically.

HeaderRequiredValue
X-API-SecretYesYour secret key
Terminal window
curl -X GET "https://api.gamifyhost.com/v1/campaigns/summer-promo/referral-code/user_alice" \
-H "X-API-Secret: sk_live_your_secret_key"

Status: 200 OK

{
"status": "success",
"data": {
"referralCode": "ALICE2025",
"referralCount": 5,
"totalRewardsEarned": 1000
}
}
CodeMessage
400Self-referral not allowed
400User has already been referred
404Campaign or user not found