Skip to content

Analytics

Aggregate figures across both marketplaces. All windows are relative to the server's current time.


Headline figures

GET /api/kpis

Returns the numbers behind the dashboard's KPI tiles: the last 30 days, the 30 days before that, and the change between them. Takes no parameters.

Response

Field Type Description
revenue_30d number Revenue over the last 30 days, before deductions
profit_30d number Net revenue minus the cost of units sold
units_30d integer Units sold
margin_pct number Net revenue as a percentage of revenue
revenue_prev number Revenue over the preceding 30 days
profit_prev number Profit over the preceding 30 days
units_prev integer Units over the preceding 30 days
revenue_delta number | null Percentage change against the preceding period
profit_delta number | null Percentage change against the preceding period
units_delta number | null Percentage change against the preceding period
urgent integer Products flagged as urgent in the reorder list
reorder integer Products flagged as needing a reorder
total_skus integer Products in the catalogue

A delta is null when the preceding period was zero, because a percentage change from zero has no meaningful value.

profit_30d counts any product without a cost price as costing nothing. Before cost prices are entered it equals net revenue.

Example

curl http://localhost:8000/api/kpis
{
  "revenue_30d": 1847200,
  "profit_30d": 412900,
  "units_30d": 1284,
  "margin_pct": 71.4,
  "revenue_prev": 1613800,
  "profit_prev": 358100,
  "units_prev": 1147,
  "revenue_delta": 14.5,
  "profit_delta": 15.3,
  "units_delta": 11.9,
  "urgent": 3,
  "reorder": 11,
  "total_skus": 214
}

Profit over time

Four endpoints share a response shape and differ only in granularity.

Daily

GET /api/profit/daily
Parameter Type Default Description
days integer 30 Lookback window
source string all wb, ozon or all

Response: array, ordered oldest first.

Field Type Description
day date Calendar day
source string wb or ozon
revenue number Before deductions
net_revenue number After commission and logistics
gross_profit number Net revenue minus cost of goods
units_sold integer Units

With source=all, each day appears once per marketplace rather than as a combined total. Summing client-side is intentional: it keeps the per-platform series available for charting.

curl "http://localhost:8000/api/profit/daily?days=7&source=wb"
[
  {"day": "2026-07-21", "source": "wb", "revenue": 61400, "net_revenue": 44100, "gross_profit": 12800, "units_sold": 43},
  {"day": "2026-07-22", "source": "wb", "revenue": 58900, "net_revenue": 42300, "gross_profit": 11900, "units_sold": 41}
]

Weekly

GET /api/profit/weekly
Parameter Type Default Description
weeks integer 12 Lookback window in weeks
source string all wb, ozon or all

Same fields as the daily endpoint, with week_start in place of day.

Monthly

GET /api/profit/monthly

No parameters. Returns at most 24 months, oldest first.

Adds total_cost, the cost of goods for the month, to the standard fields. The date field is month.

Quarterly

GET /api/profit/quarterly

No parameters. Returns at most 20 quarters, oldest first.

Field Type Description
year integer Calendar year
quarter integer 1 to 4
source string wb or ozon
revenue number Before deductions
net_revenue number After deductions
gross_profit number After cost of goods

Note that this endpoint returns no unit count.

Full history

GET /api/profit/alltime
Parameter Type Default Description
source string all wb, ozon or all

Identical to the daily endpoint with no date filter. On an installation with years of history this returns a large array; there is no pagination.


GET /api/trends

Weekly totals per marketplace with the change against the previous week, computed with a window function over the series.

Parameter Type Default Description
weeks integer 16 Lookback window in weeks

Response

Field Type Description
week date Monday of the week
source string wb or ozon
revenue number Weekly revenue
net_revenue number Weekly net revenue
units integer Weekly units
revenue_wow number | null Percentage change against the previous week
units_wow number | null Percentage change against the previous week

The earliest week of each marketplace's series has no predecessor, so both change fields are null there. They are also null where the previous week was zero.


Period comparison

GET /api/comparison

Compares the selected window against the window immediately before it, per marketplace. Requesting 30 days compares the last 30 days with the 30 before those.

Parameter Type Default Description
days integer 30 Size of each window

Response

Field Type Description
source string wb or ozon
revenue number Current window
revenue_prev number Preceding window
revenue_delta number | null Percentage change
net_revenue number Current window
net_revenue_prev number Preceding window
net_delta number | null Percentage change
units integer Current window
units_prev integer Preceding window
units_delta number | null Percentage change
commission number Commission in the current window
logistics number Logistics in the current window

Commission and logistics are reported for the current window only, with no comparison figure.


Seasonality

GET /api/seasonality

Average revenue and units by day of the week over the last 90 days. Takes no parameters, and the 90-day window is fixed.

Field Type Description
dow integer Day of week, 0 for Sunday through 6 for Saturday
dow_name string Abbreviated day name
avg_revenue number Mean revenue for that weekday
avg_units number Mean units for that weekday

Averages are taken across days on which sales occurred. A weekday with no sales in the window is absent from the response rather than present with a zero.


Categories

GET /api/categories

Revenue and profit grouped by product category and marketplace, ordered by profit.

Parameter Type Default Description
days integer 30 Lookback window
Field Type Description
category string Category name, or a placeholder for uncategorised products
source string wb or ozon
units_sold integer Units
revenue number Before deductions
profit number After deductions and cost of goods
skus integer Distinct products in the group

Products without a category are grouped rather than excluded, so these totals reconcile with the finance figures.


Platform comparison

GET /api/platform

One row per marketplace covering the full history, with deductions expressed both in absolute terms and as a share of revenue. Takes no parameters.

Field Type Description
source string wb or ozon
units integer Units sold
revenue number Before deductions
commission number Total commission
logistics number Total logistics cost
net_revenue number After deductions
commission_pct number Commission as a percentage of revenue
logistics_pct number Logistics as a percentage of revenue

The percentage columns are the comparable ones. Absolute figures track sales volume and will always favour whichever platform you sell more on.