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.
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.
GET /api/business/v1/customer/balance
查询余额
返回 API Key 所属组织的当前余额(points)。仅接受 API Key(sk_live_)鉴权,无需登录态。
🔑 Bearer API Key Use 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.
GET https://www.silvamux.com/api/business/v1/customer/balance
Authorization: Bearer $SILVAMUX_API_KEYResponse 200组织当前余额。 application/json · CustomerBalanceResponse
Field Type Description balance_pointsstring 当前余额(points)。
defaultRFC 7807 problem+json 错误(Business API 形态)。 application/problem+json · BusinessError
Field Type Description detailstring 错误详情。 errorsarray<object> 字段级错误明细(422 校验失败时返回)。 errors.locationstring 出错位置(如 query.request_id)。 errors.messagestring 错误信息。 errors.valueany 出错字段的值。 instancestring 本次错误出现的 URI。 statusinteger HTTP 状态码。 titlestring 错误摘要。 typestring 错误类型标识(含错误码)。
curl https://www.silvamux.com/api/business/v1/customer/balance \
-H "Authorization: Bearer $SILVAMUX_API_KEY "
# pip install requests
import os
import requests
resp = requests.get(
"https://www.silvamux.com/api/business/v1/customer/balance",
headers={"Authorization": f"Bearer {os.environ['SILVAMUX_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json()) # {"balance_points": "42.5"}
// Node 18+ (built-in fetch)
const resp = await fetch(
"https://www.silvamux.com/api/business/v1/customer/balance",
{
headers: { Authorization: `Bearer ${process.env.SILVAMUX_API_KEY}` },
},
);
const data = await resp.json();
console.log(data); // { balance_points: "42.5" }
// Standard library only
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://www.silvamux.com/api/business/v1/customer/balance", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SILVAMUX_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
cURL Python JavaScript Go
Response:
{
"balance_points" : "42.5"
}
Field Description balance_pointsCurrent balance (points)
HTTP Code Description 401 INVALID_TOKENAPI key missing or invalid