# List referral

URL: https://docs.hanzo.ai/docs/openapi/referral/get-referral

> Returns the caller's referral code, share link and the referrals they have made.

`GET /v1/referral`

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

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/referral`     |
| **Method**    | `GET`                                  |
| **Operation** | `get_referral`                         |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Returns the caller's referral code, share link and the referrals they have made.

The code is a stable, deterministic function of the org, so the link in this
response is the same one every time. Each row carries the referee and the status
of that attribution.

IT IS A PURE READ. It advances no referral, grants nothing and deposits nothing
— a GET reports state, it never changes it. Qualification is the admin sweep's
job (POST /v1/admin/referral/sweep). The one row this handler can write is the
caller's OWN code-directory entry (EnsureCode), which materialises a value
deriveCode already computes deterministically from the org id so the code has an
O(1) reverse lookup; it carries no money, no referral state and no other tenant.

## Request

`GET /v1/referral` takes no parameters and no body — the credential is the whole request.

## Response

| Status    | Body                 | Meaning |
| --------- | -------------------- | ------- |
| `200`     | referral.myReferrals | ok      |
| `default` | problem-details      | refused |

`200` body — 12 fields.

| Field                     | In   | Type                       | Always | Description                                                                                                                                       |
| ------------------------- | ---- | -------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`                    | body | string                     | —      | Code is the org's STABLE referral code — a deterministic function of the org id, so it never changes and never has to be stored to be reproduced. |
| `counts`                  | body | referral.statusCounts      | —      |                                                                                                                                                   |
| `counts.qualified`        | body | integer (int64)            | —      | Qualified is how many referees have made metered spend.                                                                                           |
| `counts.signup`           | body | integer (int64)            | —      | Signup is how many referees have signed up but not yet spent.                                                                                     |
| `counts.total`            | body | integer (int64)            | —      | Total is every referral this org has made.                                                                                                        |
| `link`                    | body | string                     | —      | Link is the shareable signup link carrying the code, on the brand's own host.                                                                     |
| `referrals`               | body | referral.myReferralView\[] | —      | Referrals is one row per org that signed up with this code.                                                                                       |
| `referrals[].createdAt`   | body | integer (int64)            | —      | CreatedAt is when the referral was recorded, as a Unix timestamp.                                                                                 |
| `referrals[].id`          | body | string                     | —      | ID is the referral's handle.                                                                                                                      |
| `referrals[].qualifiedAt` | body | integer (int64)            | —      | QualifiedAt is when the referee first made metered spend, as a Unix timestamp; 0 while the referral is still pending.                             |
| `referrals[].referee`     | body | string                     | —      | Referee is the org that signed up with my code.                                                                                                   |
| `referrals[].status`      | body | string                     | —      | Status is the referral's lifecycle state: "signup" until the referee makes metered spend, then "qualified".                                       |

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

## Examples

**CLI**

```bash
hanzo referral get
```

**SDK**

**.ts**

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

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

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ReferralApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ReferralApi(client).get_referral()
```

**.go**

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

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

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, referral_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = referral_api::get_referral(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ReferralApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ReferralApi(client).getReferral();
```

**HTTP**

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

**MCP**

MCP reaches **referral** through the `referral` tool, which names its 2 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_referrals"
         }
       }
     }'
```

---

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