Analytics
Revenue summaries, order volumes, top-selling products, and invoice collection rates — all scoped to your tenant and calculated server-side for a given date window.
Revenue summary
bash
GET /v1/slate/analytics?days=30| Name | Type | Required | Description |
|---|---|---|---|
| days | integer | No | Lookback window in days (1–365). Defaults to 30. |
json
{
"data": {
"period_days": 30,
"since": "2025-05-02T00:00:00Z",
"orders": {
"total": 1284,
"revenue": 14230.50,
"tax_collected": 1293.68,
"average_order_value": 11.08,
"by_payment_method": {
"card": 1089,
"cash": 195
},
"by_source": {
"terminal": 870,
"register": 312,
"self_checkout": 102
}
},
"invoices": {
"total": 23,
"by_status": {
"paid": 17,
"sent": 4,
"overdue": 2
},
"revenue_collected": 8740.00
},
"top_products": [
{ "name": "Flat White", "qty": 386, "revenue": 2123.00 },
{ "name": "Oat Latte", "qty": 241, "revenue": 1446.00 },
{ "name": "Banana Bread", "qty": 198, "revenue": 1386.00 }
]
}
}Building a dashboard
Combine the analytics endpoint with the orders and invoices list endpoints to build a full business overview. Common patterns:
typescript
// Daily sales report
const today = await fetch('/v1/slate/analytics?days=1').then(r => r.json())
const yesterday = await fetch('/v1/slate/analytics?days=2').then(r => r.json())
const growth = (
(today.data.orders.revenue - yesterday.data.orders.revenue)
/ yesterday.data.orders.revenue * 100
).toFixed(1)
console.log(`Today: $${today.data.orders.revenue} (${growth}% vs yesterday)`)Tip:For real-time sales dashboards, combine the analytics endpoint (for totals) with a webhook subscription to
slate.order.created events to update counts incrementally without polling.