All jobs

Find Last Month's Uncategorized Expenses in QuickBooks Before the Close

A restaurant group's agent lists last month's QuickBooks expenses sitting in Uncategorized Expense and suggests an account for each from the vendor's history.

Run this on RushOpens the console with this prompt ready to send. Connect QuickBooks there first.

What the agent does

This is for a restaurant group with three or four locations whose books are in QuickBooks Online, kept by an in-house controller or an outside bookkeeper. Every month dozens of card charges and checks land in Uncategorized Expense or Ask My Accountant: a produce supplier paid from a new card, a repair paid by check, a software subscription nobody recognizes. Before the month can close, someone works through them one by one. The agent prepares that list. The controller connects the company once with POST /me/connections {"type": "app", "name": "quickbooks"}, picks the company on Intuit's page, and the run names that connection.

The agent reads the month's expense transactions through the QuickBooks Online Accounting API's query endpoint, GET /v3/company/<realmId>/query, with statements such as select * from Purchase where TxnDate >= '2026-10-01' and TxnDate <= '2026-10-31', paging with STARTPOSITION and MAXRESULTS, and the same for Bill. The query language filters on the transaction, not its lines, so it reads each transaction's Line array itself and keeps the lines whose AccountBasedExpenseLineDetail.AccountRef names one of the holding accounts in the prompt.

For each uncategorized line it looks for evidence of where it belongs. It queries the same vendor's earlier transactions (by EntityRef on a Purchase, VendorRef on a Bill) over the past twelve months and counts which expense accounts they went to; a produce supplier whose last thirty bills went to Food Cost suggests Food Cost. It reads the line's Description and the transaction's PrivateNote for hints, and uses whichever the group tracks locations with, the transaction's DepartmentRef or the line detail's ClassRef, to say which restaurant it belongs to.

Each line gets a suggested account and a confidence in words: "same vendor, same account, 28 of 30 times" or "new vendor, description says 'hood cleaning', no history". Lines with no evidence go on a short list for the controller to ask about. The agent changes nothing in QuickBooks: no recategorizing, no new accounts, no vendor edits. The controller makes the changes, or imports the reviewed list, after reading it.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Prepare October 2026's uncategorized expense list from the connected QuickBooks company. Using the query endpoint, read every Purchase and Bill with TxnDate from 2026-10-01 to 2026-10-31, paging with STARTPOSITION and MAXRESULTS 1000. Keep lines whose AccountBasedExpenseLineDetail.AccountRef is 'Uncategorized Expense' or 'Ask My Accountant'. For each, query the same vendor's Purchases (EntityRef) and Bills (VendorRef) from 2025-10-01 to 2026-09-30 and count the expense accounts they used. Suggest an account: the vendor's most used account when it is at least 80% of their lines; otherwise reason from Description, PrivateNote and the vendor name, and say so. Give the location from DepartmentRef, or from the line's ClassRef, when present. Write uncategorized.csv (date, type, doc number, vendor, amount, description, location, suggested account, evidence) and uncategorized.md with totals by suggested account and a list of lines with no evidence. Do not create, change or delete anything in QuickBooks.",
  "connections": [
    "quickbooks"
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

Two files come back as artifacts on the session. uncategorized.csv has one row per uncategorized line with the suggested account and the evidence behind it, ready to sort in a spreadsheet. uncategorized.md shows the totals by suggested account, so the controller sees at a glance that most of the month's uncategorized money is food cost, and the short list of lines the agent could not place, which are the ones worth a question to a location manager.

The controller reviews each suggestion before recategorizing. Vendor history is strong evidence for a produce supplier and weak for a hardware store that sells both repair parts and small equipment, which may belong in different accounts; a line that crosses the group's capitalization threshold is the controller's call. The agent describes the books and makes no tax or accounting judgments beyond the account suggestion.

One limit to know: transactions still waiting in QuickBooks' banking review screen are not in the books yet, and the Accounting API does not offer them. The list covers what has been added to the books; the bank feed's queue is a separate pass in QuickBooks.

Run it on every third business day of the month

In the console, a Project automation with a schedule trigger (0 7 3 * * with the group's timezone) can run a saved agent that names the QuickBooks connection, with the holding accounts and the 80% rule in its instructions and the prompt asking for the previous month. The third of the month leaves time for the last card statements to arrive.

A bookkeeping firm doing this for several restaurant groups saves one agent per client company, each naming that client's QuickBooks connection, and starts their runs from its own close checklist with POST /o/{org}/sessions, one per client.

The use case this job follows, with its automation and trigger: Produce a report or file, no repo.

Why run it on Rush?

QuickBooks' own bank rules categorize what matches a rule; this list is everything that did not, and the work is the judgment rules cannot make. Reading a vendor's year of history and the line's memo is slow by hand and fast for an agent, and the controller ends up reviewing suggestions instead of researching each line. The Intuit sign-in stays in Rush's connection rather than in a script with a refresh token in a config file.

Each run has its own computer and a record of every API call and its cost, which matters for financial data: the controller can see exactly which transactions were read. A session that used the QuickBooks connection is readable by whoever started it and the org's owners and admins only, and GET /o/{org}/sessions?account=<realm id> lists every run that touched the company.

Frequently asked questions

Will it recategorize the transactions for us?

No. The prompt forbids changes and the result is a list. The controller recategorizes in QuickBooks, and the suggestions make that quick; letting an agent post to the books is a decision to make deliberately, not a default.

What if we use a different holding account?

Name it in the prompt. Some firms use Suspense or a custom account per location; the agent filters on whatever account names the prompt lists.

Does it handle our locations?

If the books use classes or locations, the agent reads the transaction's DepartmentRef and each line's ClassRef and reports them. If they do not, it can only guess a location from the description, and the prompt can tell it not to.

More QuickBooks jobs

More jobs like this: Produce a report or file, no repo

Keep reading