Skip to content
Desktop Accounting API

Pagination

QuickBooks Desktop pages large queries with iterators that exist only inside one QuickBooks session. This API exposes them as cursors and is explicit about their limits: every page says when its cursor expires, a page you already fetched can be fetched again after a network error, and an expired cursor fails with a clear error instead of skipping records.

Each list operation uses one of two modes, shown in the API reference and in the spec as x-daapi-pagination:

  • Cursor lists (cursor): invoices, customers, bills, transactions and most other large lists. Use limit (1 to 150, default 150) and cursor.
  • Complete lists (none): small lists QuickBooks returns in one piece, such as accounts, classes, terms, payment methods and payroll wage items. The response contains every matching record. Where QuickBooks supports it, limit caps the count.
{
"objectType": "list",
"url": "/v1/quickbooks-desktop/customers",
"data": [ { "id": "80000001-1730311000", "objectType": "qbd_customer", "name": "Acme Supply" } ],
"nextCursor": "c1.MDFqOXg0bTZ2NGM4.2.Yk3kQ9",
"hasMore": true,
"remainingCount": 412,
"cursorExpiresAt": "2026-10-05T16:04:11.120Z"
}
Field Meaning
nextCursor Send it as cursor to get the next page. null on the last page.
hasMore Whether more pages remain.
remainingCount How many records QuickBooks has left after this page. null on the last page.
cursorExpiresAt Our estimate of when nextCursor stops working if you do not use it. null on the last page.

To continue, send cursor, and limit if you want a different page size. Filters were fixed by the first request and the cursor remembers them. You can leave them out, or resend exactly the same filters (Conductor’s SDKs do); a changed, added or dropped filter returns 400 CURSOR_PARAMS_MISMATCH, because it would describe a different list.

Each page returns a new nextCursor; always continue with the one from the latest page. Sending a cursor again repeats its page, so a retry after a network error never skips records. A finished page is repeated at most twice; after that the same cursor returns 400 CURSOR_INVALID, so a loop that keeps sending one cursor stops with an error instead of reading the same page forever.

Looking records up by ids, fullNames or refNumbers returns every match in a single page, with hasMore: false and nextCursor: null. QuickBooks does not page these lookups, so limit next to them is ignored. Other filters cannot be combined with them (400 INVALID_PARAMETER naming both parameters).

Terminal window
curl "https://api.desktopaccountingapi.com/v1/quickbooks-desktop/customers?cursor=c1.MDFqOXg0bTZ2NGM4.2.Yk3kQ9" \
-H "Authorization: Bearer $DAAPI_SECRET_KEY" \
-H "Daapi-End-User-Id: eu_01j9..."

A cursor points to an iterator inside a live QuickBooks session. The session stays open while you keep reading, but only for a short idle window: currently about 10 seconds after each page. While the cursor is open, QuickBooks treats the company file as in use by your app, so read the remaining pages promptly or stop reading. The iterator also ends when:

  • the QuickBooks session closes (a list keeps its session open up to 10 minutes while you keep reading),
  • QuickBooks restarts,
  • you start a fourth paged query on the same connection while three are still open (the least recently used one whose next page is not already on its way is dropped).
Rule Value
Idle time to live About 10 seconds after each page (cursorExpiresAt). The window restarts with every page.
Open cursors per end user 3. A fourth list drops the least recently used idle cursor (evicted). A cursor whose next page is queued or in QuickBooks is never dropped.
Longest life The QuickBooks session that started it. A list keeps its session open up to 10 minutes while you keep reading.

You never have to close a cursor. When a cursor idles out or is dropped, the API stops its iterator in QuickBooks before the next request on that connection, so reading only the first page or leaving a loop early is safe and costs nothing later. QuickBooks allows a limited number of open iterators per session (20 on QuickBooks Desktop Enterprise 24); without this cleanup, abandoned lists would block every paged list until the session ended. If many lists run in parallel for one end user and still reach that limit, the list fails with 503 QBD_TRANSIENT_ERROR, details.reason: "max_iterators", after the server has already retried it once in a fresh session; send it again.

Continuing an expired cursor returns 410 CURSOR_EXPIRED:

{
"error": {
"type": "INVALID_REQUEST_ERROR",
"code": "CURSOR_EXPIRED",
"message": "The cursor expired (idle_timeout) after 3 page(s) and 450 record(s).",
"httpStatusCode": 410,
"retryable": false,
"outcome": "not_applicable",
"details": { "reason": "idle_timeout", "pagesServed": 3, "recordsServed": 450 }
}
}

details.reason is idle_timeout, session_ended, quickbooks_restarted or evicted. A stopped cursor never returns data again: its next page is always this error, and a page whose cursor expired while QuickBooks was answering fails the same way instead of looking like the last page. We never restart the query for you, because records may have changed in between, and a silent restart can skip or repeat records.

Retrying the latest page is safe. Each page returns a new cursor. If your network drops while fetching page N, send the same cursor again: you get page N again from a short-lived cache, and the iterator does not advance twice. An older cursor, a cursor from another end user, or a malformed one returns 400 CURSOR_INVALID.

Fast item loops request the next page when they reach it. If you keep requesting items after holding a page for more than two seconds, the iterator can fetch the next page early to reduce cursor expiry. A later break can leave that page unused. Page-by-page iteration fetches a page only when requested, so fetch the next page promptly. Read-ahead cannot keep a cursor alive while your code pauses indefinitely. listAll() requests each next page as soon as a page arrives. The API releases an abandoned iterator once it idles out; see Cursor lifetime.

import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";
const qb = new DesktopAccountingApi().forEndUser("eu_01j9...");
// Item by item, across pages; slow loops get the next page in the background
for await (const customer of qb.qbd.customers.list({ status: "all" })) {
console.log(customer.id, customer.fullName);
}
// Page by page
for await (const page of qb.qbd.invoices.list({ limit: 100 }).pages()) {
console.log(page.data.length, page.remainingCount);
}
// Everything into memory, as fast as possible
const all = await qb.qbd.vendors.list().listAll();
console.log(all.length);

If a cursor expires mid-iteration, the SDKs raise CursorExpiredError (CursorExpiredException in C# and Java). It carries the reason, how many pages were served and items yielded, and the id and updatedAt of the last record you received. The SDKs never restart silently.

The API does not guarantee an order. Read every page, then sort the records yourself when order matters.

import { DesktopAccountingApi, type Customer } from "@desktopaccountingapi/quickbooks-desktop";
const qb = new DesktopAccountingApi().forEndUser("eu_01j9...");
const customers: Customer[] = [];
// Each page continues from the latest cursor
for await (const page of qb.qbd.customers.list({ limit: 150 }).pages()) {
customers.push(...page.data);
}
customers.sort((a, b) => (a.fullName ?? "").localeCompare(b.fullName ?? ""));

On one QuickBooks Desktop Enterprise 24 company file, we recorded these orders:

  • Customers, vendors, inventory items and service items: by full name, each job right after its customer.
  • Invoices, bills, estimates, sales receipts, purchase orders and received payments: by transaction date.
  • Accounts: by account type, then name.
  • Items of all types: grouped by type, in an order that changed with the page size.

Other versions and company files can differ.

Restart the whole query from the watermark your previous sync saved, and skip the records you already stored. QuickBooks iterators return records in their own order, not by updatedAt, so records you have not read yet can be older than the newest one you have. Never move updatedAfter forward while a traversal is still running: a restart from a newer value would skip those older unread records. Save the new watermark only after the traversal finishes.

import { DesktopAccountingApi, CursorExpiredError } from "@desktopaccountingapi/quickbooks-desktop";
const qb = new DesktopAccountingApi().forEndUser("eu_01j9...");
const since = "2026-01-01"; // the watermark your previous sync saved
const seen = new Set<string>();
let newest: { at: number; updatedAt: string } | undefined;
for (let attempt = 1; ; attempt++) {
try {
// Every attempt restarts from the same watermark
for await (const invoice of qb.qbd.invoices.list({ updatedAfter: since })) {
if (seen.has(invoice.id)) continue; // stored by an earlier attempt
seen.add(invoice.id);
// ...store the invoice...
const at = Date.parse(invoice.updatedAt); // compare instants: offsets can differ
if (!newest || at > newest.at) newest = { at, updatedAt: invoice.updatedAt };
}
break; // finished
} catch (err) {
if (!(err instanceof CursorExpiredError) || attempt === 5) throw err;
}
}
// Every record changed since `since` is stored: save the next watermark
const nextSince = newest?.updatedAt ?? since;
console.log(`${seen.size} invoices stored; next sync starts at ${nextSince}`);

A restart reads the records you already stored again, so deduplicate on id, as above, or make your writes idempotent by id. updatedAfter includes records changed at exactly that time, so the next sync also starts with the newest records of this one. Compare updatedAt values as instants, never as strings: the offset is the QuickBooks computer’s, and it changes with daylight saving time. For full syncs of very large files, split the work into updatedAfter / updatedBefore windows (for example one month at a time) so each paged query finishes well inside one session. See Incremental sync.

Complete lists and reports return everything at once. If QuickBooks’ answer is too large to process, the API returns 422 QBD_RESPONSE_TOO_LARGE. Narrow the filters, such as a date range or status, or use the cursor version of the list when one exists.

GET /v1/end-users (and the other platform lists) use the same cursor, limit, nextCursor and hasMore names, with limit from 1 to 100 (default 50). These cursors come from our database and do not expire; cursorExpiresAt is always null.