Skip to main content
PATCH
Reallocate Credit Balances
Set every sub-workspace’s wallet to an absolute balance. The net difference moves from or to the primary’s unallocated pot. Prepaid families in individual billing mode only.

When to use

  • Distributing a top-up made on the primary across clients or teams.
  • Pulling unused balance back from one sub-workspace to fund another.

Request parameters

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 sub-workspace with a 0 balance cannot place calls; sub-workspaces have no overdraft.
  • Every move is recorded in the workspace ledgers as a transfer, never as a charge.

Integration notes

  • Authenticate with the primary workspace’s API key.
  • Read the current wallets and family.available_pot from Get Sub-workspaces first, then send the full map.
  • Amounts in the response are decimal strings ("5000.00"), unlike the read endpoints.
In a common-billing family the wallet is shared on the primary and sub-workspaces hold nothing. This endpoint returns 400 This family uses a shared balance; per-sub wallets do not exist. Allocate concurrency instead.

Error responses

  • 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.
  • 404: Workspace is not a sub-workspace family parent. — the primary has no sub-workspaces yet.
  • 422: Empty map, negative value, or a key that is not a UUID.

Example

Headers

X-API-KEY
string
required

(Required) The API key of the PRIMARY workspace. A sub-workspace's key is refused with 400.

Example:

"7251cb4b-3373-43a4-844c-b27a1d45e0c9"

Body

application/json
allocations
object
required

(Required) sub_workspace_id -> the sub-workspace's NEW absolute balance (not a delta). Must include every active sub-workspace exactly once. Values >= 0, two decimals.

Response

Successful Response: The applied balances. Amounts are decimal strings.

parent_workspace_id
string
Example:

"2f9a1c44-7e88-4bb1-9a01-5d3c2e7f6a11"

parent_available_balance
string

The primary's unallocated pot after the move, as a decimal string.

Example:

"12000.00"

allocations
object
Example:
primary
object