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

Get one of the domain's invoices

gethttps://api.nsin.ir/domains/{domain}/invoices/{id}

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

One invoice of the domain with its line items and the subscription it belongs to; user (the holder) is included when the invoice is yours. Traffic statements answer 404. Requires billing on the domain, or being its nominated payer; anyone else gets 404.

Path parameters

  • domainstringrequiredpath

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

  • idintegerrequiredpath

Responses

200Invoice with its subscription.

Content type: application/json

  • invoiceInvoice
    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
  • userobject

    The invoice's holder, as printed on it.

    Fields
    • idinteger
    • emailstring
    • phone_numberstring
    • namestring
    • addressstring
    • birth_datestring (date)
  • subscriptionobject

    The subscription the invoice belongs to, when it has one.

    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.

json
{
  "invoice": {
    "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
      }
    ]
  },
  "user": {
    "id": 0,
    "email": "string",
    "phone_number": "string",
    "name": "string",
    "address": "string",
    "birth_date": "string"
  },
  "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
  }
}
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"
}
404Domain or invoice not found.

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/domains/example.com/invoices/0" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc