What the agent does
This is for a company that sells back-office software to independent auto repair shops: two to eight bays, a service writer, an owner who does the books at night or pays a bookkeeper to. A shop buys parts from three or four distributors several times a day, and each distributor sends a statement once a month listing every invoice, every credit memo and every payment it has on the account. The credits are where money leaks: a returned core, a wrong part sent back, a short shipment the driver signed for. The distributor issues a credit memo, the shop never enters it as a vendor credit in QuickBooks, and the next payment covers the full invoice. Supplier statement reconciliation catches that, and most small shops skip it because matching forty lines by hand takes an evening.
The software company connects a QuickBooks company of its own and saves the agent once as a template with POST /o/{org}/agents, naming "connections": ["quickbooks"] and instructions that keep it to reading. When a shop turns the feature on, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "statements-<shop id>"}, stores the agent id against the shop, calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "quickbooks"} and opens the authorize_url in a popup while the owner is signed in to the software. The owner signs in on Intuit's page and picks the company. The software company registers no Intuit app and holds no Intuit token.
When a statement arrives, the software reads its lines (the distributor's document numbers, dates and amounts, and the opening and closing balance) and puts them in the run's input; it can also attach the PDF itself as a document block, which the agent finds under /workspace/.rush/attachments/. The agent finds the vendor with a query of the form select * from Vendor where DisplayName = 'Northside Auto Parts' and reads its Balance. It then queries the statement period's Bill, VendorCredit and BillPayment records for that VendorRef through the QuickBooks Online Accounting API's query endpoint. From each bill it keeps DocNumber, TxnDate, DueDate, TotalAmt and Balance; from each vendor credit its DocNumber, TotalAmt and Balance; from each bill payment its TxnDate, TotalAmt and the bills its lines link to through LinkedTxn.
Each statement line is matched by document number first, then by amount and a date within five days when the bookkeeper typed the number differently (a leading zero dropped, a branch prefix added). Every line ends up in one group: matched; on the statement but missing in QuickBooks, which is usually an unentered credit memo or a bill still in the service writer's tray; in QuickBooks but not on the statement, which can mean a bill under the wrong vendor or one entered twice; a different amount; or a payment the two sides recorded differently. The agent then explains the difference between the statement's closing balance and the vendor's balance in QuickBooks line by line, and leaves any part of it the lines do not explain as an unexplained remainder rather than forcing a match.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Supplier statement reconciliation. Read only: never create, edit or delete anything in QuickBooks. Vendor: Northside Auto Parts. Statement period 2026-10-01 to 2026-10-31. Opening balance 1508.58. Lines (type, number, date, amount): INV 884120 2026-10-03 412.18; INV 884377 2026-10-09 1096.40; CR 55120 2026-10-12 -186.00 (core return); PMT CHK4471 2026-10-15 -1508.58; INV 885002 2026-10-21 238.75; CR 55391 2026-10-27 -64.20 (short ship). Closing balance 1497.13. 1) Query Vendor where DisplayName = 'Northside Auto Parts'; record its Id and Balance. 2) Query Bill, VendorCredit and BillPayment for that VendorRef with TxnDate from 2026-09-01 to 2026-11-15; page with STARTPOSITION and MAXRESULTS. 3) Match each statement line to a bill or vendor credit by DocNumber; if none, by amount within 0.01 and TxnDate within 5 days, and say which rule matched. Match the payment to a BillPayment by amount and date and list the bills its LinkedTxn covers. 4) Group every line: matched, on statement not in QuickBooks, in QuickBooks not on statement (October TxnDate only), amount differs, payment differs. 5) Explain the difference between the statement closing balance and the vendor Balance; leave any amount you cannot tie to a line as 'unexplained'. Write reconciliation.md with the groups as tables and the balance explanation, and return JSON: {vendor_id, statement_closing, quickbooks_balance, difference, groups: {matched: [], missing_in_quickbooks: [], missing_on_statement: [], amount_differs: [], payment_differs: []}, unexplained}. Do not suggest journal entries."
}- 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.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
- 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
What comes back is the JSON in the session's result, which the run.completed webhook carries to the software's server, and reconciliation.md among the session's files. The software shows the shop owner a short list rather than forty lines. For a statement like the one in this request, the lines that matter are the two credit memos, a core return and a short shipment: if neither was entered as a vendor credit, they are the difference between the two balances, and anything they do not explain is called out as unexplained.
What the owner or the bookkeeper checks before changing the books: the credit memo itself, which the distributor's portal or the statement PDF shows, because a credit sometimes appears on the statement before the part is received back; and a bill flagged as missing from the statement, which may be an invoice the distributor posted to another account number the shop has with them. Entering the vendor credit, calling the distributor about a disputed line and deciding what to pay are the shop's decisions. The agent reads and reports, and the prompt forbids writing even though Intuit's accounting scope would allow it.
Run it on every supplier statement that arrives
The software starts one run per statement: when a shop uploads a statement or forwards it to the software's inbox, the backend parses it and sends POST /o/{org}/sessions with {"agent": "<agent id>", "input": "…"} for that shop's agent, with a request_id that is a UUID v5 of the statement's own id, so a retried upload starts no second run.
Most distributors send statements in the first days of the month, so a shop with four suppliers gets four runs that week, each on its own computer, and they can run at the same time. Shops that pay weekly can also run the check against an account summary downloaded mid-month, using the same agent with a shorter period.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Each shop's Intuit sign-in is held in Rush's connection under that shop's own agent, so the software company never stores an Intuit token and a run for one shop cannot read another shop's books. Every session lists the QuickBooks company's realm id it read in accounts, and GET /o/{org}/sessions?account=<realm id> lists every run that touched those books, which answers an owner who asks what the software has looked at.
A script can match document numbers, but statements are messy: a distributor prints its credit memo number with a branch prefix, the service writer drops it, and a payment covers three invoices and part of a fourth. The agent reads the lines as a person would, records each rule it used, and leaves what it cannot match for the owner. Each run has its own computer and a record of every query it sent, and each shop's sessions, listed with GET /o/{org}/sessions?agent=<agent id>, add up to what that shop's model calls cost.
Frequently asked questions
What is supplier statement reconciliation, and why do it every month?
It is checking the supplier's own account statement against what your books say you owe them. The supplier's statement lists invoices, credit memos and payments; the books list bills, vendor credits and bill payments. Doing it monthly catches unentered credits and duplicate bills while they are still easy to chase.
Can the agent read the statement PDF instead of typed lines?
Yes. Send the input as a list of blocks with the PDF as a document block, by URL, as base64, or as an uploaded file id from POST /o/{org}/files. The agent reads it from its attachments folder. Typed lines are shown here so the matching is easy to follow, and a scanned statement is worth checking against the PDF when a line looks wrong.
Will it enter the missing vendor credits?
No. Rush's QuickBooks sign-in asks Intuit for the accounting scope, which could write, but the template's instructions and this prompt forbid any create, edit or delete. The owner enters the credit after checking the distributor's credit memo, which keeps a person deciding every change to the books.
What if the vendor has two accounts in QuickBooks?
The query by display name finds one vendor. If the shop set up the same distributor twice, bills under the second vendor show up as missing from QuickBooks. Put both vendor names in the input and ask the agent to query both, and it reports which vendor each matched bill was under.