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.
https://api.anysolver.com /getBalanceAuthentication
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
| Field | Type | Required | Description |
|---|---|---|---|
clientKey* | string | Yes | Your API key. Create one in a workspace of the AnySolver dashboard. |
Example
{
"clientKey": "YOUR_API_KEY"
}Response body
| Field | Type | Required | Description |
|---|---|---|---|
errorId* | Yes |
| |
errorCode | No | Machine-readable error code. | |
errorDescription | string | No | Human-readable error message with resolution hints. |
balance | number | No | 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 code | Cause | Fix |
|---|---|---|
ERROR_KEY_DOES_NOT_EXIST | clientKey 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.
Related
POSTsolveTask
Create a CAPTCHA task and receive its result in one request with solveTask, which waits up to 80 seconds and charges exactly as createTask does.
GEThealth
Check from a monitor or load balancer whether the AnySolver API can accept tasks. GET /health needs no API key and answers 200 when ready, 503 when not.