šŸ“‘Pagination

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

ParameterTypeDefaultDescription
pageinteger1The page number to retrieve (starts at 1)
perPageinteger20Number 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"

Response Structure

Paginated responses include the data array and a meta object with pagination metadata:

info-circle

Subunit Precision for Financial Amounts

All amount fields 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

FieldTypeDescription
pageintegerThe current page number
pageCountintegerTotal number of pages available
totalintegerTotal number of items across all pages
perPageintegerNumber of items per page (as requested)
skippedintegerNumber 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++;
  }
}