Skip to content
Niu DocsNiu 牛元文档
Dashboard控制台

Read shared company account balances

Generated from the checked-in source. Do not edit this reference by hand.

GET /api/v1/organizations/{organization}/billing/balance

Requires organization-wide owner/admin access or installation administration. Workspace-only sessions and organization viewers cannot read shared funds. Exact nanounit amounts are decimal strings. Available funds equal posted balance plus approved credit minus outstanding liabilities (including known media charges above their original holds); each request must still atomically reserve its full liability. No account identifiers, Provider prices or payment references are exposed. Storage reads retain one amount snapshot with transaction-local 250 ms lock and 2 s statement limits. Timeout returns sanitized 503, never zero balances or partial success; pool admission and a complete HTTP deadline remain separate.

Operation: getCustomerBalance.

Use the credential and permission scope described above. Each object below is an alternative; schemes within one object are required together.

JSON
[
{
"bearerAuth": []
}
]

Set NIU_ORIGIN to your installation origin (without /v1). Replace path, query and header placeholders with the required values. Query examples use curl 7.87 or newer to encode values with --url-query. Use the credential scope described above; a bearer token must have the authority required by this operation.

Shell
curl --fail-with-body -X GET "$NIU_ORIGIN/api/v1/organizations/{organization}/billing/balance" \
-H "Authorization: Bearer $NIU_BEARER_TOKEN"

Location: path. Required.

JSON
{
"type": "string",
"format": "uuid"
}

No request body is declared.

Customer balance summaries by currency

Content type: application/json.

JSON
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"required": [
"currency",
"balance_nanos",
"reserved_nanos",
"outstanding_nanos",
"available_nanos",
"credit_limit_nanos",
"warning_threshold_nanos",
"policy_revision",
"low_balance",
"posted_credit_exhausted"
],
"properties": {
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"balance_nanos": {
"type": "string",
"pattern": "^-?[0-9]+$"
},
"reserved_nanos": {
"type": "string",
"pattern": "^[0-9]+$"
},
"outstanding_nanos": {
"type": "string",
"pattern": "^[0-9]+$",
"description": "Open customer liabilities, including known media charges above their original holds, excluding already posted debits."
},
"available_nanos": {
"type": "string",
"pattern": "^-?[0-9]+$",
"description": "Posted balance plus approved credit minus outstanding_nanos; may be negative."
},
"credit_limit_nanos": {
"type": "string",
"pattern": "^[0-9]+$"
},
"policy_revision": {
"type": "string",
"pattern": "^[0-9]+$"
},
"warning_threshold_nanos": {
"type": [
"string",
"null"
],
"pattern": "^[0-9]+$"
},
"low_balance": {
"type": "boolean"
},
"posted_credit_exhausted": {
"type": "boolean"
}
}
}
}
}
}

Authentication required

Company account access not granted

Requires organization-wide owner/admin access or installation administration. Workspace-only sessions and organization viewers cannot read shared funds. Exact nanounit amounts are decimal strings. Available funds equal posted balance plus approved credit minus outstanding liabilities (including known media charges above their original holds); each request must still atomically reserve its full liability. No account identifiers, Provider prices or payment references are exposed. Storage reads retain one amount snapshot with transaction-local 250 ms lock and 2 s statement limits. Timeout returns sanitized 503, never zero balances or partial success; pool admission and a complete HTTP deadline remain separate.

Supported scope: implemented