This document describes the standardized pagination conventions used across all list endpoints in the YieldVault API.
All list endpoints follow consistent pagination patterns to make API consumption predictable and easy to use.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
number | 20 | Maximum number of items to return (1-100) |
cursor |
string | - | Cursor for cursor-based pagination (opaque string) |
page |
number | - | Page number for offset-based pagination (1-based) |
sortBy |
string | varies | Field to sort by |
sortOrder |
string | 'desc' | Sort direction: 'asc' or 'desc' |
| Parameter | Type | Default | Description |
|---|---|---|---|
type |
string | 'all' | Filter by transaction type: 'deposit', 'withdrawal', or 'all' |
walletAddress |
string | - | Filter by wallet address |
| Parameter | Type | Default | Description |
|---|---|---|---|
status |
string | 'all' | Filter by status: 'active', 'pending', or 'all' |
walletAddress |
string | - | Filter by wallet address |
| Parameter | Type | Default | Description |
|---|---|---|---|
from |
string | - | Start date (YYYY-MM-DD format) |
to |
string | - | End date (YYYY-MM-DD format) |
All list endpoints return a standardized response structure:
{
"data": [...],
"pagination": {
"count": 20,
"total": 100,
"nextCursor": "base64encodedcursor",
"prevCursor": "base64encodedcursor",
"currentPage": 1,
"totalPages": 5,
"hasNextPage": true,
"hasPrevPage": false
},
"timestamp": "2026-03-28T18:00:00.000Z"
}| Field | Type | Description |
|---|---|---|
count |
number | Number of items returned in this response |
total |
number | Total number of items available (if known) |
nextCursor |
string | Cursor for the next page (if more items exist) |
prevCursor |
string | Cursor for the previous page (if applicable) |
currentPage |
number | Current page number (for offset-based pagination) |
totalPages |
number | Total number of pages (if total is known) |
hasNextPage |
boolean | Whether there are more items after this page |
hasPrevPage |
boolean | Whether there are items before this page |
Cursor-based pagination is recommended for most use cases as it provides stable ordering even when data changes between requests.
How it works:
- Make initial request without
cursorparameter - Use
nextCursorfrom response for subsequent requests - Continue until
hasNextPageisfalse
Example:
# First page
GET /api/transactions?limit=20
# Next page (using cursor from previous response)
GET /api/transactions?limit=20&cursor=base64encodedcursorAdvantages:
- Stable ordering even when new items are added
- No duplicate or missing items when paginating
- Efficient for large datasets
Offset-based pagination is simpler but may have issues with changing data.
How it works:
- Use
pageparameter to specify page number (1-based) - Use
limitto specify items per page - Calculate total pages from
totalandlimit
Example:
# First page
GET /api/transactions?limit=20&page=1
# Second page
GET /api/transactions?limit=20&page=2Advantages:
- Simple to understand and implement
- Easy to jump to specific pages
Disadvantages:
- May show duplicate or missing items if data changes between requests
- Less efficient for large datasets
All list endpoints support sorting by multiple fields.
Example:
# Sort by timestamp descending (newest first)
GET /api/transactions?sortBy=timestamp&sortOrder=desc
# Sort by amount ascending (smallest first)
GET /api/transactions?sortBy=amount&sortOrder=ascFiltering is applied before pagination and sorting.
Example:
# Get only deposits
GET /api/transactions?type=deposit
# Get active holdings for a specific wallet
GET /api/portfolio/holdings?status=active&walletAddress=GABC...Invalid pagination parameters are handled gracefully:
- Invalid
limitvalues are clamped to valid range (1-100) - Invalid
pagevalues default to page 1 - Invalid
sortOrdervalues default to 'desc' - Invalid
cursorvalues return empty results
- Use cursor-based pagination for real-time data that may change frequently
- Use offset-based pagination for static or slowly-changing data
- Always check
hasNextPagebefore requesting the next page - Use reasonable
limitvalues (20-50 is usually optimal) - Cache responses when appropriate to reduce API calls
- Handle empty results gracefully (check
countanddata.length)
curl "http://localhost:3000/api/transactions?limit=20"curl "http://localhost:3000/api/transactions?limit=20&cursor=base64encodedcursor"curl "http://localhost:3000/api/transactions?type=deposit&sortBy=amount&sortOrder=desc"curl "http://localhost:3000/api/portfolio/holdings?status=active&walletAddress=GABC..."curl "http://localhost:3000/api/vault/history?from=2026-01-01&to=2026-03-31&limit=100"All list endpoints are subject to API rate limiting. See RATE_LIMITING.md for details.
- Initial pagination conventions
- Cursor-based and offset-based pagination support
- Standardized response metadata
- Consistent query parameter naming