> ## Documentation Index
> Fetch the complete documentation index at: https://docs.affixo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Server-side tracking

> Record clicks and conversions directly from your backend.

The `/v1/track/*` endpoints let your backend report events without relying on
the browser snippet. They require a workspace key with the `track` scope.

## Click

`ref` is required; it identifies the referral link.

```bash theme={null}
curl https://go.affixo.dev/v1/track/click \
  -H "Authorization: Bearer sa_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "ref": "jane", "visitor_id": "v_abc" }'
```

Returns the resolved `visitor_id` plus the identity `match_method` /
`match_confidence`. Persist `visitor_id` so later conversions attribute cleanly.

## Lead & Sale

Report a signup (`lead`) or purchase (`sale`). Provide any identity signal you
have — `visitor_id`, `fingerprint`, `ref`, or `manual_code` — and Affixo
attributes the event using your workspace's precedence rules.

```bash theme={null}
curl https://go.affixo.dev/v1/track/sale \
  -H "Authorization: Bearer sa_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "visitor_id": "v_abc",
    "external_id": "order_1234",
    "amount": 99.00,
    "currency": "usd"
  }'
```

<Note>
  `sale` and `lead` are **idempotent on `external_id`** — safe to retry. When no
  affiliate can be attributed you get `{ "ok": true, "attributed": false }`.
</Note>

## Refund

Reverse a prior conversion by its `external_id`.

```bash theme={null}
curl https://go.affixo.dev/v1/track/refund \
  -H "Authorization: Bearer sa_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "external_id": "order_1234" }'
```

See the [API Reference](/api-reference) for full request/response schemas.
