Bybit REST V5 next cursor JavaScript example. Read the source code, review its SDK calls, and browse related exchange integration examples.
This example uses bybit-api, the JavaScript and TypeScript SDK for Bybit. Install it with npm install bybit-api.
We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.
bybit-api instead of hand-written HTTP request plumbing.Bybit/Rest/rest-v5-next-cursor.ts.RestClientV5.getUniversalTransferRecords().import { RestClientV5, UniversalTransferRecordV5 } from 'bybit-api'; const client = new RestClientV5({ testnet: false, key: 'insert_api_key', secret: 'insert_api_secret',}); async function getAllUniversalTransfers() { const allTransfers: UniversalTransferRecordV5[] = []; let nextCursor = ''; let pages = 0; do { pages++; console.log(`Fetching data from page ${pages}`); const response = await client.getUniversalTransferRecords({ limit: 50, // Maximum page size per request cursor: nextCursor || undefined, // Only send cursor if we have one }); if (response.result.list && response.result.list.length > 0) { allTransfers.push(...response.result.list); } nextCursor = response.result.nextPageCursor; // Optional: Add a small delay to avoid rate limits await new Promise((resolve) => setTimeout(resolve, 100)); } while (nextCursor); console.log('Total transfers fetched:', allTransfers.length); console.log('All transfers:', allTransfers);} getAllUniversalTransfers().catch(console.error); We use essential cookies and optional analytics. Read the Privacy Policy.
Essential cookies stay on. Toggle analytics if you want to share anonymous usage insights. You can revisit this anytime via Cookie Settings in the footer.