workspace/get_credits_by_id
Tool: read
Get the sending-credit balance of a workspace. The main account can read any of its workspaces; a workspace can read its own.
The response's creditMode says which pool the balance is drawn from: separate means the workspace holds its own credit pool; shared means it draws from the main account's pool — the balance is then the remaining monthly allocation when auto-allocation is on, otherwise the main account's own balance. mainAccountBalance is populated only when the main account is the caller; it is null when a workspace reads its own status.
Arguments
| name | type | req | notes |
|---|---|---|---|
| id | integer | ✓ | the object's workspaceId (int32) |
Response
200 — Workspace credit status.
| field | type | description |
|---|---|---|
| workspaceId | integer | Identifier of the workspace the balance belongs to. |
| creditMode | string | separate (own pool) or shared (draws from the main account). |
| balance | integer | Effective available sending credits — see creditMode above for what it draws from. |
| mainAccountBalance | integer | Current balance of the main account; null except on a main-account read of this workspace. |
Errors: 400, 401, 403, 404, 406, 422, 429, 500 — shared schema: schemas/errors.
Invoke
Call read with name: "workspace/get_credits_by_id".