Pagination
List endpoints return paginated results to maintain low-latency responses for global financial operations. When querying ledger history, multi-currency wallet transactions, or high-volume disbursements, pagination ensures consistent performance.
Pagination Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | The page number to retrieve (starts at 1) |
perPage | integer | 20 | Number of items per page (max: 100) |
Example Request
curl -X GET "https://api.sandbox.leatherback.co/v1/api/transactions?page=1&perPage=20" \
-H "X-Api: sk_test_YOUR_SECRET_KEY"const response = await fetch(
'https://api.sandbox.leatherback.co/v1/api/transactions?page=1&perPage=20',
{
headers: {
'X-Api': 'sk_test_YOUR_SECRET_KEY'
}
}
);
const result = await response.json();import requests
response = requests.get(
'https://api.sandbox.leatherback.co/v1/api/transactions',
headers={'X-Api': 'sk_test_YOUR_SECRET_KEY'},
params={'page': 1, 'perPage': 20}
)
result = response.json()Response Structure
Paginated responses include the data array and a meta object with pagination metadata:
Subunit Precision for Financial Amounts
All
amountfields are returned as integer subunits (e.g., 10000 = $100.00, 250000 = £2,500.00). This format ensures high-precision financial processing without floating-point errors. When sending amounts in requests, always use subunits.
{
"status": true,
"data": [
{
"id": "txn_123456",
"amount": 10000,
"currency": "USD",
"status": "completed"
},
{
"id": "txn_123457",
"amount": 25000,
"currency": "EUR",
"status": "pending"
}
],
"meta": {
"page": 1,
"pageCount": 5,
"total": 95,
"perPage": 20,
"skipped": 0
}
}Meta Object Fields
| Field | Type | Description |
|---|---|---|
page | integer | The current page number |
pageCount | integer | Total number of pages available |
total | integer | Total number of items across all pages |
perPage | integer | Number of items per page (as requested) |
skipped | integer | Number of items skipped to reach this page |
Traversing Pages
Check meta.page >= meta.pageCount to detect when you've reached the last page:
let page = 1;
while (true) {
const response = await fetch(
`https://api.sandbox.leatherback.co/v1/api/transactions?page=${page}&perPage=50`,
{
headers: { 'X-Api': 'sk_test_YOUR_SECRET_KEY' }
}
);
const result = await response.json();
if (result.status) {
// Process result.data
// Stop when we've reached the last page
if (result.meta.page >= result.meta.pageCount) {
break;
}
page++;
}
}