Raw request logs
Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.
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.
Query parameters
- domainstringrequiredquery
The domain name (for example
example.com). These endpoints take the domain as a query parameter rather than a path segment. - periodstringquery
Time window, ending now. Time series are bucketed by minute for
1h, by hour up to48h, and by day for7dand30d. Buckets are cut on Asia/Tehran (UTC+03:30) boundaries and emitted as UTC instants, so an hourly bucket starts at:30UTC. An unrecognised value falls back to24h.One of:"1h""3h""6h""12h""24h""48h""7d""30d"Default:"24h" - limitintegerquery
Rows per page, 1–500. Values outside the range fall back to 100.
Default:100 - offsetintegerqueryDefault:
0 - statusstringquery
Exact HTTP status code.
- methodstringquery
HTTP method — case-insensitive.
- uristringquery
URI substring match.
- cachestringquery
Cache status:
hit,missorbypass.One of:"hit""miss""bypass" - reqStatusstringquery
Serving path:
cache,proxiedordirect.One of:"cache""proxied""direct" - rayIdstringquery
Exact ray id of a single request. A query with
rayIdis the one that returns the wholeorigin_error_body. - hostnamestringquery
Exact host, a subdomain of it, or a bare subdomain label.
- originHoststringquery
Host header sent to the origin.
- originSnistringquery
SNI presented to the origin.
- originAddrstringquery
Origin address the edge connected to.
- originAddrsstringquery
Comma-separated list of origin addresses.
- remoteAddrstringquery
Client IP address.
- countrystringquery
Client ISO country code.
- nodeCountrystringquery
ISO country of the edge node that served the request.
- nodestringquery
Edge node name.
- threatstringquery
Threat category.
- detectActionstringquery
Action a detection rule took on the request.
- botKindstringquery
Classified bot kind.
- wafRuleIdstringquery
A CRS rule id that fired.
- headerSearchstringquery
Substring searched across the captured headers.
- uriPatternsstringquery
Comma-separated URI patterns.
- fromstringquery
Start of an exact window inside
period: RFC 3339, unix seconds, orYYYY-MM-DD HH:MM:SSread as Asia/Tehran time. - tostringquery
End of the window, in the same forms as
from. - sortstringquery
Column to order by, optionally with the direction as
key:dir. Defaulttime:desc. Anything else is a400.One of:"time""status""latency""out""in""originStatus""host""path""method""ip""cc""node""cache""proto""ja4""ja4h" - dirstringquery
Sort direction.
One of:"asc""desc" - countstringquery
exact(default) counts every matching row;cappedstops at 10 000 (total_state: cappedthen means "10 000 or more");0skips the count (total_state: skipped) — use it for page 2 and on.One of:"exact""capped""0" - fieldsstringquery
listreturns only the columns a list row shows.One of:"list" - errReasonstringquery
Failure reason, e.g.
origin_timeout(thereasonkeys of/analytics/unreachable-reasons). - errFaultstringquery
Who was responsible for a failure.
One of:"origin""nsin""network""client""config" - errLegstringquery
Which hop failed (see
err_legon the log entry). - edgeAddrstringquery
The NSIN edge address that received the request. Exact match.
Responses
200A page of request logs.
Content type: application/json
- dataarray of LogEntry
Item fields
- domain_idinteger
- timestampstring (date-time)
- hostnamestring
- methodstring
HTTP method.
- uristring
Percent-encoded exactly as the client sent it.
- statusinteger
Status returned to the visitor.
- remote_addrstring
Client IP address, as the edge saw it.
- countrystring
Client country (ISO code), resolved from the IP.
- durationnumber
Total request duration in ms. For WebSockets this spans the whole connection.
- bytes_ininteger
Bytes received from the client.
- bytes_outinteger
Bytes sent to the client.
- cache_statusstring
Cache outcome for the request.
One of:"hit""miss""bypass" - bypass_reasonstring
Why the cache was bypassed, when it was.
- req_statusstring
Serving path:
cache,proxied(through the edge proxy) ordirect.One of:"cache""proxied""direct" - user_agentstring
The client's User-Agent.
- headersstring
Request headers as captured by the edge.
- origin_req_headersstring
Headers the edge sent to the origin.
- origin_headersstring
Headers the origin returned.
- client_resp_headersstring
Headers returned to the visitor.
- bodystring
Body captured by the edge, when one was. Retained for a shorter window than the rest of the row.
- is_wsboolean
The request was a connection upgrade (WebSocket or similar).
- upgradestring
What kind of upgrade
is_wswas: a real WebSocket handshake,httpupgrade(Upgrade: websocketwithout the WebSocket key exchange), orother. Empty when unknown.One of:"websocket""httpupgrade""other""" - content_typestring
Response
Content-Type. - errorstring
The raw error text when the request failed.
- err_reasonstring
Why the request failed, as a stable key —
origin_timeout,origin_refused,origin_tls,client_closed,nsin_edge, …, ororigin_status_NNN. The same keys as/analytics/unreachable-reasons. Empty when the request did not fail. - err_faultstring
Who was responsible for the failure.
One of:"origin""nsin""network""client""config""" - err_legstring
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. - err_codestring
The three-digit status shown for the failure.
- err_sourcestring
How the failure was classified (
core_typed,core_string,mafar_connect,mafar_sideband,edge_local). Empty on older rows. - err_detailstring
Short extra detail about the failure.
- mafar_codeinteger
Error code from NSIN's internal tunnel; 0 when it was not involved.
- stale_servedboolean
A stale cached copy was served.
- nodestring
Edge node that served the request.
- ray_idstring
Unique id for this request.
- protocolstring
Client-to-edge protocol, e.g.
HTTP/2.0. - origin_protocolstring
Edge-to-origin protocol. Empty on a cache hit.
- origin_statusinteger
Status the origin returned.
0on a cache hit. - origin_error_bodystring
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_previewistruewhen there is more; query the request byrayIdfor the whole body. Empty when the body is not UTF-8: seeorigin_error_body_base64. - origin_error_body_base64string
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. - origin_error_body_bytesinteger
Size of the stored body in bytes.
- origin_error_body_statestring
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.One of:"full""truncated""empty""not_read""expired" - origin_error_body_previewboolean
truewhenorigin_error_bodyholds only the start of the body. Query the request byrayIdfor all of it. - origin_addrstring
Origin
IP:portthe edge connected to. - tls_versionstring
TLS version the client connected with.
- tls_cipherstring
TLS cipher suite the client connected with.
- tls_resumedboolean
The client resumed an earlier TLS session.
- content_encodingstring
- refererstring
- cache_ageinteger
Seconds the served object had been cached.
- asninteger
- asn_orgstring
- bot_kindstring
Bot classification, when the request was identified as one.
- bot_verifiedboolean
Whether the bot's identity was verified, rather than merely claimed.
- detect_actionstring
Action a detection rule took.
- detect_dry_runboolean
True when the rule was in dry-run, so nothing was enforced.
- waf_scoreinteger
WAF anomaly score.
- waf_rule_idsstring
CRS rule ids that fired.
- ja4string
- ja4hstring
- rule_idinteger
The rule that set
detect_action. Absent when none (or on rows before 2026-10). - rl_keystring
The rate-limit key that tripped, short and readable (
ja4h=ge20cn09…|path=/ajax.php). - cookie_namesstring
The request's cookie names, sorted and comma-separated. Never values.
- header_set_hashstring
12 hex characters naming the request's set of header names; requests from one client build share it.
- bot_scoreinteger
The edge's bot score, 1 (bot) to 99 (human-like). Absent when the request was not scored.
- md_convertedboolean
The response was served as Markdown.
- md_tokensinteger
Token count of the Markdown served.
- orig_tokensinteger
Token count of the original HTML.
- md_fail_reasonstring
Why a Markdown conversion was not served, when it was asked for.
- opt_kindstring
The asset optimization applied to the response, if any.
One of:"webp""minify-js""minify-css" - opt_orig_bytesinteger
Size before the optimization, uncompressed.
- opt_bytesinteger
Size after it, uncompressed.
- origin_conn_reusedboolean
The edge reused an open connection to the origin.
- origin_dial_msnumber
Time to connect to the origin, in ms. Absent when no new connection was made.
- origin_tls_msnumber
TLS handshake time with the origin, in ms.
- origin_ttfb_msnumber
Time to the origin's first response byte, in ms.
- origin_tls_versionstring
TLS version used with the origin (
tls_versionis the visitor's).
- totalinteger
Rows matching the filters, before paging — meaningful only when
total_stateisexactorcapped. - total_statestring
exact—totalis the count.capped— more thantotal(10 000) rows match.skipped—count=0was sent.failed— the count timed out; the rows are still valid.One of:"exact""capped""skipped""failed" - has_moreboolean
At least one more row matches past this page.
- sortstring
The order the rows are in, as
key:dir. - fieldsstring
listwhen the rows carry only the list columns. - limitinteger
- offsetinteger
{
"data": [
{
"domain_id": 0,
"timestamp": "2026-01-01T00:00:00Z",
"hostname": "string",
"method": "string",
"uri": "string",
"status": 0,
"remote_addr": "string",
"country": "string",
"duration": 0,
"bytes_in": 0,
"bytes_out": 0,
"cache_status": "hit",
"bypass_reason": "string",
"req_status": "cache",
"user_agent": "string",
"headers": "string",
"origin_req_headers": "string",
"origin_headers": "string",
"client_resp_headers": "string",
"body": "string",
"is_ws": true,
"upgrade": "websocket",
"content_type": "string",
"error": "string",
"err_reason": "string",
"err_fault": "origin",
"err_leg": "string",
"err_code": "string",
"err_source": "string",
"err_detail": "string",
"mafar_code": 0,
"stale_served": true,
"node": "string",
"ray_id": "string",
"protocol": "string",
"origin_protocol": "string",
"origin_status": 0,
"origin_error_body": "string",
"origin_error_body_base64": "string",
"origin_error_body_bytes": 0,
"origin_error_body_state": "full",
"origin_error_body_preview": true,
"origin_addr": "string",
"tls_version": "string",
"tls_cipher": "string",
"tls_resumed": true,
"content_encoding": "string",
"referer": "string",
"cache_age": 0,
"asn": 0,
"asn_org": "string",
"bot_kind": "string",
"bot_verified": true,
"detect_action": "string",
"detect_dry_run": true,
"waf_score": 0,
"waf_rule_ids": "string",
"ja4": "string",
"ja4h": "string",
"rule_id": 0,
"rl_key": "string",
"cookie_names": "string",
"header_set_hash": "string",
"bot_score": 0,
"md_converted": true,
"md_tokens": 0,
"orig_tokens": 0,
"md_fail_reason": "string",
"opt_kind": "webp",
"opt_orig_bytes": 0,
"opt_bytes": 0,
"origin_conn_reused": true,
"origin_dial_ms": 0,
"origin_tls_ms": 0,
"origin_ttfb_ms": 0,
"origin_tls_version": "string"
}
],
"total": 0,
"total_state": "exact",
"has_more": true,
"sort": "time:desc",
"fields": "string",
"limit": 0,
"offset": 0
}400The domain query parameter is missing, sort/dir is not a known
value, or the sort needs a shorter window.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}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.
{
"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.
{
"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.
{
"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.
{
"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.
{
"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
truewhen the query is still running rather than failing. Retry afterRetry-Afterseconds.
{
"error": "analytics unavailable"
}Example request
curl -X GET "https://api.nsin.ir/analytics/logs?domain=example.com" \
-H "Authorization: Bearer $NSIN_API_KEY"