Traffic usage and pricing across your account
Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.
Recent daily traffic rows (up to 90) with totals, plus the current per-gigabyte prices.
Traffic is billed in three tiers — cached (served from cache),
proxied (fetched through the edge proxy) and direct — each priced
separately. Older rows may carry only the legacy bypass_bytes column;
those are folded into the direct total.
Responses
200Usage rows, totals and prices.
Content type: application/json
- usagearray of DomainTrafficUsageRow
Item fields
- idinteger
- domain_idinteger
- user_idinteger
- datestring (date)
The day the row belongs to.
- billing_window_keystring
Identifies the billing window the row was billed in.
- cached_bytesinteger
Bytes served from cache.
- proxied_bytesinteger
Bytes fetched through the edge proxy.
- direct_bytesinteger
Bytes on the direct path.
- bypass_bytesinteger
Legacy two-tier column, present on historical rows. Folded into the direct total for display.
- charged_rialsinteger
What this row cost, in rials — the sum of the three
charged_*_rials. - window_startstring (date-time)
Start of the billing window the row covers.
- window_endstring (date-time)
End of that window (exclusive).
- billed_cached_bytesinteger
The portion above the plan's free allowance.
- billed_proxied_bytesinteger
The portion above the plan's free allowance.
- billed_direct_bytesinteger
The portion above the plan's free allowance.
- charged_cached_rialsinteger
Cost of the cached tier's billed bytes.
- charged_proxied_rialsinteger
Cost of the proxied tier's billed bytes.
- charged_direct_rialsinteger
Cost of the direct tier's billed bytes.
- invoice_idinteger
The period invoice that itemized this row, once issued.
- processed_atstring (date-time)
When the row was billed.
- created_atstring (date-time)
- total_cached_bytesinteger
- total_proxied_bytesinteger
- total_direct_bytesinteger
- total_charged_rialsinteger
- cached_price_per_gbinteger
Rials per GB of cache-served traffic.
- proxied_price_per_gbinteger
Rials per GB of proxied traffic.
- direct_price_per_gbinteger
Rials per GB of direct traffic.
{
"usage": [
{
"id": 0,
"domain_id": 0,
"user_id": 0,
"date": "string",
"billing_window_key": "string",
"cached_bytes": 0,
"proxied_bytes": 0,
"direct_bytes": 0,
"bypass_bytes": 0,
"charged_rials": 0,
"window_start": "2026-01-01T00:00:00Z",
"window_end": "2026-01-01T00:00:00Z",
"billed_cached_bytes": 0,
"billed_proxied_bytes": 0,
"billed_direct_bytes": 0,
"charged_cached_rials": 0,
"charged_proxied_rials": 0,
"charged_direct_rials": 0,
"invoice_id": 0,
"processed_at": "2026-01-01T00:00:00Z",
"created_at": "2026-01-01T00:00:00Z"
}
],
"total_cached_bytes": 0,
"total_proxied_bytes": 0,
"total_direct_bytes": 0,
"total_charged_rials": 0,
"cached_price_per_gb": 0,
"proxied_price_per_gb": 0,
"direct_price_per_gb": 0
}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"
}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"
}Example request
curl -X GET "https://api.nsin.ir/traffic-usage" \
-H "Authorization: Bearer $NSIN_API_KEY"