Referrals
Promo codes with configurable currency rewards for referrer and referee.
Create referral and promo codes that reward both the referrer and the referee with virtual currency.
How it works
- Admin creates a referral code with rewards for both parties
- User shares their referral code
- When the code is redeemed, both users receive their rewards
- Usage is tracked with claim counts and optional limits
MCP tools
| Tool | Description |
|---|---|
amba_referrals_create | Create a referral code with rewards |
amba_referrals_get_stats | Get stats for a referral code |
Example
Client API reference
| Method | Path | Description |
|---|---|---|
GET | /v1/client/referrals/my-code | Get the user's referral code, creating it if new |
POST | /v1/client/referrals/claim | Claim a referral code |
Amba.referrals.getReferralCode() and Amba.referrals.claimReferral(code) call these routes. getReferralCode() returns { id, code, owner_id, uses_count, max_uses, created_at }. claimReferral(code) returns { id, code_id, referrer_id, referee_id, reward, claimed_at }; referrer_id is null for a code no user owns (one you created for a team or a campaign), and reward is what the code grants the user who claimed it.
Claim a referral code
A user can be referred by one other user: after claiming one user's code, a claim of another user's code answers 400 ALREADY_REFERRED. A code your team creates (no owning user) can be claimed once by each user, up to its max_uses. Other refusals are 404 INVALID_CODE, 400 SELF_REFERRAL, 400 ALREADY_CLAIMED and 400 MAX_USES_REACHED.