ledgercrossing
TypeScript/JavaScript client for the QuickBooks Desktop API through
LedgerCrossing. It sends qbXML to QuickBooks Desktop over plain
HTTP and returns QuickBooks' answer in the same call. There's no Web Connector, no SOAP service to host, and no polling.
No runtime dependencies; types included; ESM and CommonJS.
npm install ledgercrossing
import { LedgerCrossing } from "ledgercrossing";
const lc = new LedgerCrossing(); // http://localhost:8284 on the QuickBooks computer; no key needed there
const reply = await lc.qbxml(`<?xml version="1.0"?><?qbxml version="13.0"?>
<QBXML><QBXMLMsgsRq onError="stopOnError">
<CustomerQueryRq><MaxReturned>10</MaxReturned></CustomerQueryRq>
</QBXMLMsgsRq></QBXML>`);
console.log(String(reply)); // QuickBooks' own qbXML, with statusCode="0" on success
for (const customer of reply.records()) { // the CustomerRet elements
console.log(customer.findText("FullName"), customer.findText("Balance"));
}
What you need
- QuickBooks Desktop Pro, Premier or Enterprise for Windows, 2019 or later.
- LedgerCrossing on the computer where QuickBooks Desktop runs. It's a one-time purchase per computer, with unlimited company files. This package is the client; LedgerCrossing is the connection to QuickBooks.
- Node.js 18 or later (it uses the built-in
fetch), on any operating system. Only the QuickBooks computer needs Windows.
Works with anything that can make a web request. If you rely on an off-the-shelf app that syncs through the Web
Connector, that vendor controls the connection, and LedgerCrossing doesn't slip in underneath it.
Connecting from where your code runs
| Your code runs |
URL |
Key |
| On the QuickBooks computer |
http://localhost:8284 (the default) |
Not needed |
| On another computer in the office |
http://<machine-name>:8284, after turning on Settings > Allowed Connections > Local network |
The API key from Settings > Allowed Connections |
| Anywhere else, through LedgerCrossing Remote |
Your Remote address |
The API key, with Allow the API key turned on under Settings > Allowed Connections > Internet |
| Anywhere else, through your own Cloudflare Tunnel |
Your tunnel's address |
The API key, with Local network turned on: LedgerCrossing treats a tunnel on its own computer like the office network |
const lc = new LedgerCrossing({ url: process.env.LC_URL, apiKey: process.env.LC_KEY });
Over Remote, Internet access starts read-only: writes are refused until you turn off Read-only under
Settings > Allowed Connections > Internet.
Signing in as a person over Remote (the sign-in that claude.ai uses) isn't supported by this package yet; use the
API key.
This package is for servers, scripts and desktop apps. LedgerCrossing refuses requests from a web page on another
website, so don't call it from a browser.
Which company file
It follows the QuickBooks File page in LedgerCrossing. If it's set to The caller names the file in each
request, pass companyFile:
await lc.qbxml(xml, { companyFile: "C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\MyCompany.qbw" });
Helpers
Three shortcuts for common reads. Each one is bounded, so it never trips the unbounded-query rule, and each returns
the same Reply as qbxml():
await lc.customers({ maxReturned: 100 });
await lc.invoices({ fromDate: "2026-10-01", toDate: "2026-10-31", maxReturned: 50, includeLineItems: true });
await lc.profitAndLoss({ fromDate: "2026-01-01", toDate: "2026-06-30", basis: "Accrual" }); // basis is optional
Dates are "YYYY-MM-DD" or a Date (its local calendar date). Every helper also takes companyFile.
await lc.health() checks that LedgerCrossing is reachable; it needs no key.
The reply
qbxml() resolves to a Reply:
String(reply) or reply.raw: QuickBooks' XML, exactly as it came.
reply.responses: one entry per response element, with name (e.g. CustomerQueryRs), statusCode,
statusSeverity, statusMessage, ok and element.
reply.records(): every returned record (CustomerRet, InvoiceRet, ReportRet, ...) as XmlElements, with
name, attributes, children, text, find(name), findAll(name), findText(name) and get(attribute).
reply.ok: false if any response has severity Error.
reply.raiseForStatus(): throws QuickBooksStatusError if any response is an error, and returns the reply otherwise.
A QuickBooks error inside a reply isn't thrown on its own: with onError="continueOnError" a mix of results is normal.
Status code 1 ("did not find a matching object") is an Info status, not an error.
Errors
LedgerCrossing refusing or failing a request throws a subclass of LedgerCrossingError, with status, message,
code (when sent), retryAfter (when sent) and body:
| Status |
Error |
Meaning |
400 |
BadRequestError |
Malformed request, an unbounded query (below), an event-subscription request, or a company file the current mode doesn't accept |
401 |
AuthenticationError |
Missing or wrong API key |
403 |
ReadOnlyError |
The request would change the books, and Internet connections, or this signed-in person, are read-only |
403 |
PermissionDeniedError |
The company file is outside the person's list, or the request was refused at the door (refusedAtDoor: Local network is off, or the caller isn't on a private address or the allowlist) |
409 |
ConflictError |
Conflicts with QuickBooks' current state, for example the file is in use, or QuickBooks didn't open it in time (code QB_OPEN_TIMEOUT) |
429 |
RateLimitError |
Queue full or waited too long (queueDepth), or too many wrong keys from one address; wait retryAfter seconds |
500 |
ServerError |
A genuine fault; code names it, e.g. an HRESULT |
503 |
UnavailableError |
QuickBooks isn't responding (QB_NOT_RESPONDING) or LedgerCrossing is shutting down (SHUTTING_DOWN); wait retryAfter seconds |
| none |
NetworkError, RequestTimeoutError |
LedgerCrossing couldn't be reached, or didn't answer within timeoutMs (300000 by default) |
Branch on the error class or on code; the wording of message is for people and may change. After a
RequestTimeoutError the request may still run in QuickBooks, so check before sending an add again.
Unbounded queries are refused. A list or transaction query needs <MaxReturned>, an iterator, or a specific
record (<ListID> / <FullName>). Otherwise LedgerCrossing answers 400 before the request reaches QuickBooks.
Using it with AI assistants
LedgerCrossing also includes an MCP server, so Claude, ChatGPT, Meta Muse, Grok Bot, Claude Desktop, Claude Code,
Cursor, VS Code, Codex and Gemini CLI can work with the same company file. See the
QuickBooks Desktop MCP server quickstart.
Links
MIT license. QuickBooks is a registered trademark of Intuit Inc. LedgerCrossing is not affiliated with or endorsed by
Intuit.