Affiliate

A partner program that pays commission on what your referrals spend.

Also for this capability: API · CLI · MCP · SDKs

A partner program that pays commission on what your referrals spend.

Base URLhttps://api.hanzo.ai
Operations10
AuthAuthorization: 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

SurfaceReaches this capability asCoverage
RESTaffiliate at its own prefix10 operations
CLIhanzo affiliate …10 of 10
SDKAffiliateApi in every published client10 methods
MCPtool affiliate on https://api.hanzo.ai/v1/mcp10 operations, 2 under the document's own id — ask describe for the rest

Quickstart

export HANZO_API_KEY=sk-...   # console.hanzo.ai → API keys

Then the first call — a read that needs nothing but the key. GET /v1/affiliate, operation get_affiliate:

hanzo affiliate get
import { 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 := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AffiliateAPI.GetAffiliate(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::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.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AffiliateApi(client).getAffiliate();
curl https://api.hanzo.ai/v1/affiliate \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches affiliate through the affiliate tool, which names its 10 operations with its own verbs — this one among them, under a name only MCP 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_affiliates"
         }
       }
     }'

Answers 200 with object — ok.

Endpoints

EndpointWhat it does
POST /v1/affiliate/applyEnrolls the caller's OWN org as an affiliate at status applied, optionally requesting a vanity code, and answers the record — 201 on the first apply, 200 with created:false afterwards.
POST /v1/affiliate/attributeRecords 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/clickCounts a click on a share link.
GET /v1/affiliate/leaderboardAnswers 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/earningsAnswers 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.
POST /v1/affiliate/me/handleSets the caller's public leaderboard display name, or clears it.
GET /v1/affiliate/me/linksAnswers the caller's share links, each with its URL and its funnel: clicks tracked, signups — orgs attributed with that code — and conversions, meaning how many of those signups have actually produced commission.
POST /v1/affiliate/me/linksMints a new share link for the caller's own affiliate and answers it with its full URL, 201.
GET /v1/affiliate/meAnswers the richer self-view: the same lifetime accrued, pending and paid commission and payout history, plus the caller's downline broken out by upline LEVEL — direct, second, third — each with the rate paid at that level and how many orgs sit there.
GET /v1/affiliateAnswers the caller org's OWN affiliate standing: status, referral code and share link, commission rate, how many orgs it has referred, and its lifetime accrued, still-pending and already-paid commission in integer cents, with its payout history.

All Hanzo APIs · Interactive reference

Was this page useful?