Get Account Balance¶
GET /api/v1/billing/balance/get
Overview¶
Reads the three types of balances of the Billing Center account corresponding to the current workspace.
Before Calling and Usage Steps¶
Use the API Key of the target workspace. You can only read data from the Billing Center site corresponding to the workspace to which the Key belongs; you cannot switch via additional workspaceUUID/brandKey/site parameters. This API does not deduct fees, recharge, settle, or modify plans. Billing Center data may have generation or settlement delays; an empty result does not mean no consumption occurred. Verify against the actual billing period and the Billing Center. Amounts, currencies, precision, and statistical basis follow the Billing Center of that workspace. Studio does not perform conversion or add currency fields; do not treat example values as prices.
Requires any one of the following permissions: billing.billingRead, billing.billingWrite, or billing.workspaceUpgrade. There are no Query parameters that can control business behavior; workspaceUUID/accountUUID or the billing period cannot be used to switch queries. Additional Query parameters are ignored and do not change the workspace or billing period. The balance belongs to the Billing Center account; do not use it to infer the consumption quota of other workspaces. Studio extracts only the three keys cashBalance/couponBalance/storedCardBalance from the Billing Center balance result; other upstream fields are not automatically exposed. If the Billing Center omits any of these keys, the response becomes 500 and no 0 is filled in.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with the required permission from the API Key management of the target workspace. |
Additional Parameter Notes¶
Response Parameter Description:
Key Fields
| Parameter | Parameter Description |
|---|---|
| cashBalance | Cash account balance |
| couponBalance | Voucher balance |
| storedCardBalance | Stored value card balance |
Request Example¶
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | object | Balance view of the current Billing Center account; not a recharge/invoiceable amount. |
| content.cashBalance | JSON | Cash account balance, example number; the upstream value is passed through as-is, with no guaranteed fixed precision/currency or automatic conversion. |
| content.couponBalance | JSON | Voucher balance; the upstream value is returned as-is and does not represent a cash withdrawable balance. |
| content.storedCardBalance | JSON | Stored value card balance; the upstream value is returned as-is and does not represent cash balance. |
| content.declaration | object or null | The workspace common declaration attached to non-empty content; when not configured, it can be null or an empty object. This field is not added to an empty content object. |
{
"code": 200,
"content": {
"cashBalance": 1000.25,
"couponBalance": 20.0,
"storedCardBalance": 0.0,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
The Billing Center SDK first maps ft.CloudCareApiError and overrides it with the upstream HTTP/business code; because the SDK does not set a passthrough flag, a final code greater than or equal to 500 is globally wrapped as HTTP 500, ft.InternalServerError, and generic text. Do not assume that 503 or the original 5xx message is preserved externally. When the final code is less than 500, CloudCareApiError and the actual message are preserved. Connection exceptions default to 400. This section lists only verified Studio mappings and does not exhaustively cover all Billing Center business errors or proxy errors.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 404 | ft.ObjectNotExists | Cannot find the workspace record corresponding to the current Key | The specified object does not exist | Verify the target workspace and that the Key is valid. |
| 406 | ft.InvalidBossNode | The Billing Center brand/node bound to the workspace is not configured or is unavailable | Invalid Boss node | Contact the administrator to check the workspace Billing Center binding and site configuration; do not bypass it by changing the date. |
| 400 | ft.CloudCareApiError | Billing Center request connection failure (defaults to 400), or an upstream HTTP/business error with a mapped code less than 500 | Internal API call failed | Retain the HTTP status, message, and traceId; check Billing Center availability and the specific error. The final 4xx can vary; a code greater than or equal to 500 is globally wrapped as ft.InternalServerError. |
| 500 | ft.InternalServerError | The Billing Center returns an unexpected type/missing field, invalid JSON, or another storage or formatting error | Internal error | Retain traceId, contact the administrator to check the upstream response, and retry reading later. |