Sales over time, by store, compared with the period before
GET
/api/v1/workspaces/{workspaceId}/analytics/sales
const url = 'https://api.crossmart.io/api/v1/workspaces/example/analytics/sales?range=last_30_days&timeZone=America%2FNew_York';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.crossmart.io/api/v1/workspaces/example/analytics/sales?range=last_30_days&timeZone=America%2FNew_York'Order totals in the workspace currency, bucketed in the given time zone. Cancelled orders and orders in other currencies are left out.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspaceId
required
string
Query Parameters
Section titled “Query Parameters”range
string
timeZone
string
Example
America/New_YorkIANA time zone that days, weeks and months follow. Defaults to the workspace’s time zone, else UTC.
Responses
Section titled “Responses”Media typeapplication/json
object
range
required
string
interval
required
string
timeZone
required
string
currencyCode
required
The workspace currency; amounts are in it
string
current
required
object
sales
required
Order totals, cancelled orders left out
string
orders
required
number
units
required
Units ordered
number
averageOrderValue
required
Sales per order
string
previous
required
The period of the same length before
object
sales
required
Order totals, cancelled orders left out
string
orders
required
number
units
required
Units ordered
number
averageOrderValue
required
Sales per order
string
buckets
required
Array<object>
object
startsOn
required
First day of the bucket, in the time zone
string
sales
required
string
orders
required
number
previousStartsOn
required
First day of the matching earlier bucket
string
previousSales
required
string
byConnection
required
Stores with orders in the bucket
Array<object>
object
connectionId
required
string format: uuid
sales
required
string
orders
required
number
stores
required
Every store, oldest first
Array<object>
object
connectionId
required
string format: uuid
sales
required
string
orders
required
number
channel
required
string
displayName
required
string
topProducts
required
Array<object>
object
productId
required
string format: uuid
title
required
string
units
required
number
sales
required
Line prices times units
string
otherCurrencyOrders
required
Orders in other currencies, which the report leaves out
number
Example
{ "range": "last_7_days", "interval": "day", "timeZone": "America/New_York", "currencyCode": "USD", "current": { "sales": "1290.00", "averageOrderValue": "43.00" }, "previous": { "sales": "1290.00", "averageOrderValue": "43.00" }, "buckets": [ { "startsOn": "2026-11-04", "sales": "120.00", "previousStartsOn": "2026-10-05", "previousSales": "80.00", "byConnection": [ { "sales": "120.00" } ] } ], "stores": [ { "sales": "120.00", "channel": "shopify", "displayName": "Demo Store" } ], "topProducts": [ { "sales": "240.00" } ]}