# getBalance — Cek Saldo

> POST /getBalance menampilkan saldo akun dalam poin (1,000 poin = ¥1) serta saldo bagi hasil developer dan hadiah referral. Tidak memotong poin; bisa dipakai untuk memverifikasi ClientKey.

Source: https://docs.yescaptcha.com/id/api/get-balance/ · Last verified: 2026-10-15

> This page was machine-translated from the Chinese version. If anything differs, the Chinese version prevails: https://docs.yescaptcha.com/zh/api/get-balance/

`getBalance` mengembalikan sisa poin akun (1,000 poin = ¥1) serta saldo bagi hasil developer dan hadiah referral (dalam yuan). Tidak ada pemotongan poin, sehingga sering dipakai untuk memastikan `clientKey` sudah benar.

- POST `https://api.yescaptcha.com/getBalance` (Endpoint global)
- POST `https://cn.yescaptcha.com/getBalance` (Endpoint Tiongkok)

## Parameter permintaan

| Field | Tipe | Wajib | Keterangan |
| --- | --- | --- | --- |
| `clientKey` | string | Ya | ClientKey akun |

```json
{
  "clientKey": "YOUR_CLIENT_KEY"
}
```

## Hasil yang dikembalikan

```json
{
  "errorId": 0,
  "balance": 1071810,
  "softBalance": 36.0098,
  "inviteBalance": 0,
  "inviteBy": 0
}
```

| Field | Tipe | Keterangan |
| --- | --- | --- |
| `balance` | integer | Saldo akun dalam poin (1,000 poin = ¥1). Harus lebih dari 10 poin untuk membuat tugas |
| `softBalance` | number | Saldo bagi hasil developer dalam yuan, lihat [Bagi hasil developer](https://docs.yescaptcha.com/id/account/developer.md) |
| `inviteBalance` | number | Saldo hadiah referral dalam yuan, lihat [Hadiah referral](https://docs.yescaptcha.com/id/account/referral.md) |
| `inviteBy` | integer | ID pengguna yang mengundang Anda mendaftar, bernilai 0 jika tidak ada |
| `keyQuotaRemaining` | integer | Sisa batas pengeluaran `clientKey` ini untuk periode berjalan, dalam poin. Field ini hanya ada pada `clientKey` yang memiliki batas; `balance` lalu berisi nilai yang lebih kecil antara saldo akun dan sisa batas. `clientKey` tanpa batas tidak menyertakan field ini |

`clientKey` yang salah mengembalikan `ERROR_KEY_DOES_NOT_EXIST`. Jika `clientKey` memiliki whitelist IP dan permintaan datang dari IP yang tidak terdaftar, hasilnya `ERROR_KEY_IP_NOT_ALLOWED`. `getBalance` terkena [jeda otomatis](https://docs.yescaptcha.com/id/api/rate-limits.md): selama jeda, hasilnya `ERROR_IP_BLOCKED_5MIN`.

## Contoh

**curl**

get-balance.sh

```bash
#!/usr/bin/env bash
# Check the balance. getBalance is free and is a quick way to verify your clientKey
set -euo pipefail
curl -s https://api.yescaptcha.com/getBalance \
  -H 'Content-Type: application/json' \
  -d "{\"clientKey\": \"${YESCAPTCHA_CLIENT_KEY}\"}"
echo
```

**Python**

get_balance.py

```python
"""Check the balance. getBalance is free and is a quick way to verify your clientKey."""
import os

import requests

CLIENT_KEY = os.environ["YESCAPTCHA_CLIENT_KEY"]

r = requests.post(
    "https://api.yescaptcha.com/getBalance",
    json={"clientKey": CLIENT_KEY},
    timeout=30,
)
data = r.json()
if data.get("errorId"):
    # e.g. ERROR_KEY_DOES_NOT_EXIST when the clientKey is wrong
    print("error:", data.get("errorCode"), data.get("errorDescription"))
else:
    print("balance (points):", data["balance"])
```

**Node.js**

get-balance.mjs

```js
// Check the balance. getBalance is free and is a quick way to verify your clientKey. Node.js 18+
const CLIENT_KEY = process.env.YESCAPTCHA_CLIENT_KEY;

const res = await fetch('https://api.yescaptcha.com/getBalance', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ clientKey: CLIENT_KEY }),
});
const data = await res.json();
if (data.errorId) {
  // e.g. ERROR_KEY_DOES_NOT_EXIST when the clientKey is wrong
  console.log('error:', data.errorCode, data.errorDescription);
} else {
  console.log('balance (points):', data.balance);
}
```
