get_historical_stats
Retrieve time-bucketed UniFi network stats for APs, users, or sites, choosing 5-minute, hourly, or daily intervals and metrics like client count and traffic.
Instructions
Get bucketed historical statistics from the Classic REST /stat/report endpoint.
host: console name, ID, or composite ID (MAC:numericId format). site: site name or ID. interval: one of "5minutes", "hourly", "daily". scope: one of "ap", "user", "site". The "ap" scope carries num_sta per AP per bucket. start/end: epoch SECONDS (UTC). Unlike /stat/session, this endpoint requires MILLISECONDS — the tool converts seconds to milliseconds internally, so callers always pass seconds for a consistent interface. attrs: metrics to aggregate; defaults to num_sta, rx_bytes, tx_bytes.
Retention differs by interval: 5minutes ~1 day, hourly ~7 days, daily ~91 days. Output "time" is epoch milliseconds. Note: rx_bytes/tx_bytes come back as JSON floats in scientific notation (e.g. 5.27e9) — treat them as floats, not ints.
The response is passed through verbatim.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | ||
| host | Yes | ||
| site | Yes | ||
| attrs | No | ||
| scope | Yes | ||
| start | Yes | ||
| interval | Yes |