RenzoDocs

Referrals

Referral codes, the program status and your own referral totals.

View as Markdown

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

OperationWhat it doesAuth
GET/api/v1/referrals/programSay whether the program is on and what discount a friend gets.None
GET/api/v1/referrals/codes/{code}Check a code and read its discount.None
GET/api/v1/referrals/meRead your own code, link and totals. The code is made on the first read.Token and username
POST/api/v1/referrals/me/referrerAdd 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"
Response
{
  "code": "RENZO-A7K2",
  "discount_percent": 20
}
curl "$BASE/api/v1/referrals/me" \
  -H "Authorization: Bearer $TOKEN"
Response
{
  "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/program answers 200 with enabled: false. GET /api/v1/referrals/me shows enabled: false and code and link_path as null. A code check answers 404 referral_code_not_found.
  • Code check. Case does not matter. An unknown, inactive or off-program code answers 404 referral_code_not_found.
  • Rate limit. The two public calls allow 30 requests per minute per IP address, each with its own bucket. More answers 429 rate_limited, with a Retry-After header. See Rate limits.
  • Your link. link_path is /r/{code} on the customer web host. Share the full link with friends.
  • Totals. Friends are never named. signed_up counts friends who signed up with your code. subscribed counts those who paid a first invoice. pending is rewards on the way, and next_reward_at is when the next one is due. earned is rewards given, all time. left_this_year is how many rewards are still possible in the last 12 months, under cap.
  • Rewards. A reward waits hold_days before it is given. my_reward.kind is grant, with days of Premium, or credit, with amount_cents off the next bill and the date applies_on. It is null when no reward applies.
  • Entering a friend's code. POST /api/v1/referrals/me/referrer is allowed once, and only before you ever had a plan. It answers 200 with the same summary as GET /api/v1/referrals/me. can_add_code says whether it may succeed.
  • Code at sign-up. A friend can also pass referral_code and referral_source when signing in. See Authentication.
  • Your own code. It answers 409 referral_own_code.
  • Already set. A second code answers 409 referrer_already_set.
  • Had a plan. An account that ever had a plan answers 409 referral_not_eligible.
  • No code for you. An account that cannot have a referral code answers 409 referral_cannot_refer on GET /api/v1/referrals/me.
  • Discount at checkout. The discount shows in the checkout preview. See Billing.

Errors

CodeStatusWhen
referral_code_not_found404No active referral code matches, or the program is off.
referral_own_code409You cannot use your own code.
referrer_already_set409Your account already has a referrer.
referral_not_eligible409Only an account that never had a plan can add a code.
referral_cannot_refer409The account cannot have a referral code.
profile_incomplete409The account has no username yet.
rate_limited429Too 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.

Reference

On this page