Get Account Balance
Verifies your API key, active account status, rate limits, and returns the owning user's live USDT balance along with key spend limits.
Always verify funds before fulfilling downstream reseller checkouts, remembering that POST /api/v1/purchases also performs an atomic SELECT ... FOR UPDATE balance check server-side.
- cURL
- JavaScript (fetch)
- Python (requests)
- PHP
curl -sS -X GET "https://api.example.com/api/v1/balance" \
-H "x-api-key: YOUR_API_KEY" \
-H "Accept: application/json"
const res = await fetch("https://api.example.com/api/v1/balance", {
method: "GET",
headers: {
"x-api-key": process.env.GPKEYS_API_KEY ?? "YOUR_API_KEY",
Accept: "application/json",
},
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(`HTTP ${res.status}: ${JSON.stringify(err)}`);
}
const data = await res.json();
console.log(data);
import os
import requests
headers = {
"x-api-key": os.environ.get("GPKEYS_API_KEY", "YOUR_API_KEY"),
"Accept": "application/json",
}
resp = requests.get("https://api.example.com/api/v1/balance", headers=headers, timeout=15)
resp.raise_for_status()
print(resp.json())
<?php
$apiKey = getenv('GPKEYS_API_KEY') ?: 'YOUR_API_KEY';
$ch = curl_init('https://api.example.com/api/v1/balance');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTPHEADER => [
'x-api-key: ' . $apiKey,
'Accept: application/json',
],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP {$status}\n" . ($body) . "\n";