Answers the caller's own commission ledger: per period, the margin it earned…
Answers the caller's own commission ledger: per period, the margin it earned against and the commission taken from that margin; and per referred org, that…
GET /v1/affiliate/me/earnings
| Address | https://api.hanzo.ai/v1/affiliate/me/earnings |
| Method | GET |
| Operation | get_affiliate_me_earnings |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Answers the caller's own commission ledger: per period, the margin it earned against and the commission taken from that margin; and per referred org, that referral's aggregate contribution. Integer cents throughout.
The per-org view deliberately carries the affiliate's OWN earned share and NOT the referred org's spend or margin. An affiliate is entitled to what it earned, not to a restatement of its customer's usage — the period view is where the margin base appears, aggregated across every referral.
Scoped server-side to the validated caller's affiliate; a caller that is not
one gets isAffiliate:false.
Request
GET /v1/affiliate/me/earnings takes no parameters and no body — the credential is the whole request.
Response
| Status | Body | Meaning |
|---|---|---|
200 | affiliateEarnings | ok |
200 body — 12 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
accruedCents | body | integer | — | AccruedCents is lifetime commission accrued, in cents. |
byPeriod | body | periodEarningView[] | — | ByPeriod is the per-period ledger: the margin earned against and the commission taken from it. |
byPeriod[].commissionCents | body | integer | — | CommissionCents is what the caller earned that period, in cents: the sum over each referred org and upline level of margin × that level's rate. |
byPeriod[].marginCents | body | integer | — | MarginCents is the margin Hanzo earned in that period on the spend of every org the caller referred, in cents — the base commission is a rate OF. |
byPeriod[].period | body | string | — | Period is the accrual bucket: the UTC year-month, "YYYY-MM". |
byReferredOrg | body | orgEarningView[] | — | ByReferredOrg is each referral's aggregate contribution — the affiliate's OWN share, never the referred org's spend. |
byReferredOrg[].commissionCents | body | integer | — | CommissionCents is what the caller earned from that org across ALL periods, in cents. |
byReferredOrg[].referredOrg | body | string | — | ReferredOrg is the org slug this contribution came from — one the caller referred, directly or up to three levels down. |
isAffiliate | body | boolean | — | IsAffiliate says whether the caller org has an affiliate record. |
marginBps | body | integer | — | MarginBps is the platform gross-margin fraction commission is a rate OF. |
paidCents | body | integer | — | PaidCents is lifetime commission already paid out, in cents. |
pendingCents | body | integer | — | PendingCents is accrued minus paid — what the platform still owes. |
Failure carries the platform error shape — see Errors.
Examples
hanzo affiliates me earningsimport { Configuration, AffiliateApi } from 'hanzoai';
const api = new AffiliateApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAffiliateMeEarnings();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AffiliateApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AffiliateApi(client).get_affiliate_me_earnings()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AffiliateAPI.GetAffiliateMeEarnings(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, affiliate_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = affiliate_api::get_affiliate_me_earnings(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AffiliateApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new AffiliateApi(client).getAffiliateMeEarnings();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/affiliate/me/earnings \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches affiliate through the affiliates tool, which names its 17 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_admin_affiliates"
}
}
}'How is this guide?