查询当前账户¶
查询当前用户可访问的计费账户及 Credit 余额。首次查询时,系统会根据用户信息准备计费账户。
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"
此接口没有请求参数。
成功响应¶
{
"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 |
计费账户 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 |
返回的总记录数。 |
错误响应¶
缺少认证信息时返回 HTTP 401。在请求头中提供有效的个人访问令牌。
{
"code": "unauthenticated",
"message": "missing bearer token",
"error": "missing bearer token"
}
字段 |
类型 |
说明 |
|---|---|---|
|
string |
错误代码。 |
|
string |
错误说明。 |
|
string |
错误说明,内容与 |
选择账户¶
从 items 中选择账户,保存该项的 billing_account_id,用于按账户查询。