Ledga

Pagination

List endpoints page with an opaque cursor; sort order is fixed per resource.

Request

Parameter Default Limit
limit 25 100
cursor Token from a previous response
curl "https://ledga.io/api/v1/transactions?limit=50&cursor=eyJpZCI6..." \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret"

Response

{
  "success": true,
  "data": [ ],
  "meta": {
    "pagination": {
      "limit": 50,
      "has_more": true,
      "next_cursor": "eyJpZCI6...",
      "previous_cursor": null
    }
  }
}

Stop when has_more is false. Cursors encode a position, not a page number, so inserts and deletes never shift or repeat rows. Sorting is fixed (transactions newest first, accounts by code) and cannot be changed.

PHP

$page = $ledga->accounts->list(['limit' => 25]);
while (true) {
    foreach ($page->data as $account) { /* ... */ }
    if (! $page->hasMore()) break;
    $page = $page->nextPage();
}

foreach ($ledga->accounts->all() as $account) { /* every page, lazily */ }