Pagination in our APIs
Instead of returning the entire dataset in a single response, which can strain resources, clients can request specific subsets of data. We support two query parameters for pagination:
page(integer): Specifies the page number to retrieve. The default value is1.- Negative values are invalid and will result in an error.
limit(integer): Defines the maximum number of items per page. The default value is10.
Pagination response
The pagination response includes the following structure:items: An array of entities retrieved for the current page. Each object contains detailed information about the resource requested, as shown in the example below.page: The current page number, starting from1(default).limit: The maximum number of items included in the response, as defined in the request or default configuration.
Maximum page size
By default, API endpoints that support pagination accept a maximum of 100 items per page (limit=100). This restriction avoids excessive payload sizes.
If your use case requires retrieving a larger number of items per request, you can override this limit by setting the MAX_PAGINATION_LIMIT environment variable in your deployment configuration ( .env file).
To update this configuration in Kubernetes:
ledger.configmap.MAX_PAGINATION_LIMIT in your values.yaml and run helm upgrade. The next chart upgrade replaces a direct edit to the ConfigMap.
Midaz and all its plugin services inherit this behavior.
Cursor-based pagination
Some endpoints use cursor-based pagination instead of page numbers. This approach is more efficient for large or frequently changing datasets and guarantees consistent results even when data is modified between requests. Cursor-based endpoints accept the following query parameters:
cursor(string): An encoded token from a previous response (next_cursororprev_cursor) to navigate forward or backward. Omit this parameter to start from the beginning.limit(integer): The maximum number of items per page. The default value is10.sort_order(string): The direction used to sort results. Accepted values:asc(ascending, default) ordesc(descending).
When paginating with a
cursor from a previous response, you cannot change sort_order mid-pagination. Set sorting parameters on the initial request and keep them consistent throughout the pagination sequence.Cursor pagination response
The response includes the following structure:items: An array of entities for the current page.next_cursor: An encoded token to retrieve the next page. If absent or empty, there are no more results.prev_cursor: An encoded token to retrieve the previous page. If absent or empty, you are on the first page.limit: The maximum number of items included in the response.
next_cursor value as the cursor query parameter:
Which endpoints use cursor pagination?
The following endpoints use cursor-based pagination:- List Transactions:
GET /v1/organizations/{id}/ledgers/{id}/transactions - List Balances:
GET /v1/organizations/{id}/ledgers/{id}/balances - List Operations by Account:
GET /v1/organizations/{id}/ledgers/{id}/accounts/{id}/operations - List Account Types:
GET /v1/organizations/{id}/ledgers/{id}/account-types - List Operation Routes:
GET /v1/organizations/{id}/ledgers/{id}/operation-routes - List Transaction Routes:
GET /v1/organizations/{id}/ledgers/{id}/transaction-routes

