# Create click

URL: https://docs.hanzo.ai/docs/openapi/affiliate/post-affiliate-click

> Counts a click on a share link.

`POST /v1/affiliate/click`

> [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/click` |
| **Method**    | `POST`                                    |
| **Operation** | `post_affiliate_click`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`    |

Counts a click on a share link. PUBLIC — it takes no principal, because
a visitor clicking a shareable link has no session yet.

The ping folds into an in-memory buffer and NEVER writes the money database
synchronously, so a click flood cannot contend with the accrual and payout
write path; tallies are flushed in one batch on the next authenticated links
read and at shutdown. Clicks are a vanity metric: no accrual and no payout
ever reads them — those key on real metered spend — so click inflation cannot
move money.

Any well-formed code is accepted WITHOUT checking that it exists,
deliberately: this is not a code-existence oracle. `counted` reports that the
buffer took the ping, not that the code is real; an unknown code simply no-ops
at flush time.

## Request

1 field, body `application/json` (required).

| Field  | In   | Type   | Required | Description                                   |
| ------ | ---- | ------ | -------- | --------------------------------------------- |
| `code` | body | string | —        | Code is the share-link code that was clicked. |

## Response

| Status    | Body                 | Meaning |
| --------- | -------------------- | ------- |
| `200`     | affiliate.clickCount | ok      |
| `default` | problem-details      | refused |

`200` body — 1 field.

| Field     | In   | Type    | Always | Description                                      |
| --------- | ---- | ------- | ------ | ------------------------------------------------ |
| `counted` | body | boolean | —      | Counted says the in-memory buffer took the ping. |

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

## Examples

**CLI**

```bash
hanzo affiliate click
```

**SDK**

**.ts**

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

const api = new AffiliateApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAffiliateClick({ code: "<code>" });
```

**.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).post_affiliate_click(code="<code>")
```

**.go**

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

resp, _, err := client.AffiliateAPI.PostAffiliateClick(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::post_affiliate_click(&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).postAffiliateClick();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/affiliate/click \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "code": "<code>"
     }'
```

**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)
