# List earnings

URL: https://docs.hanzo.ai/docs/openapi/affiliate/get-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, that referral's aggregate contribution.

`GET /v1/affiliate/me/earnings`

> [Affiliate →](https://docs.hanzo.ai/docs/openapi/affiliate) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                 |
| ------------- | ----------------------------------------------- |
| **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`     | affiliate.affiliateEarnings | ok      |
| `default` | problem-details             | refused |

`200` body — 12 fields.

| Field                             | In   | Type                           | Always | Description                                                                                                                                       |
| --------------------------------- | ---- | ------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accruedCents`                    | body | integer (int64)                | —      | AccruedCents is lifetime commission accrued, in cents.                                                                                            |
| `byPeriod`                        | body | affiliate.periodEarningView\[] | —      | ByPeriod is the per-period ledger: the margin earned against and the commission taken from it.                                                    |
| `byPeriod[].commissionCents`      | body | integer (int64)                | —      | 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 (int64)                | —      | 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 | affiliate.orgEarningView\[]    | —      | ByReferredOrg is each referral's aggregate contribution — the affiliate's OWN share, never the referred org's spend.                              |
| `byReferredOrg[].commissionCents` | body | integer (int64)                | —      | 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 (int64)                | —      | MarginBps is the platform gross-margin fraction commission is a rate OF.                                                                          |
| `paidCents`                       | body | integer (int64)                | —      | PaidCents is lifetime commission already paid out, in cents.                                                                                      |
| `pendingCents`                    | body | integer (int64)                | —      | PendingCents is accrued minus paid — what the platform still owes.                                                                                |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo affiliate me earnings
```

**SDK**

**.ts**

```ts
import { Configuration, AffiliateApi } from 'hanzoai';

const api = new AffiliateApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAffiliateMeEarnings();
```

**.py**

```python
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()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AffiliateAPI.GetAffiliateMeEarnings(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
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_me_earnings(&cfg, Default::default()).await?;
```

**.java**

```java
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).getAffiliateMeEarnings();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/affiliate/me/earnings \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

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:

```bash
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"
         }
       }
     }'
```

---

[Affiliate API](https://docs.hanzo.ai/docs/openapi/affiliate) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
