Traffic by Region
Returns your active account's request and bandwidth totals grouped by client country over the requested window, ordered by request count (descending). Country is derived from the per-request geo lookup; requests with no resolvable country are excluded. Powers the dashboard's geo-distribution widget.
Requires the traffic-inspector read permission on the active account.
Query parameters
days int
Look-back window in days. Defaults to
7. Clamped to the range 1–90; out-of-range or non-numeric values fall back to 7.limit int
Max number of countries to return. Defaults to
20. Clamped to the range 1–100; out-of-range or non-numeric values fall back to 20.Response (200 OK)
regions array<Region>
Per-country totals, ordered by
total_requests descending. Each item has the fields below. Empty array when there is no geo-attributed traffic in the window.days int
The resolved look-back window (echoes the request, after clamping/defaulting).
Region object
country string
Country, as stored in the request's geo info (e.g. an ISO country code or name). Rows with an empty country are excluded.
total_requests int64
Number of requests from that country in the window.
total_bytes int64
Combined bytes in + bytes out for that country, in bytes.
Errors
401 Unauthorized
Missing auth.
403 Forbidden
No active account, not a member, or missing the traffic-inspector read permission.
Request — top 10 countries over 30 days
curl "https://api.ngris.com/v1/traffic/regions?days=30&limit=10" \
-H "X-API-KEY: <your_api_key>"
Python
import requests
r = requests.get(
"https://api.ngris.com/v1/traffic/regions",
params={"days": 30, "limit": 10},
headers={"X-API-KEY": "<your_api_key>"},
).json()
for row in r["regions"]:
print(f"{row['country']:4} {row['total_requests']:>10} req {row['total_bytes']:>14} bytes")
Response — 200 OK
{
"regions": [
{"country": "US", "total_requests": 84210, "total_bytes": 1203948571},
{"country": "DE", "total_requests": 30112, "total_bytes": 488210330},
{"country": "GB", "total_requests": 14098, "total_bytes": 201338812}
],
"days": 30
}