Reporting — Sales
Returns the aggregate statistics that power the Bagisto admin Reporting → Sales screen — total sales, average order value, order counts, the purchase funnel, abandoned carts, refunds, tax and shipping collected, and the top payment methods.
| Stats endpoint | GET /api/admin/reporting/sales |
| View Details endpoint | GET /api/admin/reporting/sales/view |
| Export endpoint | GET /api/admin/reporting/sales/export |
| Returns | A JSON array with a single element: [ { entity, type, dateRange, statistics } ] |
All admin endpoints require an admin Bearer token — see Authentication. Reporting has no permission gate; any authenticated admin can read it.
Understanding type — the Sales report is ten separate calls
This is the most important thing to understand about this API.
The Bagisto admin Sales report is not one response. The page is assembled from ten independent requests, one per panel, and each is selected with the ?type= query parameter. These ten groups are exactly the panels of the admin Sales report screen — no more, no less.
So a single call returns one panel of the report. To render the full screen, call the endpoint once per type (or only for the panels you need). The statistics payload changes shape per type — sometimes an object, sometimes a flat array — so always branch on type when consuming it.
Which type maps to which panel
| Sales report panel (admin) | type | statistics is |
|---|---|---|
| Total Sales chart | total-sales | object (with over_time series) |
| Average Sales chart | average-sales | object (with over_time series) |
| Total Orders chart | total-orders | object (with over_time series) |
| Purchase Funnel | purchase-funnel | object (no series; chart-only) |
| Abandoned Carts | abandoned-carts | object (with a products list) |
| Refunds chart | refunds | object (with over_time series) |
| Tax Collected | tax-collected | object (with top_categories + over_time) |
| Shipping Collected | shipping-collected | object (with top_methods + over_time) |
| Top Payment Methods | top-payment-methods | array |
| Sales By Coupon | sales-by-coupon | array |
total-sales is the default — if you omit ?type=, you get the "Total Sales" panel.
Query parameters
| Param | Type | Required | Description |
|---|---|---|---|
type | enum | No | One of the ten values above. Defaults to total-sales. |
start | date (YYYY-MM-DD) | No | Lower bound of the reporting window. Defaults to 30 days ago. |
end | date (YYYY-MM-DD) | No | Upper bound. Defaults to today. |
channel | string | No | Channel code to scope the figures to a single channel. Defaults to all channels. |
start / end drive both the current figures and the previous baseline used for each progress percentage — the previous period is the same-length window immediately before start.
Response envelope
The endpoint always returns a single-element array: [ { entity, type, dateRange, statistics } ].
entity— always"sales"for this endpoint.type— echoes back the requested panel.dateRange— an object{ previous, current }with a human-readable label for each window (e.g."10 May 2026 - 09 Jun 2026").statistics— an object or array whose shape depends ontype(documented below).
Response shapes by type
Figures with a previous / current / progress shape are period comparisons: current is the chosen window, previous is the preceding window of equal length, and progress is the percentage change (can be negative). The over_time series is split into a previous and a current array, each carrying one bucket per day with { label, total, count }.
total-sales
| Key | Shape | Meaning |
|---|---|---|
sales | { previous, current, formatted_total, progress } | Gross sales for the window. |
over_time | { previous: [{ label, total, count }], current: [...] } | Per-day series for the chart. total is sales, count is order count. |
average-sales
| Key | Shape | Meaning |
|---|---|---|
sales | { previous, current, formatted_total, progress } | Average order value for the window. |
over_time | { previous: [{ label, total, count }], current: [...] } | Per-day series for the chart. |
total-orders
| Key | Shape | Meaning |
|---|---|---|
orders | { previous, current, progress } | Order count for the window (no formatted_total). |
over_time | { previous: [{ label, total, count }], current: [...] } | Per-day series for the chart. |
purchase-funnel
Object only — no over-time series and no table (/view) form.
| Key | Shape | Meaning |
|---|---|---|
visitors | { total, progress } | Store visitors. |
product_visitors | { total, progress } | Visitors who viewed a product. |
carts | { total, progress } | Carts created. |
orders | { total, progress } | Orders placed. |
Each stage carries a single running total plus progress — there is no previous / current split here.
abandoned-carts
| Key | Shape | Meaning |
|---|---|---|
sales | { previous, current, formatted_total, progress } | Value left in abandoned carts. |
carts | { previous, current, progress } | Abandoned-cart count. |
rate | { previous, current, progress } | Abandonment rate (percent). |
products | array of { id, name, count, progress } | Products most often left in abandoned carts. |
refunds
| Key | Shape | Meaning |
|---|---|---|
refunds | { previous, current, formatted_total, progress } | Refunded amount for the window. |
over_time | { previous: [{ label, total, count }], current: [...] } | Per-day series for the chart. |
tax-collected
| Key | Shape | Meaning |
|---|---|---|
tax_collected | { previous, current, formatted_total, progress } | Tax collected for the window. |
top_categories | array of { id, tax_category_id, name, total, progress, formatted_total } | Tax categories ranked by collected amount. |
over_time | { previous: [{ label, total, count }], current: [...] } | Per-day series for the chart. |
shipping-collected
| Key | Shape | Meaning |
|---|---|---|
shipping_collected | { previous, current, formatted_total, progress } | Shipping charges collected for the window. |
top_methods | array of { id, title, total, progress, formatted_total } | Shipping methods ranked by collected amount. |
over_time | { previous: [{ label, total, count }], current: [...] } | Per-day series for the chart. |
top-payment-methods
statistics is an array (one row per payment method, ranked by collected amount). Each row: id, method, method_title, title, total, base_total, progress, formatted_total.
sales-by-coupon
statistics is an array (one row per coupon code used, ranked by discount given). Each row: coupon_code, cart_rule_id, total (orders using the coupon), base_total, base_discount_total, formatted_total, formatted_discount_total, link (admin cart-rule edit URL, null if the rule was deleted), progress, datetime.
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.
The table shape is uniform across every type (columns + records); only the column set and row keys change. It honors the same type, start, end and channel parameters as the stats endpoint. (The purchase-funnel type is chart-only and has no table form.)
Export (CSV)
GET /api/admin/reporting/sales/export streams the same detailed table as a csv, xls or xlsx attachment (the Export button). The header row is built from the column labels, followed by one line per record. Send the Accept header matching the requested format and save the response to a file. It honors the same type, start, end and channel parameters.
?format= accepts csv (the default), xls and xlsx — any other value returns HTTP 422. Send an Accept header matching the format: text/csv, application/vnd.ms-excel or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
Errors
| Condition | HTTP | Body |
|---|---|---|
| Missing / invalid Bearer token | 401 | { "message": "Unauthenticated.", "error": "unauthenticated" } |
Unsupported format on export | 422 | { ... "Unsupported export format." } |
See also
- Reporting — Sales (GraphQL) — same data over the
statsAdminReportingSalesquery. - Reporting Overview — the customer and product report endpoints.

