Skip to Content
AnySolver logo
AnySolver

getBalance

Read your organization balance in USD with getBalance. One balance pays for tasks on every provider, and checking it is free and needs only your API key.

getBalance returns your organization balance in USD. The one balance pays for tasks on every provider, and reading it is free.

POSThttps://api.anysolver.com/getBalance

Authentication

Send an active API key of the organization as clientKey in the JSON body, with the header Content-Type: application/json. A missing clientKey returns VALIDATION_ERROR, and an unknown key returns ERROR_KEY_DOES_NOT_EXIST.

Request body

FieldTypeRequiredDescription
clientKey*
stringYes

Your API key. Create one in a workspace of the AnySolver dashboard.

Example

{
    "clientKey": "YOUR_API_KEY"
}

Response body

FieldTypeRequiredDescription
errorId*
Yes

0 on success; 1 or 2 on an error. Branch on errorCode: Error IDs explains the two error groups.

errorCode
No

Machine-readable error code.

errorDescription
stringNo

Human-readable error message with resolution hints.

balance
numberNo

Account balance in USD.

balance already excludes the estimates of tasks still processing: createTask deducts each task's estimate when it creates the task. The balance changes again when a task ends and its charge is adjusted to the final price, or refunded for a refundable failure. Pricing and billing explains each step.

Examples

{
    "errorId": 0,
    "balance": 12.5
}

Errors

getBalance returns errors with HTTP 200, like every endpoint except GET /health.

Error codeCauseFix
ERROR_KEY_DOES_NOT_EXISTclientKey is empty or does not match an active API key.Copy the key again from the API keys page of its workspace, opened from Workspaces.

Every code: Error handling.