Affiliate
Package affiliates is a partner program that pays commission on what your referrals spend.
Package affiliates is a partner program that pays commission on what your referrals spend.
| Base URL | https://api.hanzo.ai |
| Operations | 10 |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Specification
Specification pending — no HIP in hanzoai/hips declares capability: affiliate yet. What this capability serves is below, from the API document; what it is — the store it owns, how it meters, what it publishes — is written as a HIP under HIP-0139.
Four surfaces
| Surface | Reaches this capability as | Coverage |
|---|---|---|
| REST | affiliate at its own prefix | 10 operations |
| CLI | hanzo affiliates … | 10 of 10 |
| SDK | — | no published client declares one yet — regenerating the clients is what adds them |
| MCP | tool affiliates on https://api.hanzo.ai/v1/mcp | 17 operations, 2 under the document's own id — ask describe for the rest |
Quickstart
export HANZO_API_KEY=sk-... # console.hanzo.ai → API keysThen the first call — a read that needs nothing but the key. GET /v1/affiliate, operation get_affiliate:
hanzo affiliates getimport { Configuration, AffiliateApi } from 'hanzoai';
const api = new AffiliateApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAffiliate();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()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AffiliateAPI.GetAffiliate(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(&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).getAffiliate();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 \
-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"
}
}
}'Answers 200 with object — ok.
Endpoints
| Endpoint | What it does |
|---|---|
POST /v1/affiliate/apply | Enrolls the caller's OWN org as an affiliate at status applied, optionally requesting a vanity code, and answers the record — 201 on the first… |
POST /v1/affiliate/attribute | Records the first-touch edge every later commission is computed from: the caller's org was referred by the affiliate that owns this code. |
POST /v1/affiliate/click | Counts a click on a share link. |
GET /v1/affiliate/leaderboard | Answers the top affiliates by lifetime accrued commission, shown by OPT-IN HANDLE with aggregate figures only, plus the caller's own exact rank. |
GET /v1/affiliate/me/earnings | 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,… |
POST /v1/affiliate/me/handle | Sets the caller's public leaderboard display name, or clears it. |
GET /v1/affiliate/me/links | Answers the caller's share links, each with its URL and its funnel: clicks tracked, signups — orgs attributed with that code — and conversions,… |
POST /v1/affiliate/me/links | Mints a new share link for the caller's own affiliate and answers it with its full URL, 201. |
GET /v1/affiliate/me | Answers the richer self-view: the same lifetime accrued, pending and paid commission and payout history, plus the caller's downline broken out by… |
GET /v1/affiliate | Answers the caller org's OWN affiliate standing: status, referral code and share link, commission rate, how many orgs it has referred, and its… |
How is this guide?