Pagination
The Digits Connect API uses cursor-based pagination for all list endpoints. This approach provides efficient and reliable pagination through large result sets.
How It Works
When you make a request to a list endpoint, you can control pagination using two parameters:
limit- The number of items to return per page (default and maximum: 100)cursor- An opaque token to retrieve the next page of results
The response includes:
- Your requested data (e.g.,
parties,accounts) - A
nextobject with pagination information:cursor- Token to use for fetching the next pagemore- Boolean indicating whether more results exist
Example
First request:
GET https://connect.digits.com/v1/ledger/parties?limit=50
Authorization: Bearer YOUR_ACCESS_TOKENResponse:
{
"parties": [
// ... 50 party objects
],
"next": {
"cursor": "eyJpZCI6MTIzNDU2fQ",
"more": true
}
}Subsequent request (if more is true):
GET https://connect.digits.com/v1/ledger/parties?limit=50&cursor=eyJpZCI6MTIzNDU2fQ
Authorization: Bearer YOUR_ACCESS_TOKENFinal response:
{
"parties": [
// ... remaining party objects
],
"next": {
"cursor": "",
"more": false
}
}Best Practices
- Treat cursors as opaque - Don't attempt to parse or construct cursor values. Always use the exact cursor returned by the API.
- Do not persist cursors - Cursors are intended to be short-lived for immediate result iteration and should not be saved to storage for use later.
- Check the
moreflag - Continue fetching pages whilemoreistrue. - Set appropriate limits - Use smaller page sizes if you only need a few results, up to the maximum of 100.
- Handle empty results - The last page may contain fewer items than your requested limit.
Updated 7 days ago
