# Postbacks

How OnStat reports new fans, payments and commissions to your tracker, and how to set it up.

Source: https://onstat.io/docs/postbacks (updated 2026-11-20)

## How it works

A postback is a request OnStat makes to your tracker when something happens to a visitor you sent. It takes two links.

1. Campaign link, from your tracker to OnStat. Your tracker sends the visitor to it and adds its click ID.
2. Postback URL, from OnStat to your tracker. OnStat calls it and gives that click ID back with a status and an amount.

OnStat keeps a click ID for 90 days. Events of an older click are not sent.

## 1. Put the campaign link into your tracker

1. In OnStat, open your campaign and copy `Link for your tracker`. It ends with the click ID parameter, usually `subid={subid}`.
2. Paste it into your tracker as the URL of the offer.
3. `{subid}` is how Keitaro writes its click ID. In another tracker, put that tracker's click ID macro there, for example `subid={clickid}`.

Keep the name before the `=` as copied: the campaign reads the click ID from it. A click that arrives without a click ID gives OnStat nothing to send back, and its postbacks fail.

## 2. Choose the integration

| Integration | Use it when | What you paste |
| --- | --- | --- |
| Keitaro | Your tracker is Keitaro. | The address up to `/postback`. OnStat adds the parameters itself. See [Connect Keitaro](/docs/keitaro). |
| Postback URL | You use another tracker or your own endpoint. | The whole URL, with OnStat macros where the values go. |

After you create the integration, open the campaign, go to its Integrations tab and add it. An integration sends nothing until a campaign uses it.

## 3. Write the postback URL

Copy the postback URL your tracker shows. It has the tracker's parameter names and a placeholder for each value, such as `REPLACE` or `{clickid}`. Keep the names and put an OnStat macro in place of each placeholder.

Your tracker shows:

```
https://your-domain.com/postback?cid=REPLACE&payout=REPLACE&txid=REPLACE
```

You paste into OnStat:

```
https://your-domain.com/postback?cid={click_id}&payout={payout}&txid={transaction_id}
```

- OnStat replaces every macro and adds nothing else. A parameter with a fixed value, such as `currency=usd`, is sent as written.
- A macro goes after the `=` of a parameter. It cannot be part of the domain, the path or a parameter name.
- A macro OnStat does not fill, such as `{subid}` or `{sum}`, is refused when you save.
- Both `https://` and `http://` work. Over `http://` the key in the URL travels unprotected, so use `https://` when your tracker has a domain with a certificate. A Bearer token is only sent to an `https://` address.
- The request is a GET. OnStat does not follow redirects and only calls addresses on the public internet.
- A URL with no macros at all still works: OnStat then adds its own parameters (`subid`, `event`, `event_type`, `event_id`, `revision`, `occurred_at`, and amounts when the event has them). That suits an endpoint you wrote yourself, not a tracker.

## Macros

| Macro | What OnStat puts there | Example |
| --- | --- | --- |
| `{click_id}` | The click ID your tracker put on the campaign link, unchanged. | `2k9f0q1c7x` |
| `{status}` | lead, sale or rejected. | `sale` |
| `{payout}` | The amount of this event in US dollars. For a commission, the part that is ready. 0.00 when there is no amount, so it is always a number. | `25.50` |
| `{currency}` | Always USD. | `USD` |
| `{transaction_id}` | One ID per conversion. It stays the same when a commission moves from lead to sale or rejected, and is new for every payment. | `affiliate:optimization:9c1e…:1` |
| `{event_type}` | What happened in OnStat: click, qualified_subscription, purchase, or commission.held, commission.available, commission.corrected, commission.reversed. | `purchase` |
| `{event_id}` | The ID of the event in OnStat. | `9c1e…` |
| `{revision}` | A number that grows each time OnStat sends a newer version of the same event. | `1` |
| `{occurred_at}` | When it happened, in UTC. | `2026-11-19T18:02:25+00:00` |
| `{value}` | The amount of a click, subscription or payment, as set under What it sends. Empty when it has none, and on commissions. | `25.50` |

The next ones describe a commission. They are filled when the integration sends commissions and are empty on every other event.

| Macro | What OnStat puts there | Example |
| --- | --- | --- |
| `{state}` | held, available, partially_available or reversed. | `held` |
| `{component}` | cpa or revshare. | `revshare` |
| `{amount}` | The whole commission. | `10.00` |
| `{delta_amount}` | How much the whole commission changed in this update. | `5.00` |
| `{held_amount}` | The part still on hold. | `5.00` |
| `{eligible_amount}` | The part ready for payout or already paid. | `5.00` |
| `{delta_held_amount}` | How much the part on hold changed in this update. | `-5.00` |
| `{delta_eligible_amount}` | How much the ready part changed in this update. | `5.00` |

## Ready URLs for common trackers

Replace the domain and the key with your own. Parameter names can differ between tracker versions, so compare each one with the postback URL your tracker shows.

Keitaro:

```
https://your-domain.com/1a2b3c4/postback?subid={click_id}&status={status}&payout={payout}&tid={transaction_id}&currency=usd
```

Voluum:

```
https://your-domain.com/postback?cid={click_id}&payout={payout}&txid={transaction_id}
```

Binom:

```
https://your-domain.com/click?cnv_id={click_id}&payout={payout}&cnv_status={status}
```

RedTrack:

```
https://your-domain.com/postback?clickid={click_id}&sum={payout}
```

BeMob:

```
https://your-domain.com/postback?cid={click_id}&payout={payout}&txid={transaction_id}&status={status}
```

For Keitaro, the Keitaro integration sends the same request and needs only the address. See [Connect Keitaro](/docs/keitaro).

## What is sent, and when

In the integration, `What it sends` has two modes. An integration uses one of them.

Mode `Fans and payments as they happen`:

| Event | `{event_type}` | `{status}` | `{payout}` |
| --- | --- | --- | --- |
| Someone clicks the link | `click` | `lead` | `0.00`, or the fixed amount you set |
| A fan subscribes | `qualified_subscription` | `lead` | `0.00`, or the fixed amount you set |
| A fan pays | `purchase` | `sale` | The payment amount, the fixed amount you set, or `0.00` |

- Clicks are off until you turn them on. A click is sent with the status `lead`, the same as a subscription; tell them apart by `{event_type}`. The Keitaro integration sends no such field, so there a click and a subscription look the same. Leave clicks off if your tracker would count each one as a conversion.
- Payment amounts are shared only on offers that pay a share of revenue. On an offer that pays per new fan, a payment is sent with `0.00` unless you set a fixed amount.
- Every event here has its own `{transaction_id}`, so each payment is a separate conversion in your tracker.

Mode `Your commission as the agency confirms it`:

| Event | `{event_type}` | `{status}` | `{payout}` |
| --- | --- | --- | --- |
| A commission is earned and on hold | `commission.held` | `lead` | `0.00` |
| A commission is ready | `commission.available` | `sale` | The part that is ready |
| A commission changes | `commission.corrected` | `lead` while on hold, then `sale` | `0.00` while on hold, then the part that is ready |
| A commission is cancelled | `commission.reversed` | `rejected` | `0.00` |

One commission keeps one `{transaction_id}` through all four, so your tracker updates a single conversion from lead to sale or rejected instead of adding new ones.

## Delivered, retried, failed

- Delivered: your tracker answers with a 2xx status. The Keitaro integration also needs the answer `OK`, which Keitaro gives once it has recorded the conversion.
- Retried: no answer within 18 seconds, a network error, or an answer of 408, 425, 429 or 5xx. OnStat tries 6 times in all, over about three minutes.
- Failed at once: any other answer, such as 400, 403 or 404, and a redirect. Nothing changes on a second try, so OnStat does not make one.
- After you fix the cause, open the postback in Sent postbacks and press `Queue retry`.

## Reading Sent postbacks

Sent postbacks lists every postback with its status. Open a failed one to see the reason.

| Reason | What happened | What to do |
| --- | --- | --- |
| OnStat could not build this postback | Nothing was sent. The saved URL has a macro OnStat does not fill or a parameter it adds itself, or the click came without a click ID. | Correct the URL in the integration. If the click has no click ID, fix the campaign link in your tracker. |
| Your tracker received the postback and refused it | The tracker answered with a 4xx status, shown next to the reason. | 404: check the path and the key. 401 or 403: check the key or token. 400: check the parameter names. |
| Your tracker answered, but did not confirm the conversion | Keitaro answered without `OK`. | Open Maintenance, Logs, Postbacks in Keitaro. "Click for subid not found" means the click ID is not from this tracker. |
| Your tracker answered that it could not take the postback right now | A 429 or 5xx answer. OnStat retries. | Nothing, unless it keeps failing: then check that the tracker is up. |
| Your tracker answered with a redirect | OnStat does not follow redirects. | Create a new integration with the final address, usually the same one with `https://`. A saved integration keeps its domain and path. |
| OnStat could not reach your tracker, or it did not answer in time | A network error or no answer in 18 seconds. OnStat retries. | Check the domain and that the tracker answers from the public internet. |
| The address is not a public one | The domain points to a private or local network address. | Use an address that is reachable from the public internet. |

## Test before real traffic

A Postback URL integration has `Send test lead`. It sends one lead with the click ID `onstat-synthetic-no-click` and the extra parameter `onstat_test=true`.

Your tracker does not know that click ID and will say so in its log. That is expected: the test still shows that the address, the key and the parameter names are right. The Keitaro integration has no test send, so its first real fan is the check.

## Limits

- Amounts are in US dollars, with two decimals.
- Click IDs are kept for 90 days.
