  1. [    Home ](/)
2. [Guides](/guides)
3. [Best Practices](/guides?category=29)
4. Working with Pagination
 
 beginner Best Practices      12 min       2 steps      8 min read  

# Working with Pagination

  A  admin  April 15, 2026  

 

 

       

 

 

 

 

 ##     Prerequisites 

 

 

 

 

 ## On this page

  
  2 steps total 

 [    Back to top ](#main-content) 

 ## Pagination Strategies

Aelix collection endpoints support two pagination styles. Check the API reference to see which style a specific endpoint uses.

## Cursor-Based Pagination (Recommended)

Cursor pagination is stable under concurrent writes and is the recommended approach for production integrations. The response includes a next\_cursor value to pass in your next request:

// First page  
GET /v1/transactions?limit=50

{  
 "data": \[...\],  
 "pagination": {  
 "next\_cursor": "cur\_ZmlyZXN0b25l",  
 "has\_more": true,  
 "total": 2847  
 }  
}

// Next page  
GET /v1/transactions?limit=50&amp;cursor=cur\_ZmlyZXN0b25l

Iterate until has\_more is false:

async function fetchAll(endpoint) {  
 const results = \[\];  
 let cursor = null;

 do {  
 const url = cursor  
 ? `${endpoint}?limit=100&amp;cursor=${cursor}`  
 : `${endpoint}?limit=100`;  
 const page = await apiFetch(url);  
 results.push(...page.data);  
 cursor = page.pagination.has\_more ? page.pagination.next\_cursor : null;  
 } while (cursor);

 return results;  
}

## Offset Pagination (Legacy Endpoints)

Some older endpoints use offset/limit pagination:

GET /v1/accounts?offset=0&amp;limit=25  
GET /v1/accounts?offset=25&amp;limit=25

Avoid using offset pagination for large datasets — it becomes inconsistent when records are added or removed between pages. Migrate to cursor-based endpoints where available.

## Filtering and Sorting

Most collection endpoints support filtering to reduce result sets before paginating:

GET /v1/transactions  
 ?account\_id=acc\_123  
 &amp;from=2025-01-01T00:00:00Z  
 &amp;to=2025-03-31T23:59:59Z  
 &amp;type=debit  
 &amp;sort=created\_at:desc  
 &amp;limit=50



 

 

 

 ### Tags

Tags

[Pagination](/taxonomy/term/40)

[REST](/taxonomy/term/36)