Skip to content

Statistics API

The statistics calls feed the charts and totals of the admin dashboard. See The dashboard. Daily series are lists of [time, value] pairs, where time is a Unix timestamp in milliseconds (the chart format), one pair per day from the day after date_from to the day before date_to. Money is in the default currency.

Admin calls need Module access on the Stats card of the staff group’s Permissions tab, plus each call’s own permission below (Super Administrators have all). See Authentication.

POST /api/admin/stats/get_summary

Counts new clients, orders, invoices and tickets: in total, today, yesterday, this month and last month.

Permission: View statistics (stats.view)

No parameters.

Returns: clients_total, clients_today, clients_yesterday, clients_this_month, clients_last_month, and the same five for orders_, invoices_ and tickets_.

Example

Request parameters:

{}

result:

{
"clients_total": 85,
"clients_today": 1,
"clients_yesterday": 0,
"clients_this_month": 6,
"clients_last_month": 9,
"orders_total": 140,
"orders_today": 2,
"orders_yesterday": 1,
"orders_this_month": 11,
"orders_last_month": 14,
"invoices_total": 610,
"invoices_today": 3,
"invoices_yesterday": 4,
"invoices_this_month": 52,
"invoices_last_month": 61,
"tickets_total": 230,
"tickets_today": 0,
"tickets_yesterday": 2,
"tickets_this_month": 18,
"tickets_last_month": 20
}

POST /api/admin/stats/get_summary_income

Income of issued paid and refunded invoices, net of refunds: in total, today, yesterday, this month and last month (by payment date).

Permission: View statistics (stats.view)

No parameters.

Returns: total, today, yesterday, this_month, last_month, in the default currency.

POST /api/admin/stats/get_orders_statuses

Counts orders by status (main orders only, not add-ons in a group).

Permission: View statistics (stats.view)

No parameters.

Returns: pending_setup, failed_setup, failed_renew, active, suspended, canceled: the number of orders in each.

POST /api/admin/stats/get_product_summary

Lists products by their number of active orders, most first.

Permission: View statistics (stats.view)

No parameters.

Returns: A list of {id, title, orders}.

POST /api/admin/stats/get_product_sales

Counts the active orders created in a period, by product.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: An object of order title => number of orders.

POST /api/admin/stats/get_income_vs_refunds

All-time income and refunds of issued paid and refunded invoices.

Permission: View statistics (stats.view)

No parameters.

Returns: {refund, income} in the default currency.

POST /api/admin/stats/get_refunds

Refunds per day for a chart, by the refunded invoices’ issue date.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: One [time in milliseconds, amount] pair per day, from the first day to the last.

POST /api/admin/stats/get_income

Income per day for a chart, net of refunds, by payment date of paid invoices.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: One [time in milliseconds, amount] pair per day, from the first day to the last.

Example

Request parameters:

{
"date_from": "2026-11-01",
"date_to": "2026-11-05"
}

result:

[
[
1793491200000,
120.5
],
[
1793577600000,
0
],
[
1793664000000,
48
],
[
1793750400000,
0
],
[
1793836800000,
15
]
]

POST /api/admin/stats/get_orders

New orders per day, for a chart.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: One [time in milliseconds, count] pair per day, from the first day to the last.

POST /api/admin/stats/get_clients

New clients per day, for a chart.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: One [time in milliseconds, count] pair per day, from the first day to the last.

POST /api/admin/stats/client_countries

The countries with the most clients.

Permission: View statistics (stats.view)

Parameter Type Description
limit integer How many countries. Default 10.

Returns: An object of country code => number of clients, most first.

Example

Request parameters:

{
"limit": 2
}

result:

{
"US": 40,
"GB": 12
}

POST /api/admin/stats/sales_countries

The buyer countries with the most paid invoices.

Permission: View statistics (stats.view)

Parameter Type Description
limit integer How many countries. Default 10.

Returns: An object of country code => number of paid invoices, most first.

POST /api/admin/stats/get_invoices

New invoices per day, for a chart.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: One [time in milliseconds, count] pair per day, from the first day to the last.

POST /api/admin/stats/get_tickets

New support tickets per day, for a chart.

Permission: View statistics (stats.view)

Parameter Type Description
date_from string First day. Default: the day after the same date last month.
date_to string Last day, counted whole. Default: today.

Returns: One [time in milliseconds, count] pair per day, from the first day to the last.