Referrals
Referral codes, the program status and your own referral totals.
A customer with a username has a referral code. A friend who uses the code gets a discount on the first payment. The customer earns a reward when the friend subscribes. The program can be switched on or off by Renzo. Two checks are public. The rest need a token and a username.
Endpoints
| Operation | What it does | Auth |
|---|---|---|
GET/ | Say whether the program is on and what discount a friend gets. | None |
GET/ | Check a code and read its discount. | None |
GET/ | Read your own code, link and totals. The code is made on the first read. | Token and username |
POST/ | Add the code of the friend who referred you: {"code": "..."}. Declares Idempotency-Key. | Token and username |
Without a username, the two token calls answer 409 profile_incomplete. See Account. POST /api/v1/referrals/me/referrer declares an Idempotency-Key header. Any mutating call accepts it. See Idempotency.
Example: check a code, then read your totals
curl "$BASE/api/v1/referrals/codes/RENZO-A7K2"{
"code": "RENZO-A7K2",
"discount_percent": 20
}curl "$BASE/api/v1/referrals/me" \
-H "Authorization: Bearer $TOKEN"{
"enabled": true,
"code": "RENZO-A7K2",
"link_path": "/r/RENZO-A7K2",
"discount_percent": 20,
"reward_days": 30,
"hold_days": 14,
"cap": 12,
"totals": {
"signed_up": 5,
"subscribed": 2,
"pending": 1,
"next_reward_at": "2026-11-18T13:30:00Z",
"earned": 1,
"earned_credit_cents": 0,
"left_this_year": 11
},
"has_referrer": false,
"can_add_code": true,
"my_reward": {
"kind": "grant",
"days": 30,
"amount_cents": null,
"applies_on": null
}
}Rules and edge cases
- Program off. When the program is off,
GET /api/v1/referrals/programanswers200withenabled: false.GET /api/v1/referrals/meshowsenabled: falseandcodeandlink_pathasnull. A code check answers404referral_code_not_found. - Code check. Case does not matter. An unknown, inactive or off-program code answers
404referral_code_not_found. - Rate limit. The two public calls allow 30 requests per minute per IP address, each with its own bucket. More answers
429rate_limited, with aRetry-Afterheader. See Rate limits. - Your link.
link_pathis/r/{code}on the customer web host. Share the full link with friends. - Totals. Friends are never named.
signed_upcounts friends who signed up with your code.subscribedcounts those who paid a first invoice.pendingis rewards on the way, andnext_reward_atis when the next one is due.earnedis rewards given, all time.left_this_yearis how many rewards are still possible in the last 12 months, undercap. - Rewards. A reward waits
hold_daysbefore it is given.my_reward.kindisgrant, withdaysof Premium, orcredit, withamount_centsoff the next bill and the dateapplies_on. It isnullwhen no reward applies. - Entering a friend's code.
POST /api/v1/referrals/me/referreris allowed once, and only before you ever had a plan. It answers200with the same summary asGET /api/v1/referrals/me.can_add_codesays whether it may succeed. - Code at sign-up. A friend can also pass
referral_codeandreferral_sourcewhen signing in. See Authentication. - Your own code. It answers
409referral_own_code. - Already set. A second code answers
409referrer_already_set. - Had a plan. An account that ever had a plan answers
409referral_not_eligible. - No code for you. An account that cannot have a referral code answers
409referral_cannot_referonGET /api/v1/referrals/me. - Discount at checkout. The discount shows in the checkout preview. See Billing.
Errors
| Code | Status | When |
|---|---|---|
referral_code_not_found | 404 | No active referral code matches, or the program is off. |
referral_own_code | 409 | You cannot use your own code. |
referrer_already_set | 409 | Your account already has a referrer. |
referral_not_eligible | 409 | Only an account that never had a plan can add a code. |
referral_cannot_refer | 409 | The account cannot have a referral code. |
profile_incomplete | 409 | The account has no username yet. |
rate_limited | 429 | Too many public checks from this IP address. |
Sign-in and request errors, such as token_expired and validation_failed, can come from any call. See Errors.