Pagination
Master the cursor-based pagination system to retrieve large datasets from QuickBooks Desktop.
Pagination
nXus uses cursor-based pagination to deliver large datasets from QuickBooks Desktop in manageable, high-performance increments.
The Pagination Workflow
- Initial Call: Request a resource (e.g.,
GET /Customers) with an optionallimit(max 150). - Token Retrieval: Capture the
nextCursorfrom the response JSON. - Continuous Fetching: Call the same endpoint again, providing the
cursorparameter. Repeat untilhasMoreisfalse.
The 10-Second Rule
Due to the architectural requirements of QuickBooks Desktop, you must request the next page within 10 seconds. This is rarely an issue for automated loops but is important to note for manual testing.
Prefer SDK Auto-Pagination
The SDK paginator immediately follows the cursor for you, which is the safest way to stay inside the QuickBooks Desktop 10-second window. Use manual paging only when you need page-level control.
Key Considerations
Static Cursors
Unlike some APIs where the cursor changes every page, the nXus cursor stays constant for the duration of your fetch sequence.
Sorting
Data is returned according to QuickBooks Desktop’s internal indexing. Custom sort fields are not supported in paginated requests.
Unsupported Endpoints
Not all QuickBooks types support pagination. This is a limitation of QuickBooks Desktop. For endpoints that do not support pagination the max limit will be set to 500 items by default.
Examples
SDK Auto-Pagination
import { NxusClient } from '@nxus/sdk';
const client = new NxusClient({
apiKey: process.env.NXUS_API_KEY,
headers: {
'X-Connection-ID': 'YOUR_CONNECTION_ID',
},
});
// ── Page-by-page iteration ──
let cursor: string | undefined;
do {
const result: Page<Invoice> = await nxus.invoices.list({
connectionId: 'conn_abc123',
limit: 10,
cursor,
});
for (const invoice of result.data) {
console.log(invoice);
}
cursor = result.nextCursor ?? undefined;
} while (cursor);Manual Page Control
Await the first page when you need to inspect each page boundary, then keep calling getNextPage() until hasNextPage() returns false.
Sample Response Body
{
"success": true,
"requestId": "qibGUQ6cW5IJw09a5zEbJw",
"data": [
{
"id": "100001-1039043346",
"name": "Automobile Insurance Company",
"balance": 3200,
"isActive": true
}
],
"nextCursor": "hUz-6rRtSsW9Zo4H-0QO9Q",
"page": 1,
"count": 1,
"limit": 10,
"totalCount": 60,
"hasMore": true,
"remainingCount": 59
}