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

What your users' domains cost

gethttps://api.nsin.ir/reseller/v1/usage

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

Spend on your users' domains per UTC day, per user and per domain: traffic charges, and plan and gateway-pack purchases. Each amount is what the domains cost whoever paid; paid_by_you_rials is the part charged to your wallet. Deleted domains still count.

Requests and bandwidth are in the account analytics (GET /analytics/domains-overview), which cover your users' domains.

Query parameters

  • daysintegerquery
    Default: 30
  • user_idintegerquery

    Only this user.

Responses

200Spend.

Content type: application/json

  • fromstring (date)

    First UTC day.

  • tostring (date)

    Last UTC day (today).

  • totalsResellerSpend
    Fields
    • traffic_rialsinteger (int64)
    • plans_rialsinteger (int64)

      Plan and gateway-pack purchases.

    • total_rialsinteger (int64)
    • paid_by_you_rialsinteger (int64)
    • traffic_bytesinteger (int64)
  • daysarray of object
    Item fields
    • datestring (date)
    • traffic_rialsinteger (int64)
    • plans_rialsinteger (int64)
  • usersarray of object

    Highest spend first.

    Item fields
    • user_idinteger
    • traffic_rialsinteger (int64)
    • plans_rialsinteger (int64)

      Plan and gateway-pack purchases.

    • total_rialsinteger (int64)
    • paid_by_you_rialsinteger (int64)
    • traffic_bytesinteger (int64)
  • domainsarray of object

    Highest spend first.

    Item fields
    • domain_idinteger
    • namestring
    • user_idinteger
    • deletedboolean
    • traffic_rialsinteger (int64)
    • plans_rialsinteger (int64)

      Plan and gateway-pack purchases.

    • total_rialsinteger (int64)
    • paid_by_you_rialsinteger (int64)
    • traffic_bytesinteger (int64)
json
{
  "from": "string",
  "to": "string",
  "totals": {
    "traffic_rials": 0,
    "plans_rials": 0,
    "total_rials": 0,
    "paid_by_you_rials": 0,
    "traffic_bytes": 0
  },
  "days": [
    {
      "date": "string",
      "traffic_rials": 0,
      "plans_rials": 0
    }
  ],
  "users": [
    {
      "user_id": 0,
      "traffic_rials": 0,
      "plans_rials": 0,
      "total_rials": 0,
      "paid_by_you_rials": 0,
      "traffic_bytes": 0
    }
  ],
  "domains": [
    {
      "domain_id": 0,
      "name": "string",
      "user_id": 0,
      "deleted": true,
      "traffic_rials": 0,
      "plans_rials": 0,
      "total_rials": 0,
      "paid_by_you_rials": 0,
      "traffic_bytes": 0
    }
  ]
}
400days is outside 1–90.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
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"
}
403The account is not an active reseller (or NSIN has frozen it), or the key belongs to an NSIN SSO app limited to a few domains.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "forbidden"
}
404No user with this id among yours.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "user not found"
}

Example request

bash
curl -X GET "https://api.nsin.ir/reseller/v1/usage" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc