This period against the one before it
const url = 'https://api.nsin.ir/analytics/overview-compare?domain=example.com&period=3h';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.nsin.ir/analytics/overview-compare?domain=example.com&period=3h' \ --header 'Authorization: Bearer <token>'Totals for the last period and for the equally long window just
before it, each with its status-code breakdown, plus an hourly
cache-split series spanning both windows. It is everything a
period-over-period overview needs — KPI tiles with deltas, a
“previous period” ghost line, a status-class bar — from one request
and one scan of the request log, instead of calling summary,
cache, status-codes and traffic-by-cache once per window.
Only 3h, 6h, 12h and 24h are accepted; any other period is a
400. The windows are [since, boundary) (previous) and
[boundary, now) (current). Series buckets are clock hours in
Asia/Tehran (UTC+03:30), emitted as UTC instants, oldest first; the
bucket that contains boundary carries traffic from both windows.
Requires analytics.view on the domain and a plan with the
monitoring feature. Answers are cached for 2 minutes (3h, 6h) or
5 minutes (12h, 24h) and shared between identical requests.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”The domain name (for example example.com). These endpoints take the
domain as a query parameter rather than a path segment.
Example
example.comLength of each of the two windows. The previous window is the same length, ending where the current one starts.
Narrow to one subdomain. Matches the exact host, any subdomain of it, or
a bare label — so example.com matches api.example.com, and api
matches api.example.com, but exam matches neither.
Narrow to a URL path prefix.
Responses
Section titled “ Responses ”Both windows’ totals and the combined series.
object
The window length that was asked for.
Start of the previous window (UTC) — now − 2 × period.
Start of the current window and end of the previous one (UTC) — now − period.
One window’s totals in /analytics/overview-compare.
object
Requests served in the window.
Egress bytes sent to visitors in the window.
Requests with cache status hit.
Requests with cache status miss.
Requests with cache status bypass.
Requests per HTTP status code, busiest first (ties by code).
object
One window’s totals in /analytics/overview-compare.
object
Requests served in the window.
Egress bytes sent to visitors in the window.
Requests with cache status hit.
Requests with cache status miss.
Requests with cache status bypass.
Requests per HTTP status code, busiest first (ties by code).
object
Hourly cache split across both windows, oldest first. Buckets are Asia/Tehran clock hours given as UTC instants; hours with no traffic are absent rather than zero.
One time bucket of traffic split by cache status. Bytes are egress to visitors; the request counts are the same buckets counted in requests, which is what a hit ratio should be computed from — hits are small and misses large, so a bytes split understates it.
object
Start of the bucket (UTC).
Egress bytes of responses served from cache (cache status hit).
Egress bytes of responses that missed the cache and came from the origin.
Egress bytes of responses that bypassed the cache.
Requests answered from cache.
Requests that missed the cache and went to the origin.
Requests that bypassed the cache.
Example
{ "period": "3h"}The domain query parameter is missing, or period is not one of the accepted values.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "period must be 3h, 6h, 12h or 24h"}Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}The 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.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "This domain does not have an active plan."}The domain’s plan does not include the feature this endpoint needs
(monitoring for most sections, logs for raw and top-N request data).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}Either 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.
object
Human-readable description of what went wrong.
true when the query is still running rather than
failing. Retry after Retry-After seconds.
Examples
{ "error": "analytics unavailable"}{ "error": "still computing — try again in a few seconds", "pending": true}Headers
Section titled “Headers ”Example
5Seconds to wait before retrying. Sent only with pending.
The 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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "summary timed out for this period; try a shorter one"}