getBalance: retrieve account balance
Retrieve an account balance with its account key, Convenient to do your own alarm and query.
Example request
Request Structure
Parameters | Type | Required | Description |
---|---|---|---|
clientKey | String | Yes | Client account key, can be found here |
json
POST https://api.capsolver.com/getBalance
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY"
}
Example response
Response Structure
Parameter | Type | Description |
---|---|---|
errorId | Integer | Error message: 0 - no error 1 - with error |
errorCode | String | errorCode: full list of errors |
errorDescription | String | Short description of the error |
balance | Decimal | Account balance value in USD |
packages | Array | Monthly/Weekly Packages |
Example Response
json
{
"errorId": 0,
"balance": 1071810,
"packages": []
}
Use SDK Request
python
#pip install --upgrade capsolver
#export CAPSOLVER_API_KEY='...'
import capsolver
# capsolver.api_key = "..."
balance = capsolver.balance()
golang
package main
import (
capsolver_go "github.com/capsolver/capsolver-go"
"log"
)
func main() {
// first you need to install sdk
//go get github.com/capsolver/capsolver-go
//export CAPSOLVER_API_KEY='...' or
//capSolver := CapSolver{apiKey:"..."}
capSolver := capsolver_go.CapSolver{}
b, err := capSolver.Balance()
if err != nil {
log.Fatal(err)
}
log.Println(b.Balance)
}