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

Get one subscription

gethttps://api.nsin.ir/subscriptions/{id}

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

One of your subscriptions with its billing-period statement (the closed statement for a finished period) and its invoices.

Path parameters

  • idintegerrequiredpath

Responses

200Subscription with its statement and invoices.

Content type: application/json

  • subscriptionSubscription

    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.

    Fields
    • idinteger
    • user_idinteger
    • domain_idinteger
    • domain_namestring
    • plan_idinteger

      The plan this subscription is on.

    • planobject

      The plan this subscription is on.

    • plan_term_idinteger

      The billing term purchased.

    • plan_termobject

      The billing term purchased.

    • statusstring

      For example active, expired, grace or cancelled.

    • started_atstring (date-time)

      Start of the subscription term.

    • expires_atstring (date-time)

      End of the paid term.

    • grace_untilstring (date-time)

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

    • auto_renewboolean

      Renew from the wallet at expiry.

    • quota_reset_daysinteger

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

    • is_trialboolean

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

    • cancelled_atstring (date-time)

      When the subscription was cancelled. Absent unless cancelled.

    • cancel_reasonstring

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

      One of: "domain_deleted" "recycled_domain_id" "plan_switch" "trial_ended"
    • created_atstring (date-time)
    • updated_atstring (date-time)
    • effective_featuresobject

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

    • quota_period_startstring (date-time)

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

    • quota_period_endstring (date-time)

      End of the current traffic-allowance window.

    • quota_period_used_bytesinteger (int64)

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

    • override_max_recordsinteger

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

    • override_max_traffic_gbinteger

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

    • override_max_rules_per_setinteger

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

    • override_max_gateway_requests_30dinteger

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

    • override_max_gateway_gb_30dinteger

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

    • override_max_cache_cap_mbinteger

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

    • override_max_cache_disk_gbinteger

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

    • override_max_cache_ttl_daysinteger

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

    • override_max_email_rulesinteger

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

    • override_max_email_forwards_per_dayinteger

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

    • override_max_email_sends_per_dayinteger

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

    • override_max_custom_rulesinteger

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

    • override_disabled_rule_typesstring

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

    • override_gateways_enabledboolean

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

    • override_logs_enabledboolean

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

    • override_monitoring_enabledboolean

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

    • override_rules_enabledboolean

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

    • override_cache_purge_enabledboolean

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

    • override_custom_ssl_enabledboolean

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

    • override_ws_enabledboolean

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

    • override_host_header_edit_enabledboolean

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

    • override_uptime_sms_enabledboolean

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

    • override_dedicated_support_enabledboolean

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

    • override_shield_enabledboolean

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

    • override_bot_cache_enabledboolean

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

    • override_under_attack_allowedboolean

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

    • override_email_routing_enabledboolean

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

    • override_email_sending_enabledboolean

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

  • period_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
  • invoicesarray of Invoice
    Item fields
    • idinteger
    • numberstring

      Human-facing invoice number, sequential per Jalali year.

    • user_idinteger
    • domain_idinteger
    • domain_namestring
    • subscription_idinteger
    • payment_idinteger
    • kindstring

      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).

      One of: "subscription" "period" "topup" "manual"
    • statusstring
      One of: "paid" "unpaid" "cancelled"
    • subtotal_rialsinteger

      Before tax, in rials.

    • tax_rialsinteger

      VAT, in rials.

    • total_rialsinteger

      What was charged, in rials.

    • issued_atstring (date-time)
    • paid_atstring | null (date-time)
    • notesstring
    • created_atstring (date-time)
    • updated_atstring (date-time)
    • itemsarray of InvoiceItem
      Item fields
      • idinteger
      • invoice_idinteger
      • descriptionstring
      • quantityinteger
      • unit_price_rialsinteger
      • total_rialsinteger
json
{
  "subscription": {
    "id": 0,
    "user_id": 0,
    "domain_id": 0,
    "domain_name": "string",
    "plan_id": 0,
    "plan": {},
    "plan_term_id": 0,
    "plan_term": {},
    "status": "string",
    "started_at": "2026-01-01T00:00:00Z",
    "expires_at": "2026-01-01T00:00:00Z",
    "grace_until": "2026-01-01T00:00:00Z",
    "auto_renew": true,
    "quota_reset_days": 0,
    "is_trial": true,
    "cancelled_at": "2026-01-01T00:00:00Z",
    "cancel_reason": "domain_deleted",
    "created_at": "2026-01-01T00:00:00Z",
    "updated_at": "2026-01-01T00:00:00Z",
    "effective_features": {},
    "quota_period_start": "2026-01-01T00:00:00Z",
    "quota_period_end": "2026-01-01T00:00:00Z",
    "quota_period_used_bytes": 0,
    "override_max_records": 0,
    "override_max_traffic_gb": 0,
    "override_max_rules_per_set": 0,
    "override_max_gateway_requests_30d": 0,
    "override_max_gateway_gb_30d": 0,
    "override_max_cache_cap_mb": 0,
    "override_max_cache_disk_gb": 0,
    "override_max_cache_ttl_days": 0,
    "override_max_email_rules": 0,
    "override_max_email_forwards_per_day": 0,
    "override_max_email_sends_per_day": 0,
    "override_max_custom_rules": 0,
    "override_disabled_rule_types": "string",
    "override_gateways_enabled": true,
    "override_logs_enabled": true,
    "override_monitoring_enabled": true,
    "override_rules_enabled": true,
    "override_cache_purge_enabled": true,
    "override_custom_ssl_enabled": true,
    "override_ws_enabled": true,
    "override_host_header_edit_enabled": true,
    "override_uptime_sms_enabled": true,
    "override_dedicated_support_enabled": true,
    "override_shield_enabled": true,
    "override_bot_cache_enabled": true,
    "override_under_attack_allowed": true,
    "override_email_routing_enabled": true,
    "override_email_sending_enabled": true
  },
  "period_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
  },
  "invoices": [
    {
      "id": 0,
      "number": "string",
      "user_id": 0,
      "domain_id": 0,
      "domain_name": "string",
      "subscription_id": 0,
      "payment_id": 0,
      "kind": "subscription",
      "status": "paid",
      "subtotal_rials": 0,
      "tax_rials": 0,
      "total_rials": 0,
      "issued_at": "2026-01-01T00:00:00Z",
      "paid_at": "2026-01-01T00:00:00Z",
      "notes": "string",
      "created_at": "2026-01-01T00:00:00Z",
      "updated_at": "2026-01-01T00:00:00Z",
      "items": [
        {
          "id": 0,
          "invoice_id": 0,
          "description": "string",
          "quantity": 0,
          "unit_price_rials": 0,
          "total_rials": 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.

json
{
  "error": "invalid API key"
}
404No such subscription on this account.

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/subscriptions/0" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc