Traffic History
Time-bucketed request counts and byte totals across the requested window. Use this to render line/bar charts ("requests per day over the last 30 days"). Each bucket is a snapshot of one period's traffic — buckets don't overlap.
Account scope: traffic is aggregated across the endpoints of your active account. Use switch account to chart a different account's traffic.
Bucket size is selected by the period parameter (hourly / daily / monthly), not an arbitrary interval.
Query parameters
period string
Bucket granularity:
hourly, daily (default), or monthly.days int
Look-back window in days. Default
30, max 365. Sets the window start to now − days.hours int
Only honored when
period=hourly: overrides the window to the last N hours (1–720).Response (200 OK)
period string
Resolved bucket granularity (echo).
days int
Resolved look-back window in days (echo).
data array
Time-ordered buckets. Each:
{time_bucket, total_requests, total_bytes}. time_bucket is the bucket start as an RFC-3339-style string (e.g. 2026-04-29T11:00:00Z).Errors
400 Bad Request
Invalid
period (must be hourly, daily, or monthly).401 Unauthorized
Missing auth.
Request
curl "https://api.ngris.com/v1/traffic/history?period=hourly&hours=12" \
-H "X-API-KEY: <your_api_key>"
Python
from ngris import Ngris
client = Ngris(api_key="<your_api_key>")
hist = client._get_raw("/traffic/history", params={"period": "hourly", "hours": 12})
for b in hist["data"]:
print(f"{b['time_bucket']} {b['total_requests']:>6} req {b['total_bytes']} bytes")
Response — 200 OK
{
"period": "hourly",
"days": 30,
"data": [
{"time_bucket": "2026-04-29T10:00:00Z", "total_requests": 12340, "total_bytes": 8888888},
{"time_bucket": "2026-04-29T11:00:00Z", "total_requests": 13900, "total_bytes": 9691356},
{"time_bucket": "2026-04-29T12:00:00Z", "total_requests": 14200, "total_bytes": 9912221}
]
}