Sales statistics
salesStatistics returns aggregated sales figures, grouped by the dimensions you ask for. One query covers all the usual "sales by ..." reports: by day, month, product, brand, category, country or customer, and combinations of those.
Requires an ADMIN token and the STATISTICS_READ API key permission.
You always provide:
dimensions(1-3) - what to group by. You get one row per unique combination of values.metrics(1-10) - what to aggregate per row.dateRange-fromis inclusive,tois exclusive, based on the order's created time.
Optional: filter (all filters are ANDed), orderBy (the metric must be one you requested) and limit (default 1000, max 5000). Only the fields matching your requested dimensions and metrics are filled in - the rest are null. All monetary metrics are expressed in the currency returned in currency.
By default only non-cancelled order statuses (id >= 0) are included; use filter.orderStatusIds to pick specific ones.
Sales per month
Request:
query salesPerMonth {
salesStatistics(
dimensions: [MONTH]
metrics: [REVENUE_EXCLUDING_TAX, ORDER_COUNT]
dateRange: { from: "2026-01-01T00:00:00Z", to: "2026-04-01T00:00:00Z" }
) {
rows {
month
revenueExcludingTax
orderCount
}
currency {
code
}
truncated
}
}
Response:
{
"data": {
"salesStatistics": {
"rows": [
{ "month": "2026-01", "revenueExcludingTax": 184320.5, "orderCount": 412 },
{ "month": "2026-02", "revenueExcludingTax": 156900.0, "orderCount": 355 },
{ "month": "2026-03", "revenueExcludingTax": 201455.75, "orderCount": 468 }
],
"currency": {
"code": "SEK"
},
"truncated": false
}
}
}
Top selling products
Use orderBy together with limit for a top-N report.
Request:
query topProducts {
salesStatistics(
dimensions: [PRODUCT]
metrics: [QUANTITY, REVENUE_EXCLUDING_TAX]
dateRange: { from: "2026-01-01T00:00:00Z", to: "2026-04-01T00:00:00Z" }
orderBy: { metric: QUANTITY, direction: DESC }
limit: 2
) {
rows {
productId
productName
quantity
revenueExcludingTax
}
currency {
code
}
truncated
}
}
Response:
{
"data": {
"salesStatistics": {
"rows": [
{
"productId": "AVR 135",
"productName": "Pioneer, DV-585A, DVD-spelare",
"quantity": 318,
"revenueExcludingTax": 41453.25
},
{
"productId": "prod124",
"productName": "ClearSip Elegance",
"quantity": 254,
"revenueExcludingTax": 14852.4
}
],
"currency": {
"code": "SEK"
},
"truncated": true
}
}
}
truncated: true means the row limit cut the result off. For a top-N report that is expected; for a full report, narrow dateRange or filter instead of raising limit.
Combining dimensions and filtering
Up to three dimensions can be combined, for example sales per month and country for a couple of brands:
query salesPerMonthAndCountry {
salesStatistics(
dimensions: [MONTH, COUNTRY]
metrics: [REVENUE_INCLUDING_TAX, TAX_AMOUNT, ORDER_COUNT]
dateRange: { from: "2026-01-01T00:00:00Z", to: "2026-04-01T00:00:00Z" }
filter: { brandIds: [12, 15], countryCodes: ["SE", "NO"] }
orderBy: { metric: REVENUE_INCLUDING_TAX, direction: DESC }
) {
rows {
month
countryCode
countryName
revenueIncludingTax
taxAmount
orderCount
}
currency {
code
}
}
}
New customers
CUSTOMER_COUNT counts distinct customers who ordered in a row, and NEW_CUSTOMER_COUNT how many of those registered within the requested dateRange.
query newCustomersPerWeek {
salesStatistics(
dimensions: [WEEK]
metrics: [CUSTOMER_COUNT, NEW_CUSTOMER_COUNT, REVENUE_EXCLUDING_TAX]
dateRange: { from: "2026-01-01T00:00:00Z", to: "2026-04-01T00:00:00Z" }
) {
rows {
week
customerCount
newCustomerCount
revenueExcludingTax
}
currency {
code
}
}
}
When grouping by CATEGORY, only a product's standard category is counted, so quantity and revenue are not split across a product's secondary categories.