Language guide
QuickBooks Desktop API in Python: create invoices without qbXML or Windows
Read and write QuickBooks Desktop customers, invoices, bills and payments from Python with plain JSON over HTTPS. Free hosted sandbox, no Windows VM, no QuickBooks install.
QuickBooks Desktop has no cloud API. The official route is the QuickBooks SDK: qbXML messages delivered over COM on Windows, or over SOAP through the QuickBooks Web Connector. From Python that means building a SOAP server, generating schema-ordered XML and handling edit sequences yourself.
LedgerWire runs the Web Connector SOAP service for you and gives you a JSON REST API instead. Your Python code makes ordinary HTTPS calls; LedgerWire turns them into qbXML, queues them for your customer's Web Connector, and turns the response back into JSON.
1. Get a sandbox key
Sign up and you get a lw_test_… key plus a hosted, simulated QuickBooks Desktop company with 40 customers, 60 items, 120 invoices, bills and payments. It answers the same REST and qbXML calls as production, so you can build the whole integration before touching Windows.
2. List unpaid invoices
status=unpaid maps to qbXML PaidStatus=NotPaidOnly. Pages hold up to 150 records; follow nextCursor for more.
3. Create an invoice
Refs take an id (ListID) or a fullName. Line amounts are computed from quantity and rate when you leave amount out. Errors carry the real QuickBooks status code (3140 for a bad reference, 3100 for a duplicate name, 3200 for a stale editSequence) plus why and fix.
4. Update with editSequence
QuickBooks uses optimistic locking. Read the record, send back its editSequence with your change to POST /v1/invoices/{id}. If someone changed it in between you get HTTP 409 with qbStatusCode 3200: re-read and retry.
5. Go live
Create a connection in the dashboard and send your customer the setup link. They download a .qwc file, add it to the QuickBooks Web Connector (free from Intuit, usually already installed) and type the password. Switch your Python code to a lw_live_… key; nothing else changes. Calls wait up to 25 seconds for the Web Connector, otherwise you get a 202 with a job id and a job.completed webhook.
Anything not covered by REST
POST raw qbXML to /v1/qbxml. It is validated, then passed through unchanged in production, and simulated in the sandbox for the core objects.
import os, requests
r = requests.get(
"https://ledgerwire.vibiz.app/v1/invoices",
params={"status": "unpaid", "limit": 20},
headers={"Authorization": f"Bearer {os.environ['LEDGERWIRE_KEY']}"},
)
r.raise_for_status()
for inv in r.json()["data"]:
print(inv["refNumber"], inv["customerRef"]["fullName"], inv["balanceRemaining"])r = requests.post(
"https://ledgerwire.vibiz.app/v1/invoices",
headers={"Authorization": f"Bearer {os.environ['LEDGERWIRE_KEY']}"},
json={
"customerRef": {"fullName": "Bayside Builders LLC"},
"lines": [{"itemRef": {"fullName": "Installation"}, "quantity": 4, "rate": 95}],
},
)
if not r.ok:
err = r.json()["error"]
raise RuntimeError(f"{err['message']} Fix: {err['fix']}")
invoice = r.json()Run these calls against a hosted QuickBooks Desktop sandbox now.
Get a free sandbox key