What the agent does
This is for a company that makes month-end close software for bookkeeping firms. Each firm keeps the books for many small businesses in QuickBooks Online, and one of the checks before closing a month is receivables: a customer paid, but the payment was recorded on its own instead of against the invoice it paid. The invoice still shows as open, the customer gets a reminder for money they already sent, and the payment sits as a credit nobody asked for. The close software saves one agent as a template that names QuickBooks, and makes one agent per client company, since each agent holds one QuickBooks company.
The software company connects its own QuickBooks sandbox company and saves the template with POST /o/{org}/agents, "connections": ["quickbooks"]. When a firm adds a client to the close software, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "close-<client id>"} and POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "quickbooks"}, and opens the authorize_url for the bookkeeper, who signs in on Intuit's page and picks that client's company. Rush stores the company's realmId with the sign-in and lists it in each session's accounts.
On a run the agent queries the QuickBooks Online Accounting API for the month. It reads payments with select * from Payment where TxnDate >= '2026-01-01', paging with STARTPOSITION and MAXRESULTS, and keeps those with an UnappliedAmt above zero. It reads credit memos and keeps those with a RemainingCredit above zero. It reads open invoices, those whose Balance is above zero, with their customer, DocNumber, TxnDate, DueDate and amount. Then, customer by customer, it sets each unapplied payment or credit beside that customer's open invoices.
It proposes a match only on evidence it can show: the same amount, an invoice number quoted in the payment's PaymentRefNum or PrivateNote, or one open invoice and one unapplied payment for the same customer. Each proposal carries the reason. A payment with no plausible invoice goes in its own list, because it may be a deposit, an overpayment or a payment recorded under the wrong customer, which a bookkeeper has to judge. The agent writes nothing to QuickBooks. The Accounting scope Intuit grants can write, so the template's instructions allow only read queries, and applying a payment stays with the bookkeeper.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Month-end check for October 2026: find customer payments and credits not applied to invoices. Using the QuickBooks Online Accounting API query endpoint only: read all Payment records with TxnDate from 2026-01-01 to 2026-10-31 (page with STARTPOSITION and MAXRESULTS 1000) and keep those with UnappliedAmt > 0; read all CreditMemo records and keep those with RemainingCredit > 0; read all Invoice records with Balance > 0. For each customer with an unapplied payment or credit, list their open invoices and propose a match only when: amounts are equal, or PaymentRefNum or PrivateNote contains the invoice DocNumber, or the customer has exactly one open invoice and one unapplied item. Return only JSON: {company_realm, proposed_matches: [{customer, payment_or_credit_id, type, date, unapplied_amount, invoice_doc_number, invoice_balance, reason}], unmatched: [{customer, id, type, date, unapplied_amount, note}], totals: {unapplied_payments, unapplied_credits, open_invoices}}. Never create, update, void or delete any record."
}- 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
The answer is JSON in the session's result and in the run.completed webhook. The close software shows it on the client's close checklist as Receivables to apply, with each proposed match, its reason and a link to both records in QuickBooks. The bookkeeper opens the payment in QuickBooks and applies it to the invoice, or marks the proposal wrong in the checklist.
What the bookkeeper checks: that a match on equal amounts is not two different invoices for the same price, which is common for subscription businesses; unmatched payments that look like deposits for future work, which belong as unearned revenue rather than against an invoice, a choice for the bookkeeper and the client's accountant; and totals against the Accounts Receivable aging report in QuickBooks. The agent gives no accounting or tax advice about any of these.
Run it on every month end, per client company
When a bookkeeper opens a client's close for a month, the software sends one POST /o/{org}/sessions with that client's agent id as agent, the month in input, and a request_id that is a UUID v5 of the client id and the month, so reopening the checklist starts no second run. A firm closing forty clients on the same day starts forty runs; those past the key's concurrent limit wait queued and start in order.
Firms that like to catch problems early can also run it mid-month from the same checklist, with the month so far.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Each bookkeeper signs in on Intuit's own page and picks one client company, and that sign-in belongs to that client's agent: a run for one client cannot reach another client's books, and the close software never stores an Intuit token or registers an Intuit app. GET /o/{org}/sessions?account=<realm id> lists every run that read a company, which answers the question a firm asks before it trusts new software with its clients' ledgers.
One template serves every client of every firm, so adding a check, such as payments sitting in Undeposited Funds, is one PATCH to the template. Every run has its own computer and a record of each query it sent and what its model calls cost, and GET /o/{org}/sessions?agent=<agent id> totals total_cost_usd per client company for pricing.
Frequently asked questions
Could the agent apply the payments itself?
The QuickBooks Accounting scope allows writes, so the limit comes from the template's instructions, and the transcript shows every call. Applying a payment changes a customer's balance and sometimes a sales tax report, so the close software leaves it to the bookkeeper, who can see context the books do not hold.
What if a client has thousands of payments a month?
The query pages through results with STARTPOSITION and MAXRESULTS, and the agent keeps only payments with an unapplied amount, so the list it reasons over stays short. A very large client may take longer per run, and the run's record shows each page it read.
Does the client business need a Rush account?
No. The bookkeeper signs in to the client's QuickBooks company from the close software, and the agent, its runs and their cost belong to the person who created the software company's API key.
What happens when a firm stops serving a client?
The software deletes that client's agent, which disconnects the QuickBooks company stored for it. The client's QuickBooks data is untouched; only Rush's access ends.