Mints a new share link for the caller's own affiliate and answers it with its…
Mints a new share link for the caller's own affiliate and answers it with its full URL, 201.
POST /v1/affiliate/me/links
| Address | https://api.hanzo.ai/v1/affiliate/me/links |
| Method | POST |
| Operation | post_affiliate_me_links |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Mints a new share link for the caller's own affiliate and answers it with its full URL, 201.
APPROVAL IS REQUIRED: an org that has applied but is not approved is refused, because a link that cannot accrue is a link that quietly loses the referral. A requested vanity code must be valid and free across the WHOLE directory — codes are one global namespace, so a taken code is a 409 rather than a silent alias. Omit the code and a random one is minted.
Bounded per affiliate. The label is cosmetic: it is trimmed, stripped of control characters and capped, and it is never part of a code.
Request
2 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
code | body | string | — | Code is an optional vanity code; it must be free across the whole directory, and omitting it mints a random one. |
label | body | string | — | Label is cosmetic — trimmed, stripped of control characters, capped — and never part of a code. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | linkMint | created |
201 body — 8 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
link | body | codeView | — | |
link.clicks | body | integer | — | Clicks is how many pings this code has taken. |
link.code | body | string | — | Code is the link's slug — 3–32 chars of a–z, 0–9 and hyphen — unique across the WHOLE directory, so any affiliate's code resolves an attribution. |
link.conversions | body | integer | — | Conversions is how many of those signups have actually produced positive commission for the caller. |
link.createdAt | body | integer | — | CreatedAt is when the link was minted, Unix seconds UTC. |
link.label | body | string | — | Label is the caller's own note for the link ("twitter", "newsletter"). |
link.signups | body | integer | — | Signups is how many orgs were attributed with this code — DERIVED by counting attribution edges, never stored, so it cannot drift from the ledger. |
link.url | body | string | — | URL is the full shareable link, the brand host plus ?aff=<code>. |
Failure carries the platform error shape — see Errors.
Examples
hanzo affiliates me links createimport { Configuration, AffiliateApi } from 'hanzoai';
const api = new AffiliateApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAffiliateMeLinks({ code: "<code>", label: "<label>" });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).post_affiliate_me_links(code="<code>", label="<label>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AffiliateAPI.PostAffiliateMeLinks(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::post_affiliate_me_links(&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).postAffiliateMeLinks();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 -X POST https://api.hanzo.ai/v1/affiliate/me/links \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "<code>",
"label": "<label>"
}'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?