getBalance
Retrieve the current balance associated with your API key. The balance is returned in USD.
Endpoint
Section titled “Endpoint”POST https://api.ucaptcha.net/getBalanceRequest
Section titled “Request”{ "clientKey": "YOUR_API_KEY"}Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
clientKey | string | Yes | Your API key |
Response
Section titled “Response”{ "errorId": 0, "balance": 50.2500}Response Parameters
Section titled “Response Parameters”| Field | Type | Description |
|---|---|---|
errorId | number | 0 for success, 1 for error |
balance | number | Current account balance in USD |
Code Examples
Section titled “Code Examples”curl -X POST https://api.ucaptcha.net/getBalance \ -H "Content-Type: application/json" \ -d '{ "clientKey": "YOUR_API_KEY" }'Python
Section titled “Python”import requests
response = requests.post("https://api.ucaptcha.net/getBalance", json={ "clientKey": "YOUR_API_KEY"})
data = response.json()
if data["errorId"] == 0: print(f"Balance: ${data['balance']:.4f}")else: print(f"Error: {data['errorCode']} - {data['errorDescription']}")JavaScript
Section titled “JavaScript”const response = await fetch("https://api.ucaptcha.net/getBalance", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientKey: "YOUR_API_KEY", }),});
const data = await response.json();
if (data.errorId === 0) { console.log(`Balance: $${data.balance.toFixed(4)}`);} else { console.error(`Error: ${data.errorCode} - ${data.errorDescription}`);}