The
GET /admin/stats endpoint is available to ADMIN role and above. All other analytics endpoints — /admin/analytics/overview, /admin/analytics/coupons, and /admin/analytics/expenses — require SUPER_ADMIN role.Authentication
All analytics endpoints require:- A valid
sessioncookie (obtained viaPOST /auth/login) - ADMIN role minimum; SUPER_ADMIN for
/admin/analytics/* x-csrf-tokenheader on POST and PATCH requests
Dashboard Statistics
Retrieve high-level KPIs for the platform over a selectable time window. The response summarises total revenue, order count, and total customer count for the selected period.GET /admin/stats
string
default:"7d"
Time window preset. One of
today, 7d, or 30d.200 OK
boolean
Always
true on a successful response.object
P&L Overview
Retrieve a profit-and-loss overview including revenue, cost of goods, and profit trends over a custom date range. Use this to understand margin changes across periods and spot cost anomalies.GET /admin/analytics/overview
string
ISO 8601 datetime with UTC offset. Inclusive lower bound for the report window. Example:
2024-01-01T00:00:00.000Z.string
ISO 8601 datetime with UTC offset. Inclusive upper bound for the report window. Example:
2024-06-30T23:59:59.000Z.200 OK
Coupon Analytics
Retrieve coupon performance analytics including status breakdowns, usage trends over time, top-performing coupon codes, and the total revenue impact of discounts applied. Scoping by date range reports on coupons used within that window.GET /admin/analytics/coupons
string
ISO 8601 datetime with UTC offset. Inclusive lower bound.
string
ISO 8601 datetime with UTC offset. Inclusive upper bound.
200 OK
List Expenses
Retrieve a paginated list of operating expenses, optionally filtered by category and date range. Use this to build a complete picture of outgoings for your P&L calculation.GET /admin/analytics/expenses
integer
default:"1"
Page number (1-based).
integer
default:"20"
Items per page. Minimum 1, maximum 100.
string
Filter by expense category. One of:
RENT, SALARIES, MARKETING, UTILITIES, SHIPPING, SOFTWARE, OTHER.string
ISO 8601 datetime. Filter expenses with
spent_at on or after this date.string
ISO 8601 datetime. Filter expenses with
spent_at on or before this date.200 OK
Create Expense
Record a new operating expense. Requires a description, category, amount, and the date the expense was incurred (spent_at). Use this endpoint to keep your P&L data current by logging all platform-related costs.
POST /admin/analytics/expenses
string
required
Human-readable description of the expense (1–255 characters). Example:
"Office rent - January".string
required
Expense category. One of:
RENT, SALARIES, MARKETING, UTILITIES, SHIPPING, SOFTWARE, OTHER.number
required
Expense amount as a number. Minimum
0.01, maximum 99999999. Example: 1200.50.string
required
ISO 8601 datetime with UTC offset indicating when the expense was incurred. Example:
"2024-01-15T00:00:00.000Z".201 Created
Update and Delete Expenses
Correct or remove an expense entry using its public ID.PATCH /admin/analytics/expenses/{expense_public_id} — Update any combination of description, category, amount, or spent_at. At least one field required.
DELETE /admin/analytics/expenses/{expense_public_id} — Permanently remove the expense record. Returns 204 No Content.
Endpoint Summary
GET /admin/stats
Dashboard KPIs: revenue, order count, customer count. Requires ADMIN role.
GET /admin/analytics/overview
Full P&L overview with revenue, cost, and profit. Requires SUPER_ADMIN.
GET /admin/analytics/coupons
Coupon performance and discount impact analytics. Requires SUPER_ADMIN.
GET /admin/analytics/expenses
List operating expenses with category and date filters. Requires SUPER_ADMIN.
POST /admin/analytics/expenses
Record a new operating expense for P&L tracking. Requires SUPER_ADMIN.
PATCH/DELETE /admin/analytics/expenses/:id
Correct or remove an existing expense record. Requires SUPER_ADMIN.