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

  1. Initial Call: Request a resource (e.g., GET /Customers) with an optional limit (max 150).
  2. Token Retrieval: Capture the nextCursor from the response JSON.
  3. Continuous Fetching: Call the same endpoint again, providing the cursor parameter. Repeat until hasMore is false.

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.

GET/api/v1/Accounts
GET/api/v1/AccountsTaxLineInfo
GET/api/v1/BarCodes
GET/api/v1/BillingRates
GET/api/v1/CustomerTypes
GET/api/v1/Employees
GET/api/v1/InventoryAdjustments
GET/api/v1/InventorySites
GET/api/v1/OtherNames
GET/api/v1/PaymentMethods
GET/api/v1/PayrollItemsNonWage
GET/api/v1/PayrollItemsWage
GET/api/v1/PriceLevels
GET/api/v1/SalesTaxCodes
GET/api/v1/ShipMethods
GET/api/v1/SpecialItems
GET/api/v1/WorkersCompCodes

Examples

SDK Auto-Pagination

index.ts
12345678910111213141516171819202122232425
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
}