Skip to content

Get the domain's traffic usage

GET
/domains/{domain}/traffic-usage
curl --request GET \
--url https://api.nsin.ir/domains/example.com/traffic-usage \
--header 'Authorization: Bearer <token>'

Daily traffic rows for this domain, with totals and current prices. Same three-tier model as the account-wide endpoint. Readable by shared members.

domain
required
string

The domain name (for example example.com) — not a numeric id.

Example
example.com

Usage rows, totals and prices.

Media type application/json
object
usage
Array<object>

One day’s traffic for one domain.

object
id
integer
domain_id
integer
user_id
integer
date
string format: date
billing_window_key
string
cached_bytes
integer
proxied_bytes
integer
direct_bytes
integer
bypass_bytes

Legacy two-tier column, present on historical rows. Folded into the direct total for display.

integer
charged_rials
integer
window_start
string format: date-time
window_end
string format: date-time
billed_cached_bytes

The portion above the plan’s free allowance.

integer
billed_proxied_bytes

The portion above the plan’s free allowance.

integer
billed_direct_bytes

The portion above the plan’s free allowance.

integer
charged_cached_rials
integer
charged_proxied_rials
integer
charged_direct_rials
integer
invoice_id
integer
processed_at
string format: date-time
created_at
string format: date-time
total_cached_bytes
integer
total_proxied_bytes
integer
total_direct_bytes
integer
total_charged_rials
integer
cached_price_per_gb

Rials per GB of cache-served traffic.

integer
proxied_price_per_gb

Rials per GB of proxied traffic.

integer
direct_price_per_gb

Rials per GB of direct traffic.

integer
Example generated
{
"usage": [
{
"id": 1,
"domain_id": 1,
"user_id": 1,
"date": "2026-04-15",
"billing_window_key": "example",
"cached_bytes": 1,
"proxied_bytes": 1,
"direct_bytes": 1,
"bypass_bytes": 1,
"charged_rials": 1,
"window_start": "2026-04-15T12:00:00Z",
"window_end": "2026-04-15T12:00:00Z",
"billed_cached_bytes": 1,
"billed_proxied_bytes": 1,
"billed_direct_bytes": 1,
"charged_cached_rials": 1,
"charged_proxied_rials": 1,
"charged_direct_rials": 1,
"invoice_id": 1,
"processed_at": "2026-04-15T12:00:00Z",
"created_at": "2026-04-15T12:00:00Z"
}
],
"total_cached_bytes": 1,
"total_proxied_bytes": 1,
"total_direct_bytes": 1,
"total_charged_rials": 1,
"cached_price_per_gb": 1,
"proxied_price_per_gb": 1,
"direct_price_per_gb": 1
}

Missing domain.

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