Get reseller billing

Return the compact billing snapshot for one reseller. The same shape appears embedded under billing on GET /resellers/{id} and as the return value of POST /resellers/{id}/billing/adjust, so any integration that consumes billing state can share one parser across all three.

active_users is always live. The endpoint recomputes count(active non-trial users) + sum(sub-reseller max_users) on every call, so the value can never be stale relative to the underlying rows.

Endpoint

GET https://<your-panel-domain>/panel-api/v1/resellers/{id}/billing

Authentication

Send the API key in the Authorization: Bearer <your-api-key> header. Both key types can call this endpoint:

  • Admin key: any reseller on the panel.
  • Reseller key: only the caller's own sub-resellers and their sub-resellers, the accounts it can list with List resellers. Any other ID, including the caller's own, returns 404 not_found, exactly like an ID that does not exist. The reseller's member group needs Can Create Subresellers.

Required scope

  • Admin key: resellers:read
  • Reseller key: subresellers:read

Path parameters

Name Type Description
id int The reg-user ID of the reseller.

Response

Every response has the five fields below. Which ones are populated depends on mode.

Field Type Description
mode string Either "credits" or "users".
credits float or null Current credit balance. Populated only in credits mode. null in users mode.
max_users int or null Slot cap. Populated only in users mode. null in credits mode.
active_users int or null Slots currently in use (active non-trial users plus slots reserved by sub-resellers). Populated only in users mode.
billing_expires int or null Unix timestamp in seconds after which the account can no longer create or renew lines. Present in either mode when the admin has set an expiration; null otherwise.

Response for a credits-mode reseller:

{
  "mode": "credits",
  "credits": 10,
  "max_users": null,
  "active_users": null,
  "billing_expires": null
}

Response for a users-mode reseller:

{
  "mode": "users",
  "credits": null,
  "max_users": 500,
  "active_users": 312,
  "billing_expires": 1793308800
}

Examples

cURL

curl -H "Authorization: Bearer <your-api-key>" \
  https://<your-panel-domain>/panel-api/v1/resellers/262260/billing

PHP SDK

require __DIR__ . '/api-panel-php-sdk-1.3.0/autoload.php';
use XtreamAI\PanelApi\PanelApiClient;

$client = new PanelApiClient(baseUrl: 'https://<your-panel-domain>', token: '<your-api-key>');
$billing = $client->resellers->billing(262260);
if ($billing->mode === 'credits') {
    echo 'credits balance: ', $billing->credits, PHP_EOL;
} else {
    echo 'slots: ', $billing->activeUsers, '/', $billing->maxUsers, PHP_EOL;
}

Python SDK

from xtream_ai_panel_api import PanelApiClient

client = PanelApiClient(base_url="https://<your-panel-domain>", token="<your-api-key>")
billing = client.resellers.billing(262260)
if billing.mode == "credits":
    print("credits balance:", billing.credits)
else:
    print("slots:", billing.active_users, "/", billing.max_users)

Errors

HTTP Error slug When it happens How to fix
401 invalid_key Missing, malformed, or unknown API key. Send a live key in Authorization: Bearer <token>.
403 insufficient_scope An admin key without resellers:read, or a reseller key without subresellers:read. Issue a new key with the scope named in details.required_scope.
403 sub_reseller_view_not_allowed Reseller key only: the reseller's member group does not have Can Create Subresellers enabled. Ask the panel administrator to enable it for the group.
404 not_found No reseller exists with that ID or, on a reseller key, the ID is outside the caller's sub-resellers. Verify the ID with GET /resellers/{id} first.
429 rate_limited The per-key request budget for this minute is spent. Back off and retry after the minute rolls over.

See also