Reference
QuickBooks Online query language cheat sheet
The QuickBooks Online API has its own SQL-like query language. It looks familiar but has important limits. Here's the syntax with examples you can copy, and the gotchas. (With LedgerLink, your AI writes these for you; this page is for when you want to see or tweak them.)
14 days free, no card needed. $15 per company a month after that.
Basic shape
SELECT * FROM Entity [WHERE conditions] [ORDERBY Field [ASC|DESC]] [STARTPOSITION n] [MAXRESULTS n]
Count instead of rows
SELECT COUNT(*) FROM Invoice WHERE Balance > '0'
Common examples
Open bills, soonest due first
SELECT * FROM Bill WHERE Balance > '0' ORDERBY DueDate
One vendor's bills (use the vendor's ID)
SELECT * FROM Bill WHERE VendorRef = '56'
Invoices in a date range
SELECT * FROM Invoice WHERE TxnDate >= '2026-09-01' AND TxnDate <= '2026-09-30'
Customers whose name contains a word
SELECT * FROM Customer WHERE DisplayName LIKE '%Bakery%'
Several specific invoices
SELECT * FROM Invoice WHERE DocNumber IN ('1042', '1043', '1044')Changed since a date
SELECT * FROM Purchase WHERE MetaData.LastUpdatedTime >= '2026-10-01'
Active expense accounts
SELECT * FROM Account WHERE AccountType = 'Expense' AND Active = true
Second page of 100
SELECT * FROM Invoice STARTPOSITION 101 MAXRESULTS 100
Limits and gotchas
- No OR. Conditions can only be joined with AND; use IN for several values of one field, or run separate queries.
- No JOINs, GROUP BY or subqueries. Query one entity at a time and combine the results yourself (or let the AI do it).
- LIKE only supports the % wildcard.
- Put values in single quotes, including numbers and dates (dates as 'YYYY-MM-DD').
- Filter references by ID, not name: VendorRef = '56', not the vendor's name. Look up the ID first.
- Not every field can be filtered or sorted. If QuickBooks rejects a field, filter after fetching instead.
- A single query returns at most 1,000 rows; page with STARTPOSITION and MAXRESULTS.
- Expenses, checks and credit card charges are all the Purchase entity; payments received are Payment, bill payments are BillPayment.
Questions
- Does QuickBooks Online support SQL?
- Not full SQL. The API has a SQL-like query language that supports SELECT with WHERE (AND only), ORDERBY, paging and COUNT, but no OR, JOIN or GROUP BY.
- How do I get more than 1,000 results?
- Page through them with STARTPOSITION and MAXRESULTS, for example STARTPOSITION 1001 MAXRESULTS 1000 for the second page.
- Can AI write QuickBooks queries for me?
- Yes. Connected through LedgerLink, Claude or ChatGPT writes and runs the queries from a plain-English question and shows the results as a table.
Related
Bring your whole client list to your AI.
Start your 14-day free trial. No card needed.