List Balance Ledger
Returns cursor-paginated, append-only ledger transactions created by API keys owned by the authenticated user. Pass keyOnly=true to filter exclusively to the currently presented API key.
Each charge entry contains userId, apiKeyId, requestType, signed amount, createdAt, and balanceAfter.
- cURL
- JavaScript (fetch)
- Python (requests)
- PHP
curl -sS -X GET "https://api.example.com/api/v1/ledger?limit=10&keyOnly=true" \
-H "x-api-key: YOUR_API_KEY" \
-H "Accept: application/json"
const res = await fetch("https://api.example.com/api/v1/ledger?limit=10&keyOnly=true", {
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/ledger?limit=10&keyOnly=true", 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/ledger?limit=10&keyOnly=true');
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";
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Items per page (1–100). |
cursor | string | — | Pagination cursor from nextCursor. |
keyOnly | boolean | false | If true, returns only ledger rows created by the presented API key. |
Success Response (200 OK)
{
"items": [
{
"id": "cld_mock_001",
"userId": "usr_mock_01",
"apiKeyId": "key_mock_01",
"requestType": "PRODUCT_PURCHASE",
"type": "PURCHASE",
"status": "COMPLETED",
"amount": "-12.000000",
"balanceAfter": "88.000000",
"currency": "USDT",
"referenceType": "ORDER",
"referenceId": "ord_mock_001",
"description": "Purchase: Windows 11 Pro Retail Key",
"createdAt": "2026-11-30T18:10:00.000Z"
}
],
"nextCursor": null
}
Error Responses
| HTTP | error.code | Cause |
|---|---|---|
400 | VALIDATION_ERROR | Invalid query parameter |
401 | UNAUTHORIZED | Invalid, revoked, or expired key |
403 | FORBIDDEN / FRAUD_DETECTED | Disabled key, suspended user, or fraud block |
429 | RATE_LIMITED | Rate limit exceeded |
500 | INTERNAL_ERROR | Unexpected server error |