Requests over time, for period-over-period comparison
const url = 'https://api.nsin.ir/analytics/requests-compare?granularity=hour';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/requests-compare?granularity=hour' \ --header 'Authorization: Bearer <token>'Request counts in whole-day windows, for charts that overlay one period
on another. Unlike /analytics/requests — which ends now and takes a
period — this window always starts at a local midnight, so every
bucket covers a complete day and days can be compared like for like.
granularity: hourreturns hourly buckets, meant to be drawn as one line per day (hour-by-hour overlay).daysdefaults to 3, max 14.granularity: dayreturns one bucket per day for day-over-day change.daysdefaults to 14, max 35 — the ClickHouse row retention, beyond which no data exists.
Scope is one domain (domain_id), or — by default — every active domain
you can see. The response is the same time-series shape as
/analytics/requests; buckets with no traffic are omitted rather than
zero-filled.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Bucket size. Anything other than day is treated as hour.
Number of whole days to return, counting back from today. Clamped to
the granularity’s maximum. 0 or omitted uses the default.
Numeric domain id — note this endpoint scopes by id, not by the domain name the rest of the API uses. Omit to cover every active domain you can see.
Responses
Section titled “ Responses ”Time series.
object
object
Example generated
{ "data": [ { "timestamp": "2026-04-15T12:00:00Z", "count": 1 } ]}Missing, malformed, revoked or expired API key — or the owning account is inactive.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid 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"}The analytics backend is temporarily unreachable. Retry; no data is lost.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "analytics unavailable"}