# Get the balance (CapSolver style)

> CapSolver-style getBalance: your prepaid balance in US dollars.

`POST https://api.solvecha.com/getBalance`


Returns the prepaid balance. Plan quotas and the free quota are not part of it: see [Get the status of your key](https://solvecha.com/docs/api/get-status.md) for those.

## Authorization

Send your API key as `Authorization: Bearer YOUR_API_KEY`. Other ways are the `key` field of the body and the `key` query parameter. See [Authentication](https://solvecha.com/docs/authentication.md).

## Request body

JSON, or url-encoded form data. The body is limited to 4.5 MB.

| Name | Type | Required | Description |
|---|---|---|---|
| `clientKey` | string | Yes | Your Solvecha API key. |

## Example request


**cURL**

```bash
curl -X POST "https://api.solvecha.com/getBalance" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"clientKey": "YOUR_API_KEY"}'
```

**Python**

```python
import requests

response = requests.post(
    "https://api.solvecha.com/getBalance",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"clientKey": "YOUR_API_KEY"},
)
print(response.status_code, response.json())
```

**Node.js**

```js
const response = await fetch("https://api.solvecha.com/getBalance", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"clientKey": "YOUR_API_KEY"}),
});
console.log(response.status, await response.json());
```

**Go**

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{"clientKey": "YOUR_API_KEY"}`)
	req, err := http.NewRequest("POST", "https://api.solvecha.com/getBalance", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	out, _ := io.ReadAll(resp.Body)
	fmt.Println(resp.StatusCode, string(out))
}
```


## Response

### 200 OK

The balance.

```json
{
  "errorId": 0,
  "errorCode": "",
  "errorDescription": "",
  "balance": 4.9998,
  "packages": []
}
```
