nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Analytics

Account-wide summary

gethttps://api.nsin.ir/analytics/global-summary

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

Headline figures — requests, bandwidth, unique visitors, error rate and cache hit rate — aggregated across every active domain you can access. The peak requests-per-second figure is a separate, on-demand call: GET /analytics/global-summary/peak.

Besides the usual periods, all covers the whole retained history. Answers are cached per account: for 1–10 minutes depending on the period, and for a day with all.

Query parameters

  • periodstringquery

    Time window, ending now — the values of the shared period parameter, plus all for the whole retained history. An unrecognised value falls back to 24h.

    One of: "1h" "3h" "6h" "12h" "24h" "48h" "7d" "30d" "all"
    Default: "24h"

Responses

200Account-wide totals.

Content type: application/json

  • total_requestsinteger
  • total_bandwidthinteger

    Bytes.

  • unique_visitorsinteger
  • error_ratenumber

    Share of requests that failed, 0–1.

  • cache_hit_ratenumber

    Share of cacheable requests served from cache, 0–1.

  • domainsinteger

    How many domains contributed.

json
{
  "total_requests": 0,
  "total_bandwidth": 0,
  "unique_visitors": 0,
  "error_rate": 0,
  "cache_hit_rate": 0,
  "domains": 0
}
401Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "invalid API key"
}
429The key exceeded its request budget (300 requests per minute by default).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "rate limit exceeded"
}
503Either the analytics backend is temporarily unreachable (retry; no data is lost), or the answer is still being computed. The per-domain sections and the cached account-wide views (domains-overview, global-summary, global-summary/peak, requests-compare, bandwidth-overview, nodes-overview) wait at most about 25 seconds for their query; past that they answer 503 with pending: true and a Retry-After header, while the query keeps running and caches its result, so the retry is served from that cache instead of starting the same scan again. Identical concurrent requests share one computation.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

  • pendingboolean

    true when the query is still running rather than failing. Retry after Retry-After seconds.

json
{
  "error": "analytics unavailable"
}

Example request

bash
curl -X GET "https://api.nsin.ir/analytics/global-summary" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc