nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Billing

Get one subscription's period statement

gethttps://api.nsin.ir/wallet/period-statement

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

The period statement of one of your subscriptions, named by subscription_id or domain: the running estimate (is_estimate: true) while the subscription is active, otherwise its latest closed statement, or null when it has neither. For a domain, the subscription in force is used, else the most recent one.

Plans are per domain, so an account has no single billing period: without subscription_id or domain the answer is {"statement": null}. List your subscriptions with GET /subscriptions; closed periods are in GET /wallet/period-statements.

Query parameters

  • subscription_idintegerquery

    One of your subscriptions (GET /subscriptions).

  • domainstringquery

    A domain name; its subscription in force, else the most recent one you held on it.

Responses

200The statement, or null.

Content type: application/json

  • statementPeriodStatement | null
    Fields
    • Option 1PeriodStatement

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

      Fields
      • idinteger
      • subscription_idinteger
      • plan_idinteger
      • plan_namestring
      • plan_term_idinteger
      • billing_duration_daysinteger
      • quota_reset_daysinteger
      • period_startstring (date-time)
      • period_endstring (date-time)
      • plan_price_rialsinteger

        What the plan cost for this period.

      • traffic_cached_bytesinteger

        Bytes served from cache in the period.

      • traffic_proxied_bytesinteger

        Bytes fetched through the edge proxy.

      • traffic_direct_bytesinteger

        Bytes on the direct path.

      • traffic_bypass_bytesinteger

        Legacy two-tier column, on historical periods only.

      • traffic_charged_rialsinteger

        What the period's traffic cost.

      • cached_price_rials_per_gbinteger

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

      • proxied_price_rials_per_gbinteger

        Price per GB of proxied traffic.

      • direct_price_rials_per_gbinteger

        Price per GB of direct traffic.

      • bypass_price_rials_per_gbinteger

        Legacy two-tier price, on historical periods only.

      • traffic_by_domainarray of PeriodDomainTraffic

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

        Item fields
        • domainstring
        • cached_bytesinteger

          Bytes served from cache.

        • proxied_bytesinteger

          Bytes fetched through the edge proxy.

        • direct_bytesinteger

          Bytes sent directly to the origin path.

        • estimated_charged_rialsinteger

          Estimated cost of this traffic at current rates.

      • created_atstring (date-time)

        When the statement was closed.

      • is_estimateboolean

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

      • not_a_tax_invoiceboolean

        This is a statement, not a tax invoice.

        One of: true
      • traffic_realtimeboolean

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

    • Option 2null
json
{
  "statement": {
    "id": 0,
    "subscription_id": 0,
    "plan_id": 0,
    "plan_name": "string",
    "plan_term_id": 0,
    "billing_duration_days": 0,
    "quota_reset_days": 0,
    "period_start": "2026-01-01T00:00:00Z",
    "period_end": "2026-01-01T00:00:00Z",
    "plan_price_rials": 0,
    "traffic_cached_bytes": 0,
    "traffic_proxied_bytes": 0,
    "traffic_direct_bytes": 0,
    "traffic_bypass_bytes": 0,
    "traffic_charged_rials": 0,
    "cached_price_rials_per_gb": 0,
    "proxied_price_rials_per_gb": 0,
    "direct_price_rials_per_gb": 0,
    "bypass_price_rials_per_gb": 0,
    "traffic_by_domain": [
      {
        "domain": "string",
        "cached_bytes": 0,
        "proxied_bytes": 0,
        "direct_bytes": 0,
        "estimated_charged_rials": 0
      }
    ],
    "created_at": "2026-01-01T00:00:00Z",
    "is_estimate": true,
    "not_a_tax_invoice": true,
    "traffic_realtime": true
  }
}
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.

json
{
  "error": "invalid API key"
}
404No subscription of yours matches subscription_id / domain.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "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.

json
{
  "error": "rate limit exceeded"
}

Example request

bash
curl -X GET "https://api.nsin.ir/wallet/period-statement" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc