Skip to content

Requests over time, for period-over-period comparison

GET
/analytics/requests-compare
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: hour returns hourly buckets, meant to be drawn as one line per day (hour-by-hour overlay). days defaults to 3, max 14.
  • granularity: day returns one bucket per day for day-over-day change. days defaults 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.

granularity
string
default: hour
Allowed values: hour day

Bucket size. Anything other than day is treated as hour.

days
integer
>= 1 <= 35

Number of whole days to return, counting back from today. Clamped to the granularity’s maximum. 0 or omitted uses the default.

domain_id
integer

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.

Time series.

Media type application/json
object
data
Array<object>
object
timestamp
string format: date-time
count
integer
Example generated
{
"data": [
{
"timestamp": "2026-04-15T12:00:00Z",
"count": 1
}
]
}

Missing, malformed, revoked or expired API key — or the owning account is inactive.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example invalidKey
{
"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.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The key exceeded its request budget (300 requests per minute by default).

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example limited
{
"error": "rate limit exceeded"
}

The analytics backend is temporarily unreachable. Retry; no data is lost.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example unavailable
{
"error": "analytics unavailable"
}