curl --request PATCH \
--url https://prod-api.ringg.ai/ca/api/v0/workspace/sub/credit-balances \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"allocations": {
"00000000-0000-4000-8000-000000000101": 5000,
"00000000-0000-4000-8000-000000000114": 3000
}
}
'import requests
url = "https://prod-api.ringg.ai/ca/api/v0/workspace/sub/credit-balances"
payload = { "allocations": {
"00000000-0000-4000-8000-000000000101": 5000,
"00000000-0000-4000-8000-000000000114": 3000
} }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allocations: {
'00000000-0000-4000-8000-000000000101': 5000,
'00000000-0000-4000-8000-000000000114': 3000
}
})
};
fetch('https://prod-api.ringg.ai/ca/api/v0/workspace/sub/credit-balances', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"parent_workspace_id": "00000000-0000-4000-8000-000000000107",
"parent_available_balance": "12000.00",
"allocations": {
"00000000-0000-4000-8000-000000000101": "5000.00",
"00000000-0000-4000-8000-000000000114": "3000.00"
},
"primary": {
"id": "00000000-0000-4000-8000-000000000107",
"name": "Acme Collections HQ"
}
}{
"message": "These allocations need 9000.00 from the primary's pot, which only holds 4000.00. Lower the allocations or add balance to the primary workspace first."
}{
"message": "Invalid credentials"
}{
"message": "Sub-workspaces are not enabled for this workspace."
}{
"message": "Workspace is not a sub-workspace family parent."
}{
"message": "An unexpected error occurred. Please try again later."
}Reallocate Credit Balances
Set every Ringg Space’s wallet to an absolute balance, moving the difference to or from the primary, for prepaid families in individual billing mode.
curl --request PATCH \
--url https://prod-api.ringg.ai/ca/api/v0/workspace/sub/credit-balances \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"allocations": {
"00000000-0000-4000-8000-000000000101": 5000,
"00000000-0000-4000-8000-000000000114": 3000
}
}
'import requests
url = "https://prod-api.ringg.ai/ca/api/v0/workspace/sub/credit-balances"
payload = { "allocations": {
"00000000-0000-4000-8000-000000000101": 5000,
"00000000-0000-4000-8000-000000000114": 3000
} }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allocations: {
'00000000-0000-4000-8000-000000000101': 5000,
'00000000-0000-4000-8000-000000000114': 3000
}
})
};
fetch('https://prod-api.ringg.ai/ca/api/v0/workspace/sub/credit-balances', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"parent_workspace_id": "00000000-0000-4000-8000-000000000107",
"parent_available_balance": "12000.00",
"allocations": {
"00000000-0000-4000-8000-000000000101": "5000.00",
"00000000-0000-4000-8000-000000000114": "3000.00"
},
"primary": {
"id": "00000000-0000-4000-8000-000000000107",
"name": "Acme Collections HQ"
}
}{
"message": "These allocations need 9000.00 from the primary's pot, which only holds 4000.00. Lower the allocations or add balance to the primary workspace first."
}{
"message": "Invalid credentials"
}{
"message": "Sub-workspaces are not enabled for this workspace."
}{
"message": "Workspace is not a sub-workspace family parent."
}{
"message": "An unexpected error occurred. Please try again later."
}Rules
- The net amount moving out of the primary’s pot cannot exceed what the pot holds. Top up on the primary first, then allocate.
- A Ringg Space with a
0balance cannot place calls; Ringg Spaces have no overdraft. - Every move is recorded in the workspace ledgers as a transfer, never as a charge.
- In a common-billing family the wallet is shared on the primary and Ringg Spaces hold nothing, so this endpoint returns
400. Allocate concurrency instead.
Notes
- Read the current wallets and
family.available_potfrom Get Ringg Spaces first, then send the full map. - Amounts in the request can be JSON numbers (
200000) or numeric strings ("200000.00"); they are rounded to two decimals. - Amounts in the response are decimal strings (
"5000.00"), unlike the read endpoints.
Errors
400:Balance allocation applies to prepaid families only.400:This family uses a shared balance; per-sub wallets do not exist.400:allocations name workspaces that are not active sub-workspaces of this family: [...]400:allocations must cover every active sub-workspace; missing: [...]400:These allocations need 9000.00 from the primary's pot, which only holds 4000.00. Lower the allocations or add balance to the primary workspace first.401: Invalid or missing API key.403:Sub-workspaces are not enabled for this workspace.— Ringg Spaces are not enabled on the primary, or the key belongs to a Ringg Space.404:Workspace is not a sub-workspace family parent.— the primary has no Ringg Spaces yet.422: Empty map, negative value, or a key that is not a UUID.
Authorizations
Headers
(Required) The API key of the PRIMARY workspace. A Ringg Space's own key is refused (403, or 400 if Ringg Spaces are enabled on it).
"rg_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Body
(Required) sub_workspace_id -> the Ringg Space's NEW absolute balance (not a delta). Must include every active Ringg Space exactly once. Values >= 0, two decimals. Values may be JSON numbers (200000) or numeric strings ("200000.00").
Show child attributes
Show child attributes
Response
Successful Response: The applied balances. Amounts are decimal strings.
"00000000-0000-4000-8000-000000000107"
The primary's unallocated pot after the move, as a decimal string.
"12000.00"
Show child attributes
Show child attributes
{
"00000000-0000-4000-8000-000000000101": "5000.00",
"00000000-0000-4000-8000-000000000114": "3000.00"
}
Show child attributes
Show child attributes
Was this page helpful?