Skip to content
nsin docs

Raw request logs

GET
/analytics/logs
curl --request GET \
--url 'https://api.nsin.ir/analytics/logs?domain=example.com&period=1h&limit=100&offset=0&cache=hit&reqStatus=cache&sort=time&dir=asc&count=exact&fields=list&errFault=origin' \
--header 'Authorization: Bearer <token>'

Individual request records, newest first unless sort says otherwise, with every filter applied as an AND. Requires analytics.view and a plan including the logs feature.

from/to narrow the rows to an exact window inside period (a chart bucket, say); period still sets the query’s time budget. The list and its total are computed separately: has_more says whether another page exists without needing the total, count controls how hard the total works, and fields=list returns only the columns a list row needs (fetch the rest for one row by rayId). Sorting by anything but time needs a window of at most 24 hours (7 days on one domain).

Header and body fields are retained for a shorter window than the rest of the row, so older entries return them empty.

When your origin answers with a 5xx, the body it sent is kept exactly and returned as origin_error_body for 3 days. A page of rows carries the first 2 KB of each body; ask for the request by rayId to get all of it. origin_error_body_state says whether the body is whole, cut, empty or already deleted.

domain
required
string

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

Example
example.com
period
string
default: 24h
Allowed values: 1h 3h 6h 12h 24h 48h 7d 30d

Time window, ending now. Time series are bucketed by minute for 1h, by hour up to 48h, and by day for 7d and 30d. Buckets are cut on Asia/Tehran (UTC+03:30) boundaries and emitted as UTC instants, so an hourly bucket starts at :30 UTC. An unrecognised value falls back to 24h.

limit
integer
default: 100 >= 1 <= 500

Rows per page, 1–500. Values outside the range fall back to 100.

offset
integer
0
status
string

Exact HTTP status code.

method
string

HTTP method — case-insensitive.

uri
string

URI substring match.

cache
string
Allowed values: hit miss bypass

Cache status: hit, miss or bypass.

reqStatus
string
Allowed values: cache proxied direct

Serving path: cache, proxied or direct.

rayId
string

Exact ray id of a single request. A query with rayId is the one that returns the whole origin_error_body.

hostname
string

Exact host, a subdomain of it, or a bare subdomain label.

originHost
string

Host header sent to the origin.

originSni
string

SNI presented to the origin.

originAddr
string

Origin address the edge connected to.

originAddrs
string

Comma-separated list of origin addresses.

remoteAddr
string

Client IP address.

country
string

Client ISO country code.

nodeCountry
string

ISO country of the edge node that served the request.

node
string

Edge node name.

threat
string

Threat category.

detectAction
string

Action a detection rule took on the request.

botKind
string

Classified bot kind.

wafRuleId
string

A CRS rule id that fired.

headerSearch
string

Substring searched across the captured headers.

uriPatterns
string

Comma-separated URI patterns.

from
string

Start of an exact window inside period: RFC 3339, unix seconds, or YYYY-MM-DD HH:MM:SS read as Asia/Tehran time.

to
string

End of the window, in the same forms as from.

sort
string
Allowed values: time status latency out in originStatus host path method ip cc node cache proto ja4 ja4h

Column to order by, optionally with the direction as key:dir. Default time:desc. Anything else is a 400.

dir
string
Allowed values: asc desc

Sort direction.

count
string
Allowed values: exact capped 0

exact (default) counts every matching row; capped stops at 10 000 (total_state: capped then means “10 000 or more”); 0 skips the count (total_state: skipped) — use it for page 2 and on.

fields
string
Allowed values: list

list returns only the columns a list row shows.

errReason
string

Failure reason, e.g. origin_timeout (the reason keys of /analytics/unreachable-reasons).

errFault
string
Allowed values: origin nsin network client config

Who was responsible for a failure.

errLeg
string

Which hop failed (see err_leg on the log entry).

edgeAddr
string

The NSIN edge address that received the request. Exact match.

A page of request logs.

Media type application/json
object
data
Array<object>

One request. Header and body fields are retained for a shorter window than the rest of the row, so older entries return them empty.

object
domain_id
integer
timestamp
string format: date-time
hostname
string
method

HTTP method.

string
uri

Percent-encoded exactly as the client sent it.

string
status

Status returned to the visitor.

integer
remote_addr

Client IP address, as the edge saw it.

string
country

Client country (ISO code), resolved from the IP.

string
duration

Total request duration in ms. For WebSockets this spans the whole connection.

number
bytes_in

Bytes received from the client.

integer
bytes_out

Bytes sent to the client.

integer
cache_status

Cache outcome for the request.

string
Allowed values: hit miss bypass
bypass_reason

Why the cache was bypassed, when it was.

string
req_status

Serving path: cache, proxied (through the edge proxy) or direct.

string
Allowed values: cache proxied direct
user_agent

The client’s User-Agent.

string
headers

Request headers as captured by the edge.

string
origin_req_headers

Headers the edge sent to the origin.

string
origin_headers

Headers the origin returned.

string
client_resp_headers

Headers returned to the visitor.

string
body

Body captured by the edge, when one was. Retained for a shorter window than the rest of the row.

string
is_ws

The request was a connection upgrade (WebSocket or similar).

boolean
upgrade

What kind of upgrade is_ws was: a real WebSocket handshake, httpupgrade (Upgrade: websocket without the WebSocket key exchange), or other. Empty when unknown.

string
Allowed values: websocket httpupgrade other ""
content_type

Response Content-Type.

string
error

The raw error text when the request failed.

string
err_reason

Why the request failed, as a stable key — origin_timeout, origin_refused, origin_tls, client_closed, nsin_edge, …, or origin_status_NNN. The same keys as /analytics/unreachable-reasons. Empty when the request did not fail.

string
err_fault

Who was responsible for the failure.

string
Allowed values: origin nsin network client config ""
err_leg

Which hop failed: client_edge, edge, edge_origin, or — for traffic carried over NSIN’s internal tunnel — edge_mafar, mafar_routing, mafar_tunnel, mafar_egress, egress_origin. Empty on older rows.

string
err_code

The three-digit status shown for the failure.

string
err_source

How the failure was classified (core_typed, core_string, mafar_connect, mafar_sideband, edge_local). Empty on older rows.

string
err_detail

Short extra detail about the failure.

string
<= 256 characters
mafar_code

Error code from NSIN’s internal tunnel; 0 when it was not involved.

integer
stale_served

A stale cached copy was served.

boolean
node

Edge node that served the request.

string
ray_id

Unique id for this request.

string
protocol

Client-to-edge protocol, e.g. HTTP/2.0.

string
origin_protocol

Edge-to-origin protocol. Empty on a cache hit.

string
origin_status

Status the origin returned. 0 on a cache hit.

integer
origin_error_body

The body your origin sent with a 5xx, exactly as it sent it (a compressed body is decoded), whatever page the visitor was shown. Kept for 3 days. In a list this is the first 2 KB and origin_error_body_preview is true when there is more; query the request by rayId for the whole body. Empty when the body is not UTF-8: see origin_error_body_base64.

string
origin_error_body_base64

The same body, base64-encoded, when it is not valid UTF-8 (a binary body, or a page in another charset). Only returned for a query by rayId.

string
origin_error_body_bytes

Size of the stored body in bytes.

integer
origin_error_body_state

What is known about the origin’s error body. full: the whole body is stored. truncated: only its first part is, because it was larger than the edge keeps or the origin stopped sending it. empty: the origin sent the error with no body. not_read: the origin sent the status and the body never arrived. expired: the body was kept and has been deleted after 3 days. Absent when the origin did not answer with a 5xx.

string
Allowed values: full truncated empty not_read expired
origin_error_body_preview

true when origin_error_body holds only the start of the body. Query the request by rayId for all of it.

boolean
origin_addr

Origin IP:port the edge connected to.

string
tls_version

TLS version the client connected with.

string
tls_cipher

TLS cipher suite the client connected with.

string
tls_resumed

The client resumed an earlier TLS session.

boolean
content_encoding
string
referer
string
cache_age

Seconds the served object had been cached.

integer
asn
integer
asn_org
string
bot_kind

Bot classification, when the request was identified as one.

string
bot_verified

Whether the bot’s identity was verified, rather than merely claimed.

boolean
detect_action

Action a detection rule took.

string
detect_dry_run

True when the rule was in dry-run, so nothing was enforced.

boolean
waf_score

WAF anomaly score.

integer
waf_rule_ids

CRS rule ids that fired.

string
ja4
string
ja4h
string
rule_id

The rule that set detect_action. Absent when none (or on rows before 2026-10).

integer
rl_key

The rate-limit key that tripped, short and readable (ja4h=ge20cn09…|path=/ajax.php).

string
cookie_names

The request’s cookie names, sorted and comma-separated. Never values.

string
header_set_hash

12 hex characters naming the request’s set of header names; requests from one client build share it.

string
bot_score

The edge’s bot score, 1 (bot) to 99 (human-like). Absent when the request was not scored.

integer
md_converted

The response was served as Markdown.

boolean
md_tokens

Token count of the Markdown served.

integer
orig_tokens

Token count of the original HTML.

integer
md_fail_reason

Why a Markdown conversion was not served, when it was asked for.

string
opt_kind

The asset optimization applied to the response, if any.

string
Allowed values: webp minify-js minify-css
opt_orig_bytes

Size before the optimization, uncompressed.

integer
opt_bytes

Size after it, uncompressed.

integer
origin_conn_reused

The edge reused an open connection to the origin.

boolean
origin_dial_ms

Time to connect to the origin, in ms. Absent when no new connection was made.

number
origin_tls_ms

TLS handshake time with the origin, in ms.

number
origin_ttfb_ms

Time to the origin’s first response byte, in ms.

number
origin_tls_version

TLS version used with the origin (tls_version is the visitor’s).

string
total

Rows matching the filters, before paging — meaningful only when total_state is exact or capped.

integer
total_state

exact — total is the count. capped — more than total (10 000) rows match. skipped — count=0 was sent. failed — the count timed out; the rows are still valid.

string
Allowed values: exact capped skipped failed
has_more

At least one more row matches past this page.

boolean
sort

The order the rows are in, as key:dir.

string
fields

list when the rows carry only the list columns.

string
limit
integer
offset
integer
Example
{
"data": [
{
"cache_status": "hit",
"req_status": "cache",
"upgrade": "websocket",
"err_fault": "origin",
"origin_error_body_state": "full",
"opt_kind": "webp"
}
],
"total_state": "exact",
"sort": "time:desc"
}

The domain query parameter is missing, sort/dir is not a known value, or the sort needs a shorter window.

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"
}

Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

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"
}

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.)

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 noPlan
{
"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).

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"
}

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"
}

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.

Media type application/json
object
error
required

Human-readable description of what went wrong.

string
pending

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

boolean
Examples
{
"error": "analytics unavailable"
}
Retry-After
integer
Example
5

Seconds to wait before retrying. Sent only with pending.