Skip to Content
Docs

Stats and forecast

Read revenue, conversions, clicks, EPC, AOV and CR with the API. Compare periods, get the top items of a grouping, and get a revenue forecast.

The stats API answers from the conversions and the clicks of your workspace. All amounts are in the currency of your workspace, or in the currency that you send. The API converts each sale with the ECB rate of its sale day.

Three endpoints give the numbers. They all need the scope stats:read. A test key reads only test data.

EndpointUse
GET /v1/statsTotals and rows of conversions, with the optional comparison of periods.
GET /v1/stats/topThe best items of one grouping, with share and change.
GET /v1/stats/forecastThe projected revenue, the years and the months.

The metrics

MetricMeaning
revenueThe sum of the commissions.
conversionsThe number of conversions.
clicksThe number of human clicks of the redirector. Bots are not counted.
order_amountThe sum of the order amounts.
epcEarnings per click: revenue / clicks.
aovAverage order value: order_amount / conversions.
crConversion rate: conversions / clicks. It is a ratio: 0.05 is 5 percent.

A ratio is null when its divisor is 0. Clicks have no site and no status, so clicks, epc and cr are null for the grouping by site and for a request with the filter site or status.

GET /v1/stats calls the revenue commission. It counts all statuses. GET /v1/stats/top and GET /v1/stats/forecast do not count rejected conversions.

Compare with an earlier period

Add compare=previous_period to GET /v1/stats. The response then has comparison: the totals and the rows of the period of the same length that ends just before date[gte], and the change of each total in percent.

curl -g "https://api.afffast.com/v1/stats?date[gte]=2026-11-01&date[lte]=2026-11-30&group_by=day&compare=previous_period" \
  -H "Authorization: Bearer $AFFFAST_API_KEY"

Use compare_from and compare_to for another period, for example the same month of the year before. Do not use them with compare.

  • A range of whole days gives a range of the same number of days.
  • A change is (current - previous) / previous * 100, rounded to 2 decimals. It is null when the previous value is 0.
  • comparison.rows has the same grouping as rows. With group_by=day, the row of the same position is the same point of the other period.
  • A CSV file has only the current period.

Top items

GET /v1/stats/top groups by network, program, brand, site, country or device, and sorts by metric (the default is revenue). It gives the limit best items (the default is 5, the most is 50) and one other row that adds up the rest. The items and other give the total.

curl -g "https://api.afffast.com/v1/stats/top?group_by=program&metric=revenue&limit=5&date[gte]=2026-11-01&date[lte]=2026-11-30&compare=previous_period" \
  -H "Authorization: Bearer $AFFFAST_API_KEY"

Each item has the metrics, its share of the total of the chosen metric, and, with compare, previous and change. The share is null for epc, aov and cr, because a ratio has no total to share. The other row calculates its ratios from its own sums.

Forecast

GET /v1/stats/forecast gives the projected revenue for the rest of the current month and year, the revenue of each year with its growth, and each month against the average of its year.

The method is simple. It is an estimate and not a promise.

  1. The run rate is the average revenue of each of the last 28 complete days. The projection of the rest of a month is the run rate times the days that remain.
  2. With 12 complete months of history or more, the forecast also uses the seasonality of the months. The seasonal index of a calendar month is its average revenue divided by the average revenue of all complete months. The level is the average of the last 3 complete months, each divided by its index. A future month is the level times its index.

method shows which method the response used: run_rate or seasonal.

projected_months gives the projected revenue of each month from the current month to December, so a chart can follow the season. The current month has the revenue until now plus the projected rest. A later month is the level times its index (seasonal), or the run rate times its days (run_rate).

In months, index is the revenue of a month divided by the average month of its year. The value 1 is an average month. Use it for a heatmap. The current month has no index, because it is not complete.

curl "https://api.afffast.com/v1/stats/forecast" \
  -H "Authorization: Bearer $AFFFAST_API_KEY"

On this page