List current accounts¶
List Billing accounts accessible to the current user and their Credit balances. On the first query, the service provisions the Billing account from the current user identity.
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/current
Before you begin¶
Prepare a valid personal access token.
Request example¶
Replace $MOI_PERSONAL_ACCESS_TOKEN in the example with your personal access token.
curl -X GET \
"https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/current" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
Successful response¶
Returns HTTP 200 with the Billing accounts accessible to the current user and their Credit balances.
{
"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
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Records returned by this request. |
|
string |
Billing account ID. |
|
string |
Account owner type. |
|
string |
Account owner ID. |
|
string |
Account display name. |
|
string |
Account region. |
|
string |
Account status. |
|
string |
Default payment currency. |
|
string |
Credit balance. |
|
string |
Cash Credit balance. |
|
string |
Granted Credit balance. |
|
string |
Reserved Credit. |
|
string |
Available Credit. |
|
string |
Overdraft wallet balance. |
|
string |
Account risk level. |
|
string |
Account status reason, when available. |
|
integer |
Suspension time in Unix seconds, when available. |
|
integer |
Closure time in Unix seconds, when available. |
|
integer |
Creation time in Unix seconds. |
|
integer |
Update time in Unix seconds. |
|
integer |
Total number of returned records. |
In field paths, [] denotes each array item. For example, items[].billing_account_id refers to the corresponding field in each item.
Error response¶
Missing authentication returns HTTP 401; provide a valid personal access token.
{
"code": "unauthenticated",
"message": "missing bearer token",
"error": "missing bearer token"
}
Field |
Type |
Description |
|---|---|---|
|
string |
Error code. |
|
string |
Error message. |
|
string |
Compatibility error message, with the same content as message. |
Select an account¶
Select an account from items and retain its billing_account_id for account-scoped queries.
Use that account ID to get account overview or get billing settings.