Query Balance

Customers can query the organization balance programmatically with an API key (prefixed sk_live_) — no login session required. The API accepts API key authentication only, and the balance is organization-level.

Authentication

Put the API key in the request header:

Authorization: Bearer sk_live_YOUR_API_KEY

API keys are created on the console "API Keys" page, bound to an organization and a project.

API

GET/api/business/v1/customer/balance

查询余额

返回 API Key 所属组织的当前余额(points)。仅接受 API Key(sk_live_)鉴权,无需登录态。

Bearer API KeyUse the Authorization: Bearer sk_live_... header; x-api-key is also supported.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
GET https://silvamux.io/api/business/v1/customer/balance
Authorization: Bearer $SILVAMUX_API_KEY

Response

200组织当前余额。

application/json · CustomerBalanceResponse

FieldTypeDescription
balance_pointsstring当前余额(points)。

defaultRFC 7807 problem+json 错误(Business API 形态)。

application/problem+json · BusinessError

FieldTypeDescription
detailstring错误详情。
errorsarray<object>字段级错误明细(422 校验失败时返回)。
errors.locationstring出错位置(如 query.request_id)。
errors.messagestring错误信息。
errors.valueany出错字段的值。
instancestring本次错误出现的 URI。
statusintegerHTTP 状态码。
titlestring错误摘要。
typestring错误类型标识(含错误码)。

Examples

curl https://silvamux.io/api/business/v1/customer/balance \
  -H "Authorization: Bearer $SILVAMUX_API_KEY"

Response:

{
  "balance_points": "42.5",
  "overdraft_limit_points": "10",
  "overdraft_duration_hours": 48,
  "overdraft_started_at": "2026-11-16T08:00:00Z"
}
FieldTypeDescription
balance_pointsstringCurrent balance in points; negative means the organization is in overdraft
overdraft_limit_pointsstringOverdraft (credit) limit in points; 0 means overdraft is not enabled
overdraft_duration_hoursintegerOverdraft window in hours; calls still succeed within this window after the balance goes negative
overdraft_started_atstring | nullOverdraft window start time (RFC3339); null when not overdrafting

Overdraft

When the balance is insufficient, the organization may keep calling within overdraft_limit_points. The window starts at overdraft_started_at; once overdraft_duration_hours elapses or the limit is exhausted, requests are rejected.

Use these fields to decide when to top up:

  • balance_points negative → already overdrafting; watch the expiry from overdraft_started_at + overdraft_duration_hours.
  • overdraft_limit_points is 0 → overdraft is not enabled for this organization, so an exhausted balance blocks calls immediately.
  • overdraft_started_at non-null → the overdraft window has started; top up before it expires.

Error Handling

HTTPCodeDescription
401INVALID_TOKENAPI key missing or invalid