Skip to main content
Endpoints that return lists of resources support pagination through query parameters. This allows you to retrieve data in manageable chunks rather than loading everything at once.

Query parameters

ParameterTypeDefaultDescription
pageinteger1Page number (1-indexed).
sizeinteger10Number of items per page.

Example request

curl -X GET "https://api.breet.io/v1/trades/wallets?page=1&size=10" \
  -H "x-app-id: YOUR_APP_ID" \
  -H "x-app-secret: YOUR_APP_SECRET" \
  -H "X-Breet-Env: production"

Paginated response

Every paginated endpoint returns a meta object alongside the data array. The meta object contains all the information you need to navigate through result pages:
{
  "success": true,
  "message": "wallets retrieved successfully",
  "data": [ ... ],
  "meta": {
    "pages": 2,
    "prevPage": null,
    "nextPage": 2,
    "page": 1,
    "totalDocs": 12,
    "hasPrevPage": false,
    "hasNextPage": true
  }
}

Meta fields

FieldTypeDescription
pagesintegerTotal number of pages available.
prevPageinteger or nullPrevious page number, or null if on the first page.
nextPageinteger or nullNext page number, or null if on the last page.
pageintegerCurrent page number.
totalDocsintegerTotal number of documents across all pages.
hasPrevPagebooleanWhether a previous page exists.
hasNextPagebooleanWhether a next page exists.

Supported endpoints

The following endpoints support pagination:
EndpointMethodDescription
/trades/walletsGETFetch wallet addresses
/trades/transactionsGETFetch transactions
/payments/integration-banksGETFetch saved bank accounts
/payments/withdrawalsGETFetch withdrawals

Iterating through pages

To retrieve all results, start at page=1 and keep requesting the next page until hasNextPage is false:
let page = 1;
let hasMore = true;

while (hasMore) {
  const response = await fetch(
    `https://api.breet.io/v1/trades/wallets?page=${page}&size=20`,
    { headers: { "x-app-id": APP_ID, "x-app-secret": APP_SECRET, "X-Breet-Env": "production" } }
  );
  const { data, meta } = await response.json();

  // Process data
  processWallets(data);

  hasMore = meta.hasNextPage;
  page = meta.nextPage;
}