curl --request GET \
--url https://api.goyappr.com/affiliates/stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.goyappr.com/affiliates/stats"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.goyappr.com/affiliates/stats', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/affiliates/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/affiliates/stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.goyappr.com/affiliates/stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/affiliates/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"ref_code": "AB12CD34",
"commission_rate_pct": 10,
"override_rate_pct": 2.5,
"override_basis": "revenue",
"hold_days": 30,
"months_window_months": 12,
"summary": {
"clients_invited": 123,
"sub_affiliates": 123,
"referred_revenue_cents": 123,
"override_revenue_cents": 123,
"earned_cents": 123,
"direct_earned_cents": 123,
"override_earned_cents": 123,
"payable_cents": 123,
"paid_cents": 123,
"outstanding_cents": 123,
"earned_before_window_cents": 123
},
"months": [
{
"month": "2026-07",
"clients_invited": 123,
"referred_revenue_cents": 123,
"commission_cents": 123,
"direct_commission_cents": 123,
"override_commission_cents": 123,
"payable_commission_cents": 123,
"payout_sent_cents": 123
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Affiliate stats
Your referral code, your commission rates, lifetime totals, and a trailing
month-by-month breakdown. Always scoped to the API key’s own workspace —
there is no path, query or body parameter for a company id, and supplying
company_id returns 400. Required scope affiliates:read.
Money is integer US cents. Every *_cents field, including
payout_sent_cents, is denominated in US cents no matter which currency a
payout was actually wired in. Divide by 100 for dollars.
Earned vs payable. earned_cents is everything you have accrued.
payable_cents is the part that has aged past hold_days and is claimable
now; it is the number payouts are drawn from. outstanding_cents is
payable_cents - paid_cents and may be negative when you have been paid
ahead of the hold window — that is a real state, not an error.
Reconciliation. earned_before_window_cents plus the sum of
months[].commission_cents equals summary.earned_cents exactly, so the
table on screen can always be made to add up to the lifetime total.
curl --request GET \
--url https://api.goyappr.com/affiliates/stats \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.goyappr.com/affiliates/stats"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.goyappr.com/affiliates/stats', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/affiliates/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/affiliates/stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.goyappr.com/affiliates/stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/affiliates/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"ref_code": "AB12CD34",
"commission_rate_pct": 10,
"override_rate_pct": 2.5,
"override_basis": "revenue",
"hold_days": 30,
"months_window_months": 12,
"summary": {
"clients_invited": 123,
"sub_affiliates": 123,
"referred_revenue_cents": 123,
"override_revenue_cents": 123,
"earned_cents": 123,
"direct_earned_cents": 123,
"override_earned_cents": 123,
"payable_cents": 123,
"paid_cents": 123,
"outstanding_cents": 123,
"earned_before_window_cents": 123
},
"months": [
{
"month": "2026-07",
"clients_invited": 123,
"referred_revenue_cents": 123,
"commission_cents": 123,
"direct_commission_cents": 123,
"override_commission_cents": 123,
"payable_commission_cents": 123,
"payout_sent_cents": 123
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}affiliates:read.
Scoping
This endpoint always reports on the workspace that issued the API key. There is no path, query or body parameter for a company id, and passingcompany_id returns 400 rather than silently reporting your own numbers back to you. To read a different workspace’s affiliate stats, use a key issued by that workspace.
Query parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
months | integer | 12 | How many trailing months months[] covers, 1–60. Does not affect summary, which is always lifetime. |
Money is integer US cents
Every field ending in_cents is a whole number of US cents. Divide by 100 for dollars; never parse it as a decimal. That includes payout_sent_cents and paid_cents — a payout wired in another currency is converted at the rate recorded on that payout and stored in US cents, so the whole payload is one currency.
Only completed, USD payments linked to a payment intent or invoice earn commission. The base is the paid service amount before tax. Gift, onboarding and promotional credits never count, even if they carry a payment reference. Unpaid purchases earn nothing; refunds and chargebacks reduce commission at the original payment’s rates.
Earned vs payable — the distinction that matters
| Field | What it is |
|---|---|
earned_cents | Everything you have accrued, from the moment the customer paid. |
payable_cents | The part of earned_cents that has aged past hold_days and is claimable now. |
paid_cents | What has actually been sent to you. |
outstanding_cents | payable_cents - paid_cents. The number you are owed today. |
hold_days have elapsed — that window covers card disputes and refunds, so money that could still be reversed never appears as owed. A recent month therefore reads commission_cents higher than payable_commission_cents; the gap closes on its own as the hold elapses. Nothing is lost.
outstanding_cents can be negative. That means a payout ran ahead of the hold window — you have been paid for commission that has not cleared yet. It is a real state, not an error, and it is deliberately not clamped to zero so an overpayment stays visible. It works itself off as more commission becomes payable. Render it as an “overpaid” state rather than as a negative currency amount.Response fields
| Field | Type | Meaning |
|---|---|---|
ref_code | string | Your referral code. Your link is https://app.goyappr.com/signup?ref=<ref_code>. |
commission_rate_pct | number | Your direct (tier-1) rate today, as a percentage. See Rates are not retroactive. |
override_rate_pct | number | Your override (tier-2) rate today, applied to override_basis. 0 when you have no tier-2 terms — which is the normal case. |
override_basis | string | revenue applies your tier-2 rate to paid customer revenue. affiliate_commission applies it to your partner’s earned direct commission, after rounding that commission to cents. This field describes today’s terms. |
hold_days | integer | Days a commission ages before becoming payable. 0 means immediately payable. |
months_window_months | integer | Echo of the months parameter. |
summary.clients_invited | integer | Companies that signed up through your link, including ones that have never paid. |
summary.sub_affiliates | integer | Enrolled partners you earn an override through. 0 for most workspaces. Itemised by GET /affiliates/downline. |
summary.referred_revenue_cents | integer | Lifetime tier-1 billed revenue — what your direct referrals paid us. |
summary.override_revenue_cents | integer | Lifetime tier-2 paid service revenue, excluding tax and gifts. This stays customer revenue when override_basis is affiliate_commission; it is then not the commission base. |
summary.earned_cents | integer | Lifetime commission, both tiers. Equals direct_earned_cents + override_earned_cents. |
summary.direct_earned_cents | integer | Tier-1 share of earned_cents. |
summary.override_earned_cents | integer | Tier-2 share of earned_cents. |
summary.payable_cents | integer | The part of earned_cents past the hold window. |
summary.paid_cents | integer | Lifetime payouts in US cents. Voided payouts are excluded. |
summary.outstanding_cents | integer | payable_cents - paid_cents. May be negative. |
summary.earned_before_window_cents | integer | Commission earned before the first month in months[]. |
months[] | array | Newest first, months_window_months entries, zero-filled. |
Month rows
| Field | Type | Meaning |
|---|---|---|
month | string | YYYY-MM. |
clients_invited | integer | Signups through your link that month. |
referred_revenue_cents | integer | Tier-1 billed revenue that month. |
commission_cents | integer | Commission earned that month, both tiers. |
direct_commission_cents | integer | Tier-1 share. |
override_commission_cents | integer | Tier-2 share. |
payable_commission_cents | integer | The part past the hold window. Lower than commission_cents for recent months. |
payout_sent_cents | integer | Payouts recorded against that month, in US cents. |
*_cents field in a month row can be negative. A refund or chargeback is booked in the month it happens, and it reverses the commission at the rate that applied when the customer originally paid — so a month with more refunds than sales reads negative. The summary totals already account for it. Do not clamp these to zero; a table that hides a reversal will not add up to earned_cents.Rates are not retroactive
commission_rate_pct, override_rate_pct and override_basis describe the terms in force today. Each commission was priced using the rates and basis in force on the day that customer paid, and a later terms change never re-prices what you already earned — up or down.
So this does not hold, and you should not present it as if it did:
referred_revenue_cents * commission_rate_pct / 100 ≠ direct_earned_cents
direct_earned_cents and override_earned_cents are the authoritative figures; the rate fields tell you what the next dollar earns.
For the same reason, the per-line rounding is done at the (customer, month) grain, so sum(months[].commission_cents) can differ by a cent or two from a rate applied to a lifetime revenue total. The reconciliation identity below is the one that always holds.
An override on a partner’s commission
Whenoverride_basis is affiliate_commission, the partner keeps their full direct commission. Your percentage is calculated on that earned commission and paid on top by Yappr. It is not a second percentage of what their customers spent.
For example, customers pay $250 before tax: $20 in September, $70 in October and $160 in November. A partner on 5% earns $1, $3.50 and $8 — $12.50 total. Your 15% share of those monthly commissions is $0.15, $0.53 and $1.20 — **$1.88 total**. Applying 15% directly to $250 would incorrectly show $37.50. Gift credits add nothing to either commission.
The partner’s commission is rounded once for each customer, month and partner rate, then allocated to the payments in ledger order. Your share is rounded once per customer and month across your applicable rate slices. A change to your rate, referral eligibility or hold window does not round the partner’s earnings again.
The payment date selects both partners’ terms. A refund reverses the original payment’s rounded share and appears in the refund month. Partial refunds reverse a cumulative proportion of that original share, so a full refund cancels it exactly even when several refunds arrive in different months or in a different order. A successful dispute recovery restores the same allocation. The original payment’s hold clock is retained.
For example, if a payment was allocated one cent of parent commission, a 50% refund reverses one cent after rounding; refunding the remaining half reverses no additional cent. This cumulative original-lot convention can differ by a cent from applying a percentage to the partner’s separately rounded refund-month totals. It never reverses the same earned cent twice.
Reconciling the table to the lifetime total
summary is lifetime and unbounded; months[] is a trailing window. They differ, and the payload tells you by exactly how much:
earned_before_window_cents + sum(months[].commission_cents) == summary.earned_cents
earned_before_window_cents as an “Earlier” row and your table always adds up. Widen the window with months if you want the older months itemised.
Example request
curl "https://api.goyappr.com/affiliates/stats?months=2" \
-H "Authorization: Bearer $YAPPR_API_KEY"
Example response
Read on 2026-09-15, for an affiliate on 10% direct, 2.5% override, 30-day hold, whose rates have never changed — which is why revenue times rate happens to reproduce the earned figures here. Do not rely on that in general; see Rates are not retroactive.{
"ref_code": "AB12CD34",
"commission_rate_pct": 10,
"override_rate_pct": 2.5,
"override_basis": "revenue",
"hold_days": 30,
"months_window_months": 2,
"summary": {
"clients_invited": 3,
"sub_affiliates": 1,
"referred_revenue_cents": 26500,
"override_revenue_cents": 40000,
"earned_cents": 3650,
"direct_earned_cents": 2650,
"override_earned_cents": 1000,
"payable_cents": 1450,
"paid_cents": 700,
"outstanding_cents": 750,
"earned_before_window_cents": 1450
},
"months": [
{
"month": "2026-09",
"clients_invited": 0,
"referred_revenue_cents": 12000,
"commission_cents": 2200,
"direct_commission_cents": 1200,
"override_commission_cents": 1000,
"payable_commission_cents": 0,
"payout_sent_cents": 0
},
{
"month": "2026-08",
"clients_invited": 1,
"referred_revenue_cents": 0,
"commission_cents": 0,
"direct_commission_cents": 0,
"override_commission_cents": 0,
"payable_commission_cents": 0,
"payout_sent_cents": 700
}
]
}
earned_cents is 3,650¢, but all 2,200¢ of it earned in September — a 1,200¢ direct commission and a 1,000¢ override — is younger than the 30-day hold, so payable_commission_cents is 0 for that month and payable_cents is only the 1,450¢ accrued before the window. 700¢ of that has been paid, so the amount actually owed today is outstanding_cents = 750¢. Come 2026-10-05 the September lines age past the hold and payable_cents jumps to 3,650¢ with no new revenue at all.
The reconciliation also holds: earned_before_window_cents (1,450) + 2200 + 0 = earned_cents (3,650).
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | AFFILIATES_QUERY_INVALID | months is not an integer 1–60, or any other query parameter was sent (company_id included — the workspace is always the key’s own), or one was sent twice or with no value. The message names it. |
| 403 | INSUFFICIENT_SCOPE | API key lacks affiliates:read. |
| 401 | MISSING_KEY / INVALID_KEY / EXPIRED_KEY | No key, an unknown or revoked key, or an expired one. |
| 403 | AFFILIATE_FORBIDDEN | Affiliate data is not readable for this workspace. |
| 429 | RATE_LIMIT | 60 requests/minute exceeded. |
| 500 | INTERNAL_ERROR | The figures could not be computed. Safe to retry. |
Authorizations
Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).
Query Parameters
Response
Affiliate stats
Affiliate commission summary for the API key's own workspace. All money is integer US cents — divide by 100 for dollars, never parse as a float.
Your direct (tier-1) commission rate as a percentage, as it stands today. Every past commission was priced at the rate in force on the day that customer paid, so after a rate change referred_revenue_cents * commission_rate_pct will NOT reproduce direct_earned_cents. Use it to say what new revenue will earn — never to re-derive history.
10
The tier-2 basis in force today. revenue applies your override to paid customer revenue. affiliate_commission applies it to your partner's earned direct commission, after that commission is rounded to cents; their full commission is unchanged and yours is paid on top. Historical terms are resolved at the original payment date. Partner monthly earnings are rounded before parent eligibility or rate slices; the parent share is rounded once per customer/month across its rate slices. Refunds reverse the original rounded share; partial refunds cumulatively apportion that share, so a full refund cancels it exactly. Gifts, promotional credits, unpaid rows and taxes do not earn commission; refunds reduce the base at the original rates. Most workspaces have no tier-2 terms.
revenue, affiliate_commission