Reporting — Sales
| Endpoint | Method |
|---|---|
/api/admin/reporting/sales | GET |
/api/admin/reporting/sales/view | GET |
/api/admin/reporting/sales/export | GET |
Query Parameters
| Param | Type | Notes |
|---|---|---|
type | enum | total-sales (default), average-sales, total-orders, purchase-funnel, abandoned-carts, refunds, tax-collected, shipping-collected, top-payment-methods. |
start | date | Start date. |
end | date | End date. |
channel | string | Channel code. |
Helper-method output
statistics payload is the raw helper aggregate keyed to the chosen type.
View Details
GET /api/admin/reporting/sales/view returns the same statistics as the summary stats endpoint, but in a detailed table form — the full list that sits behind a panel's View Details link. The statistics object carries:
columns— an ordered list of{ key, label }describing each table column.records— the row data, each keyed by the columnkeyvalues.
This is the expanded, row-by-row view; the summary stats endpoint returns the rolled-up headline figures instead.
Export (CSV)
GET /api/admin/reporting/sales/export streams the same detailed table as a text/csv attachment (the Export button). The header row is built from the column labels, followed by one line per record. Send Accept: text/csv and save the response to a file.
Only ?format=csv is accepted — any other format value returns HTTP 422.
Both View Details and Export require only authentication; reporting has no permission gate.

