查询当前账户¶
查询当前用户可访问的 Billing 账户及 Credit 余额。首次查询时,系统会按当前用户信息准备 Billing 账户。
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/current
调用前准备¶
准备有效的个人访问令牌。
请求示例¶
将示例中的 $MOI_PERSONAL_ACCESS_TOKEN 替换为个人访问令牌。
curl -X GET \
"https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/current" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
成功响应¶
请求成功时返回 HTTP 200 和当前用户可访问的 Billing 账户及其 Credit 余额。
{
"items": [
{
"billing_account_id": "billing_account_example",
"owner_type": "uc_account",
"owner_id": "owner_example",
"display_name": "Example account",
"region": "cn",
"status": "active",
"default_currency": "CNY",
"credit_balance": "100.000000000000",
"credit_cash_balance": "80.000000000000",
"credit_grant_balance": "20.000000000000",
"credit_reserved": "10.000000000000",
"credit_available": "90.000000000000",
"credit_overdraft_balance": "0.000000000000",
"risk_level": "normal",
"created_at": 1788739200,
"updated_at": 1788739200
}
],
"total": 1
}
字段 |
类型 |
说明 |
|---|---|---|
|
array of object |
本次返回的记录。 |
|
string |
Billing 账户 ID。 |
|
string |
账户归属主体类型。 |
|
string |
账户归属主体 ID。 |
|
string |
账户显示名称。 |
|
string |
账户地区。 |
|
string |
账户状态。 |
|
string |
账户默认支付币种。 |
|
string |
Credit 余额。 |
|
string |
充值 Credit 余额。 |
|
string |
赠送 Credit 余额。 |
|
string |
已预留的 Credit。 |
|
string |
可用 Credit。 |
|
string |
透支钱包余额。 |
|
string |
账户风险等级。 |
|
string |
账户状态原因,存在时返回。 |
|
integer |
停用时间,Unix 秒;存在时返回。 |
|
integer |
关闭时间,Unix 秒;存在时返回。 |
|
integer |
创建时间,Unix 秒。 |
|
integer |
更新时间,Unix 秒。 |
|
integer |
返回的总记录数。 |
字段路径中的 [] 表示数组中的每一项。例如,items[].billing_account_id 表示数组中每一项的对应字段。
错误响应¶
缺少认证信息时返回 HTTP 401,请提供有效的个人访问令牌。
{
"code": "unauthenticated",
"message": "missing bearer token",
"error": "missing bearer token"
}
字段 |
类型 |
说明 |
|---|---|---|
|
string |
错误代码。 |
|
string |
错误说明。 |
|
string |
兼容错误说明,与 message 内容相同。 |
选择账户¶
从 items 中选择账户,保存该项的 billing_account_id,用于按账户查询。