FonProxy

Referral API

FonProxy referral endpoints: get referral info, update codes, view referral graph and earnings.

Last updated: October 15, 2026

For authentication and common headers, see API General.

Overview

Get Referral Info Auth required

GET /referral

Returns the user's referral code, percentages, and stats. Auto-creates a referral code on first access.

Response

{
  "id": "xK9mR2pL1w",
  "code": "a3f8c2d1",
  "incomePercentage": 5,
  "salePercentage": 0,
  "clicks": 142,
  "registrations": 23,
  "totalIncome": 12.50,
  "pendingIncome": 3.75
}
NameTypeDescription
idstringReferral ID
codestringEditable referral code (used in referral link)
incomePercentagenumberPercentage the referrer earns from each referred top-up
salePercentagenumberDiscount percentage for referred users (future)
clicksnumberTotal visitors who came via this referral
registrationsnumberTotal users who registered via this referral
totalIncomenumberTotal completed referral income (USD)
pendingIncomenumberPending referral income not yet credited (USD)

List Referred People Auth required

GET /referral/people

Returns the newest people who signed up through the user's link, with the middle of each address hidden.

Query Parameters

NameTypeDescriptionRequired
limitnumberHow many people to return, newest first (default 5, max 20)No

Response

{
  "total": 23,
  "people": [
    {
      "signedUpAt": "2026-04-08T11:20:00.000Z",
      "account": "j•••@gmail.com",
      "topups": 2,
      "spentUsd": 40,
      "earnedUsd": 2,
      "status": "paid"
    }
  ]
}
NameTypeDescription
totalnumberEveryone who registered via this referral, not only the returned page
signedUpAtstringRegistration time (ISO 8601)
accountstringMasked email: first character, •••, then the domain
topupsnumberTop-ups of this person that produced referral income
spentUsdnumberSum of those top-ups (USD)
earnedUsdnumberReferral income earned from them (USD)
statusstringpaid (all income credited), pending (some income not yet credited), none (no top-up yet)

Code

Update Referral Code Auth required

PATCH /referral/code

Update the referral code. Must be 3–30 characters, alphanumeric + underscore + hyphen.

Request Body

NameTypeDescriptionRequired
codestringNew referral codeYes

Response

{ "code": "john_doe", "message": "referral.code_updated" }

Errors:

{ "message": "referral.code_invalid" }
{ "message": "referral.code_taken" }

Analytics

Referral Graph Auth required

GET /referral/graph

Returns time-series chart data for clicks, registrations, and income.

Query Parameters

NameTypeDescriptionRequired
fromstringISO date start. Default 30 days agoNo
tostringISO date end. Default nowNo
granularitystringhour, day, week, month. Default autoNo

Response

{
  "graph": "referral",
  "granularity": "day",
  "from": "2026-02-23T00:00:00.000Z",
  "to": "2026-03-25T00:00:00.000Z",
  "series": [
    {
      "key": "clicks",
      "label": "Clicks",
      "color": "#3B82F6",
      "points": [
        { "t": "2026-03-24T00:00:00.000Z", "v": 15 },
        ...
      ]
    },
    {
      "key": "registrations",
      "label": "Registrations",
      "color": "#22C55E",
      "points": [
        { "t": "2026-03-24T00:00:00.000Z", "v": 3 },
        ...
      ]
    },
    {
      "key": "income",
      "label": "Income (USD)",
      "color": "#151515",
      "points": [
        { "t": "2026-03-24T00:00:00.000Z", "v": 2.50 },
        ...
      ]
    }
  ],
  "meta": { "currency": "USD" }
}

How Referrals Work

  1. User gets a unique referral code from GET /referral
  2. Frontend builds a link: https://fonproxy.com/?ref=<code>
  3. Visitor arrives → logs in database.
  4. Visitor registers → invitedById is set on the new user + referrer is notified
  5. Referred user tops up → a pending referral income transaction is created for the referrer
  6. After 2 days (instant in dev mode) the pending transaction is credited to the referrer's balance + referrer is notified
  7. User can track everything in GET /referral, GET /referral/graph and GET /referral/people