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

Busiest day and hour, and what changed

gethttps://api.nsin.ir/analytics/traffic-highlights

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

The window's busiest Asia/Tehran day and busiest UTC hour (each with the hostname that carried most of it), and what changed: up to 5 hosts and files whose billable bytes per day moved the most between "now" — the last N full days of the window — and "before", the N days right before them, N = min(7, max(1, days / 2)). A change is listed when it is at least 1 GB (1024³ bytes) a day and at least 20% of the domain's daily average over both periods, biggest move first. Hosts come from the traffic rollups; files from the files sketch, and are left out while it does not cover both periods. today has no full day, so no changes.

Requires analytics.view on the domain and a plan with the monitoring feature. Cached like traffic-trend.

Query parameters

  • domainstringrequiredquery

    The domain name (for example example.com). These endpoints take the domain as a query parameter rather than a path segment.

  • rangestringquery

    The window, in whole Asia/Tehran days (UTC+03:30), ending today: today is today so far, 7d today and the 6 days before it, 30d and 90d likewise. custom takes from and to. The window is [Tehran midnight of the first day, min(Tehran midnight after the last day, now)) — a Tehran day starts at 20:30 UTC the evening before.

    One of: "today" "7d" "30d" "90d" "custom"
    Default: "7d"
  • fromstring (date)query

    First day of a range=custom window, inclusive: the Gregorian date of an Asia/Tehran calendar day. At most 400 days before today; the window spans at most 400 days. Refused with any other range.

  • tostring (date)query

    Last day of a range=custom window, inclusive (a Tehran calendar day, YYYY-MM-DD). Not before from, not after today. When it is today the window ends now.

  • hostnamestringquery

    Narrow to one hostname of the domain, as the hostname values these endpoints return (host keys, a file's record) — for example *.example.com for a wildcard record. Matched exactly, ignoring case; unlike HostnameFilter it does not match subdomains.

Responses

200Peaks and changes.

Content type: application/json

  • windowTrafficWindowrequired

    The window the answer covers, [from, to): whole Asia/Tehran days. from is the Tehran midnight that starts the first day (20:30 UTC the evening before); to is the Tehran midnight after the last day, or now when the last day is today.

    Fields
    • fromstring (date-time)required
    • tostring (date-time)required
    • tzstringrequired
      One of: "Asia/Tehran"
    • daysintegerrequired

      Tehran days in the window, a partial today included.

    • granularitystringrequired

      The bucket size the answer uses. On traffic-trend this is the granularity actually drawn (see its granularity parameter); on the other endpoints it is what auto would pick.

      One of: "hour" "day"
    • partial_lastbooleanrequired

      The last day is today, so to is now and the last bucket is still filling.

  • peak_dayTrafficPeakDay | nullrequired

    The Tehran day with the most bytes; null when the window carried none.

    Fields
    • Option 1TrafficPeakDay
      Fields
      • tstring (date-time)required

        Start of the Tehran day (UTC).

      • bytesintegerrequired

        Billable bytes that day.

      • requestsintegerrequired
      • top_hoststringrequired

        The hostname with the most bytes that day.

      • top_host_bytesintegerrequired
    • Option 2null
  • peak_hourTrafficPeakHour | nullrequired

    The UTC hour with the most bytes (whole hours of the window, plus the current one); null when none carried any.

    Fields
    • Option 1TrafficPeakHour
      Fields
      • tstring (date-time)required

        Start of the UTC hour.

      • bytesintegerrequired

        Billable bytes in that hour.

      • requestsintegerrequired
      • avg_mbpsnumberrequired

        The hour's average rate: bytes × 8 / 3600 / 10⁶, one decimal.

      • top_hoststringrequired

        The hostname with the most bytes in that hour.

      • top_host_bytesintegerrequired
    • Option 2null
  • changesarray of TrafficChangerequired

    Biggest move first. Empty when nothing moved enough, or the window has no full day.

    Item fields
    • kindstringrequired
      One of: "host" "file"
    • hoststringrequired

      The hostname — for a file under a wildcard record, the real host it was requested on (the record itself when that is unknown).

    • recordstringrequired

      The hostname value the traffic is logged under (a wildcard record: *.example.com).

    • pathstringrequired

      A file's path, without query string; empty for a host.

    • bytes_per_day_nowintegerrequired

      Average billable bytes per day over "now". Files are sketch estimates.

    • bytes_per_day_beforeintegerrequired

      The same over "before".

    • delta_per_dayintegerrequired

      bytes_per_day_now − bytes_per_day_before; negative for a decrease.

    • share_nownumberrequired

      The item's share of the domain's bytes over "now", a fraction 0–1.

    • first_seenstring | null (date-time)required

      For an increase, the first UTC hour (looking back up to 35 days for a file, 90 for a host) whose bytes reached 10% of the item's average hourly bytes over "now". null for a decrease.

json
{
  "window": {
    "from": "2026-09-21T20:30:00Z",
    "to": "2026-09-28T14:20:00Z",
    "tz": "Asia/Tehran",
    "days": 0,
    "granularity": "hour",
    "partial_last": true
  },
  "peak_day": {
    "t": "2026-01-01T00:00:00Z",
    "bytes": 0,
    "requests": 0,
    "top_host": "string",
    "top_host_bytes": 0
  },
  "peak_hour": {
    "t": "2026-01-01T00:00:00Z",
    "bytes": 0,
    "requests": 0,
    "avg_mbps": 0,
    "top_host": "string",
    "top_host_bytes": 0
  },
  "changes": [
    {
      "kind": "host",
      "host": "string",
      "record": "string",
      "path": "string",
      "bytes_per_day_now": 0,
      "bytes_per_day_before": 0,
      "delta_per_day": 0,
      "share_now": 0,
      "first_seen": "2026-01-01T00:00:00Z"
    }
  ]
}
400The domain query parameter is missing, or another parameter is not valid: an unknown range, from/to without range=custom (or missing with it), a date that is not YYYY-MM-DD, to before from or after today, a custom window over 400 days or starting more than 400 days ago, granularity=hour on a window over 7 days, an unknown split, compare, dim, or a limit out of range.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "range must be today, 7d, 30d, 90d or custom"
}
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"
}
402The domain has no active plan at all, so no plan feature is available on it. Buy or renew a plan for the domain. (A plan that is active but does not include the feature answers 403 instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "This domain does not have an active plan."
}
403The domain's plan does not include the feature this endpoint needs (monitoring for most sections, logs for raw and top-N request data).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only 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"
}
504The query ran out of time for this period. Retrying the same request runs the same query again, so ask for a shorter period (or narrow it with hostname/path) instead.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "summary timed out for this period; try a shorter one"
}

Example request

bash
curl -X GET "https://api.nsin.ir/analytics/traffic-highlights?domain=example.com" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc