Reporting — Sales (GraphQL)
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 query | statsAdminReportingSales |
| View Details query | viewStatsAdminReportingSales |
| Endpoint | POST /api/admin/graphql |
| Returns | A single object: { 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 queries, one per panel, and each is selected with the type argument. 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, query statsAdminReportingSales 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.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
type | String | No | One of the ten values above. Defaults to total-sales. |
start | String (YYYY-MM-DD) | No | Lower bound of the reporting window. Defaults to 30 days ago. |
end | String (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.
Selection set
query AdminReportingSales($type: String, $start: String, $end: String, $channel: String) {
statsAdminReportingSales(type: $type, start: $start, end: $end, channel: $channel) {
entity
type
dateRange
statistics
}
}entity— always"sales"for this query.type— echoes back the requested panel.dateRange— an object{ previous, current }with a human-readable label for each window. This resolves correctly over GraphQL for the reporting queries.statistics— a JSON scalar whose shape depends ontype(documented below). Query it bare — it is a scalar, not a sub-selectable object.
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 (viewStatsAdminReportingSales) 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
viewStatsAdminReportingSales is the detailed table form of the matching statsAdminReportingSales query — its statistics carries columns ({ key, label }) and records (the row data behind a panel's View Details link), rather than the rolled-up headline figures.
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 arguments as the stats query. (The purchase-funnel type is chart-only and has no table form.)
The CSV Export is REST only (a binary text/csv download); there is no GraphQL equivalent — see Reporting — Sales (REST).
Errors
| Condition | Result |
|---|---|
| Missing / invalid Bearer token | 401 Unauthenticated |
See also
- Reporting — Sales (REST) — same data; also offers the CSV export.
- Reporting Overview — the customer and product report queries.

