Skip to content
nsin docs

Get one of the domain's subscriptions

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

One subscription of the domain with its billing-period statement, its invoices (not traffic statements) and the wallet movements tied to it. Requires billing on the domain, or being its nominated payer; anyone else gets 404.

domain
required
string

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

Example
example.com
id
required
integer

Subscription with its statement, invoices and wallet movements.

Media type application/json
object
subscription

A plan attached to one domain. Entitlements are not read from the plan directly — use GET /domains/{domain}/features, which resolves any per-subscription overrides.

object
id
integer
user_id
integer
domain_id
integer
domain_name
string
plan_id

The plan this subscription is on.

integer
plan

The plan this subscription is on.

object
key
additional properties
any
plan_term_id

The billing term purchased.

integer
plan_term

The billing term purchased.

object
key
additional properties
any
status

For example active, expired, grace or cancelled.

string
started_at

Start of the subscription term.

string format: date-time
expires_at

End of the paid term.

string format: date-time
grace_until

End of the grace period after expiry, during which the plan keeps working.

string format: date-time
auto_renew

Renew from the wallet at expiry.

boolean
quota_reset_days

Traffic-allowance reset cadence, frozen at purchase time so later plan changes cannot shift an existing subscriber’s quota window.

integer
is_trial

The free trial granted at signup. Downgrades to the free plan on expiry rather than entering grace.

boolean
cancelled_at

When the subscription was cancelled. Absent unless cancelled.

string format: date-time
cancel_reason

Why NSIN cancelled it, for a cancellation the system made. Absent otherwise.

string
Allowed values: domain_deleted recycled_domain_id plan_switch trial_ended
created_at
string format: date-time
updated_at
string format: date-time
effective_features

The entitlements this subscription carries — its plan with any overrides applied. On single-subscription reads.

object
key
additional properties
any
quota_period_start

Start of the current traffic-allowance window. On single-subscription reads of an active or grace subscription.

string format: date-time
quota_period_end

End of the current traffic-allowance window.

string format: date-time
quota_period_used_bytes

Traffic used so far in the current allowance window, in bytes. Only on GET /domains/{domain}/subscription.

integer format: int64
override_max_records

Support-set override of the plan’s max_records. Present only when set.

integer
override_max_traffic_gb

Support-set override of the plan’s max_traffic_gb. Present only when set.

integer
override_max_rules_per_set

Support-set override of the plan’s max_rules_per_set. Present only when set.

integer
override_max_gateway_requests_30d

Support-set override of the plan’s max_gateway_requests_30d. Present only when set.

integer
override_max_gateway_gb_30d

Support-set override of the plan’s max_gateway_gb_30d. Present only when set.

integer
override_max_cache_cap_mb

Support-set override of the plan’s max_cache_cap_mb. Present only when set.

integer
override_max_cache_disk_gb

Support-set override of the plan’s max_cache_disk_gb. Present only when set.

integer
override_max_cache_ttl_days

Support-set override of the plan’s max_cache_ttl_days. Present only when set.

integer
override_max_email_rules

Support-set override of the plan’s max_email_rules. Present only when set.

integer
override_max_email_forwards_per_day

Support-set override of the plan’s max_email_forwards_per_day. Present only when set.

integer
override_max_email_sends_per_day

Support-set override of the plan’s max_email_sends_per_day. Present only when set.

integer
override_max_custom_rules

Support-set override of the plan’s max_custom_rules. Present only when set.

integer
override_disabled_rule_types

Support-set override of the plan’s disabled_rule_types, as a JSON array in a string ([] lifts every restriction). Present only when set.

string
override_gateways_enabled

Support-set override of the plan’s gateways_enabled. Present only when set.

boolean
override_logs_enabled

Support-set override of the plan’s logs_enabled. Present only when set.

boolean
override_monitoring_enabled

Support-set override of the plan’s monitoring_enabled. Present only when set.

boolean
override_rules_enabled

Support-set override of the plan’s rules_enabled. Present only when set.

boolean
override_cache_purge_enabled

Support-set override of the plan’s cache_purge_enabled. Present only when set.

boolean
override_custom_ssl_enabled

Support-set override of the plan’s custom_ssl_enabled. Present only when set.

boolean
override_ws_enabled

Support-set override of the plan’s ws_enabled. Present only when set.

boolean
override_host_header_edit_enabled

Support-set override of the plan’s host_header_edit_enabled. Present only when set.

boolean
override_uptime_sms_enabled

Support-set override of the plan’s uptime_sms_enabled. Present only when set.

boolean
override_dedicated_support_enabled

Support-set override of the plan’s dedicated_support_enabled. Present only when set.

boolean
override_shield_enabled

Support-set override of the plan’s shield_enabled. Present only when set.

boolean
override_bot_cache_enabled

Support-set override of the plan’s bot_cache_enabled. Present only when set.

boolean
override_under_attack_allowed

Support-set override of the plan’s under_attack_allowed. Present only when set.

boolean
override_email_routing_enabled

Support-set override of the plan’s email_routing_enabled. Present only when set.

boolean
override_email_sending_enabled

Support-set override of the plan’s email_sending_enabled. Present only when set.

boolean
period_statement
One of:

One billing period’s cost. For the period in progress the traffic figures are a running estimate.

object
id
integer
subscription_id
integer
plan_id
integer
plan_name
string
plan_term_id
integer
billing_duration_days
integer
quota_reset_days
integer
period_start
string format: date-time
period_end
string format: date-time
plan_price_rials

What the plan cost for this period.

integer
traffic_cached_bytes

Bytes served from cache in the period.

integer
traffic_proxied_bytes

Bytes fetched through the edge proxy.

integer
traffic_direct_bytes

Bytes on the direct path.

integer
traffic_bypass_bytes

Legacy two-tier column, on historical periods only.

integer
traffic_charged_rials

What the period’s traffic cost.

integer
cached_price_rials_per_gb

Price per GB of cached traffic in force for the period.

integer
proxied_price_rials_per_gb

Price per GB of proxied traffic.

integer
direct_price_rials_per_gb

Price per GB of direct traffic.

integer
bypass_price_rials_per_gb

Legacy two-tier price, on historical periods only.

integer
traffic_by_domain

Per-domain split. Only on an estimate for a running period.

Array<object>

One domain’s traffic in a period estimate.

object
domain
string
cached_bytes

Bytes served from cache.

integer
proxied_bytes

Bytes fetched through the edge proxy.

integer
direct_bytes

Bytes sent directly to the origin path.

integer
estimated_charged_rials

Estimated cost of this traffic at current rates.

integer
created_at

When the statement was closed.

string format: date-time
is_estimate

true for a running period’s estimate; false for a closed period.

boolean
not_a_tax_invoice

This is a statement, not a tax invoice.

boolean
traffic_realtime

Present (true) on an estimate whose traffic figures run up to now.

boolean
invoices
Array<object>
object
id
integer
number

Human-facing invoice number, sequential per Jalali year.

string
user_id
integer
domain_id
integer
domain_name
string
subscription_id
integer
payment_id
integer
kind

subscription — a plan purchase or renewal (taxed). period — the traffic of a closed billing period, when it had metered traffic (no VAT). topup — a wallet top-up (no VAT). manual — issued by NSIN support (taxed).

string
Allowed values: subscription period topup manual
status
string
Allowed values: paid unpaid cancelled
subtotal_rials

Before tax, in rials.

integer
tax_rials

VAT, in rials.

integer
total_rials

What was charged, in rials.

integer
issued_at
string format: date-time
paid_at
string | null format: date-time
notes
string
created_at
string format: date-time
updated_at
string format: date-time
items
Array<object>
object
id
integer
invoice_id
integer
description
string
quantity
integer
unit_price_rials
integer
total_rials
integer
transactions

Wallet movements belonging to this subscription — the purchase debit, renewal debits and any refunds of its invoices — newest first. Empty when the term was never paid from the wallet.

Array<object>
object
id
integer
wallet_id
integer
user_id
integer
type

topup — money added. purchase — a plan bought or renewed. refund. admin_adjust — a correction by NSIN support. traffic_usage — a traffic charge. signup_bonus — the credit granted at signup.

string
Allowed values: topup purchase refund admin_adjust traffic_usage signup_bonus
amount_rials

Signed — positive credits, negative debits.

integer
balance_after
integer
description
string
ref_type

What the row refers to — payment, subscription, traffic or manual.

string
ref_id
integer
ref_code

Payment gateway reference, for top-ups.

string
origin_node

Internal — set on rows replicated from another NSIN region. Clients can ignore it.

string
sync_key

Internal — the replication idempotency key of a replicated row. Clients can ignore it.

string
created_at
string format: date-time
domain_id

The domain a traffic charge is attributed to. Only on rows of GET /wallet/transactions.

integer
domain_name

That domain’s name. Only on rows of GET /wallet/transactions.

string
Example
{
"subscription": {
"cancel_reason": "domain_deleted"
},
"period_statement": {
"not_a_tax_invoice": true
},
"invoices": [
{
"kind": "subscription",
"status": "paid"
}
],
"transactions": [
{
"type": "topup"
}
]
}

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

Domain or subscription not found.

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