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";
Parameters & Headers
| Location | Name | Required | Description |
|---|---|---|---|
| Header | x-api-key | Conditional | Customer API key (YOUR_API_KEY), or Authorization: Bearer YOUR_API_KEY. |
Success Response (200 OK)
{
"userId": "usr_mock_01",
"apiKeyId": "key_mock_01",
"currency": "USDT",
"available": "100.000000",
"limits": {
"monthlySpendCap": "250.000000",
"perRequestCap": "50.000000",
"expiresAt": null
}
}
Error Responses
| HTTP | error.code | Cause |
|---|---|---|
401 | UNAUTHORIZED | Missing, malformed, invalid, revoked, or expired key |
402 | INSUFFICIENT_BALANCE | Balance negative |
403 | FORBIDDEN | Disabled key or suspended owning user |
403 | FRAUD_DETECTED | Multi-IP anomaly or IP cooldown block |
429 | RATE_LIMITED | Per-key or per-user general rate limit exceeded |
500 | INTERNAL_ERROR | Unexpected server failure |
{
"error": {
"code": "FORBIDDEN",
"message": "Owning user account is suspended"
}
}