Solver Cloudflare

Get Balance

Code
POST https://solvercf.com/token/extension/getBalance

Returns your current account balance. Doesn't cost anything to call — safe to use for health checks or to validate a clientKey before running a batch job.

Request

Field Type Required Description
clientKey string yes Your account API key
softId int no Accepted for CapMonster compatibility, not used by SolverCF
JSON
{ "clientKey": "YOUR_CLIENT_KEY" }

Response

Field Type Description
balance number Your account balance, in the same currency unit used for task pricing (see Task Types & Pricing)
balanceWorker number Balance earned from running a worker (see the browser extension) — separate from your spendable balance
errorId int 0 = success, 1 = failed
JSON
{
  "balance": 12.4521,
  "balanceWorker": 0,
  "errorId": 0
}

Usage patterns

  • Validate a key before a run: call this once at the start of a batch job to fail fast on a bad clientKey rather than discovering it after burning through your task queue.
  • Pre-flight balance check: compare balance against the expected cost of your batch (task count × price, see Task Types & Pricing) before kicking off a large run, so you don't stop halfway through with balance not enough errors.

Code examples

Example: cURL

cURL
curl -X POST https://solvercf.com/token/extension/getBalance \
  -H "Content-Type: application/json" \
  -d '{ "clientKey": "YOUR_CLIENT_KEY" }'

Example: Python

Python
import requests

response = requests.post("https://solvercf.com/token/extension/getBalance", json={
    "clientKey": "YOUR_CLIENT_KEY",
})
print(response.json()["balance"])

Example: JavaScript

JavaScript
const response = await fetch("https://solvercf.com/token/extension/getBalance", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ clientKey: "YOUR_CLIENT_KEY" }),
});
const { balance } = await response.json();
console.log(balance);

Example: C#

C#
using var client = new HttpClient();
var response = await client.PostAsJsonAsync("https://solvercf.com/token/extension/getBalance", new
{
    clientKey = "YOUR_CLIENT_KEY",
});
Console.WriteLine(await response.Content.ReadAsStringAsync());