OneBalance API uses cursor-based pagination for endpoints that return large collections of items. This approach provides efficient navigation through result sets.

How Pagination Works

The /status/get-tx-history endpoint supports pagination through the following parameters:

ParameterTypeRequiredDescription
limitstringYesMaximum number of transactions to return in a single request (e.g., 10)
continuationstringNoA cursor value received from a previous response used to fetch the next page

Response Format

Paginated responses include:

Paginated Response
{
  "transactions": [
    // Array of transaction objects
  ],
  "continuation": "txn_00123456789abcdef" // Token to fetch the next page
}

The continuation property will be present when more results are available beyond the current page. If it’s absent or null, you’ve reached the end of the results.

Pagination Example

Initial Request

Initial Request
GET /api/status/get-tx-history?user=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&limit=10

Response

Paginated Response
{
  "transactions": [
    // 10 transaction objects
  ],
  "continuation": "txn_00123456789abcdef"
}

Subsequent Request

To fetch the next page, include the continuation token from the previous response:

Subsequent Request
GET /api/status/get-tx-history?user=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&limit=10&continuation=txn_00123456789abcdef

Pagination Best Practices

  1. Always specify a limit - This controls how many items you receive per page.
  2. Store the continuation token - Save the token from each response to allow users to navigate to the next page.
  3. Check for continuation - If a response doesn’t include a continuation token, it means you’ve reached the end of the results.
  4. Handle pagination in your UI - Implement “Next” and “Previous” buttons that appear or disappear based on the availability of continuation tokens.

Limits and Constraints

  • The limit parameter must be a positive number.
  • For optimal performance, we recommend using reasonable limit values (10-50).
  • The maximum number of results you can request per page may be capped by the server.
  • Continuation tokens are temporary and may expire after a certain period of time.