Reports
Tenant report envelope — sales, channels, SKUs, branch performance, app logs
Reports
Eleven GET /api/v1/reports/* routes are mounted, including skus, branch-performance, and app-logs. Live merchant JWT on 2026-09-10: all four probed paths answered 200. Comments that still say those three are 501 are stale.
Every report body is wrapped in:
{
"organization_id": "0rmzqwt5hhaf07r",
"fetched_at": "2026-09-10T14:24:59Z",
"data": {}
}GET /api/v1/analytics/dashboard is not this envelope (range_days / errors sit beside data). Windows are ?days= or ?hours= — integers, clamped, never ISO from/to. ?days=%207 falls back to the default (trim happens, parse does not).
Several sections fail soft to [] with HTTP 200 when a table is missing. Empty can mean "no rows" or "the query failed". Offline-sales columns on SKU / branch-performance are always 0: the auxiliary _logs table the figure came from has no equivalent here; the statement raises 42P01 and degrades.
Mounted
| Endpoint | Window | Live notes |
|---|---|---|
GET /api/v1/reports/sales | days default 30, max 365 | data.appSales / branchSales / dailySales / productSales. Inner keys mix camelCase (appSales) and snake_case |
GET /api/v1/reports/channels | locale only | data.appSales, data.organizations |
GET /api/v1/reports/orders | days default 365, max 730 | Widest sales-like window |
GET /api/v1/reports/inventory | ||
GET /api/v1/reports/customers | ||
GET /api/v1/reports/stagings | optional hours; omit = no lower bound | Max 24×365 |
GET /api/v1/reports/products | ||
GET /api/v1/reports/offers | days default 90, max 3650 | |
GET /api/v1/reports/skus | days default 30, max 365 | Live: data.summary.total_offline_sales_qty is 0 |
GET /api/v1/reports/branch-performance | same | Live: summary.branch_count / window_days |
GET /api/v1/reports/app-logs | pager | Live: data.pagination snake_case (per_page), data.organizationApps camelCase, source: "none" when empty |
Requires read × report (app-logs: app_log). Tenant-scoped.
SKU summary (live empty tenant)
{
"organization_id": "0rmzqwt5hhaf07r",
"fetched_at": "2026-09-10T14:24:59Z",
"data": {
"by_branch": [],
"ranked_skus": [],
"summary": {
"dedup_window_minutes": 15,
"total_offline_sales_qty": 0,
"total_order_qty": 0,
"total_ranked_skus": 0,
"window_days": 7
}
}
}