Skip to main content

Balance Query API

The Balance Query API retrieves the available balance of an account and its API Keys, supporting enterprise operations monitoring, per-key troubleshooting, and self-service for individual developers. The Base URL is https://tokenplus.net.

There are 3 balance endpoints, distinguished by the credential used to determine the permission scope:

EndpointCredentialCapabilityRate limit
GET /v1/balanceManagement KeyQuery the account balance and balances of all Regular Keys60 requests/min
GET /v1/keys/{key_id}/balanceManagement KeyQuery balance details for a specified Regular Key under the same account60 requests/min
GET /v1/me/balanceRegular KeyQuery the owning account balance and the current Key's balance info120 requests/min

Permission boundaries:

  • A Management Key can only call the first two endpoints and cannot call /v1/me/balance.
  • A Regular Key can only call /v1/me/balance and cannot call the Management balance endpoints.
  • /v1/balance only returns Regular Keys and does not support querying or enumerating Management Keys.
  • When a specified Key does not exist, has been deleted, or belongs to another account, the unified response is 404 key_not_found.

General Request Conventions​

ItemConvention
Base URLhttps://tokenplus.net
Request methodGET
Auth headerAuthorization: Bearer {api-key}
Response typeContent-Type: application/json
Time formatRFC 3339 UTC, e.g. 2026-08-06T08:00:00Z

Money and Null Value Semantics​

  • All amounts are denominated in USD and returned at the top level as currency: "USD".
  • All amounts and percentages are decimal strings, e.g. "850", "85.5", "42.75".
  • null means the field does not apply, is unlimited, or a trustworthy value is currently unavailable; the exact meaning follows the field description.
  • Callers must not automatically convert null to 0.

Snapshot and Cache​

  • Every successful response contains as_of, representing the time of the committed data snapshot.
  • When queries and consumption run concurrently, there is no guarantee that the balance will not continue to change after the response.
  • All success and error responses must include Cache-Control: private, no-store.

Field Definitions​

FieldTypeNullableDescription
objectstringNobalance, key_balance, or self_balance
currencystringNoAlways USD
as_ofstringNoResponse data snapshot time, RFC 3339 UTC
account.total_balancedecimal stringNoAccount's current online spendable wallet balance; negative values are displayed as "0"
account.total_consumeddecimal stringNoAccount cumulative consumption; returned only by the Management list endpoint
account.paid_balancenullYesNot available this period; always returns null
account.free_balancenullYesNot available this period; always returns null
account.paid_consumednullYesNot available this period; appears only in the Management list endpoint
account.free_consumednullYesNot available this period; appears only in the Management list endpoint
account.breakdown_statusstringNoAlways unavailable this period

total_balance is the online spendable balance and is not the same as a refundable balance. Customer support or finance must not calculate refund amounts based solely on this endpoint.

Balance and Period Calculation Rules​

Account Balance​

  • total_balance reads only the account's online authoritative balance.
  • When the account balance is negative, it is displayed as "0" externally with an anomaly logged; a negative available balance is not returned.

Key Balance​

Key situationkey_limit_remainingeffective_remaining
Has an independent limitRemaining key limit, minimum "0"The amount actually usable between the wallet balance and the remaining key limit
Unlimited keynullConstrained by the account balance or the corresponding funding source
Disabled, expired, or exhaustedStill returned according to the limit stateStill returns the actual quota projection at query time; the query endpoint itself returns 200

Period​

  • daily, weekly, and monthly form a rolling period based on the time the key was saved, not split by natural day, week, or month.
  • Periods are uniformly expressed as [start, end_exclusive).
  • period.end and period.days_remaining are not provided to avoid boundary ambiguity and client timezone differences.
  • When limit_reset=never or there is no period policy, period=null.

Error Responses​

Fixed format:

{
"error": {
"code": "key_not_found",
"message": "API key not found.",
"param": "key_id",
"request_id": "req_..."
}
}

Clients must branch on the HTTP status code and error.code, and must not match on the message text.

Rate Limit, Security, and Privacy​

  • Two Management endpoints: 60 requests/min each per Management Key, user, and source IP.
  • Regular self-service endpoint: 120 requests/min per Regular Key, user, and source IP.
  • Exceeding any dimension returns 429 rate_limit_exceeded.

Security and privacy:

  • Does not return Regular Key plaintext, key hash, full preview, or internal auto-increment ID.
  • Does not return or enumerate Management Keys.
  • Cross-account keys and non-existent keys use the same 404 to prevent resource probing.
  • All success and error responses prohibit storage by browsers or intermediate proxies.
Online Service