All jobs

Accounts Receivable Aging Report From QuickBooks

A bookkeeping firm gives each client an agent that reads its QuickBooks every Monday, builds the AR aging report and drafts reminders for a person to send.

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

What the agent does

This is for an outsourced bookkeeping firm whose clients are trades businesses: electricians, plumbers, HVAC and roofing contractors who invoice general contractors and homeowners and wait to be paid. Each client's owner wants the same thing every Monday: who owes them money, how late it is, and who to call. The bookkeepers used to export the A/R aging summary from each client's QuickBooks, clean it up in a spreadsheet and write a few lines on top, which took most of Monday for a bookkeeper with fifteen clients. The firm's client portal now gives each client an agent that builds the report from that client's books, explains it and drafts the reminders, and the bookkeeper reviews the result.

The firm 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 client signs up, the portal calls POST /o/{org}/agents {"template": "<template id>", "name": "ar-<client id>"}, stores the agent id against the client, then calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "quickbooks"} and opens the authorize_url in a popup for the client's owner, who signs in on Intuit's page and picks the company. The firm registers no Intuit app and stores no Intuit token, and each client's agent reads only that client's books.

Each Monday the agent reads through the QuickBooks Online Accounting API. The AgedReceivables report with report_date set to that day, aging_period 30, num_periods 4 and aging_method Report_Date gives each customer's balance in the Current, 1 to 30, 31 to 60, 61 to 90 and 91 and over columns. Because the summary shows customers and not invoices, it then queries select * from Invoice where Balance > '0' for each open invoice's DocNumber, TxnDate, DueDate, Balance, CustomerRef, SalesTermRef, BillEmail and EmailStatus. It reads CreditMemo rows with a RemainingCredit above zero and recent Payment rows with an UnappliedAmt above zero, because a credit or a payment that was never applied to its invoice makes a customer look later than they are.

From those reads it builds the report: one row per customer with the five buckets and the total, the customers with anything past 60 days first, and under each customer the invoices that make up the late buckets. It checks that the invoice balances add up to the report's totals and names any customer where they do not. It flags invoices whose EmailStatus is NeedToSend or NotSet, which may never have reached the customer, invoices with no DueDate, and open credits and unapplied payments that a bookkeeper should apply before anyone calls the customer. For each customer more than 30 days past due with no note in the input, it drafts a short, polite reminder that names the invoice numbers, dates and amounts. It writes ar-aging.md, ar-aging.csv and reminders.md, returns the numbers as JSON, and records, sends and changes nothing in QuickBooks.

Start it with one API call

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

{
  "agent": "<agent id>",
  "input": "Build this week's accounts receivable aging report as of 2026-11-30. Read only: never create, edit, send or delete anything in QuickBooks, and send no email. Notes from the bookkeeper: Harlan Builders is on a payment plan of 2,000 per month, last paid 2026-11-14, do not draft a reminder; invoice 1187 for Wexford Homes is disputed (wrong panel count), list it but draft nothing for it. Steps: 1) AgedReceivables report with report_date 2026-11-30, aging_period 30, num_periods 4, aging_method Report_Date; read each customer's Current, 1-30, 31-60, 61-90 and 91+ amounts and total. 2) select * from Invoice where Balance > '0'; for each invoice read DocNumber, TxnDate, DueDate, Balance, CustomerRef, SalesTermRef, BillEmail and EmailStatus, and compute days past DueDate as of 2026-11-30. 3) Read CreditMemo rows and keep those with RemainingCredit above 0; read Payment rows with TxnDate on or after 2026-08-01 and keep those with UnappliedAmt above 0. 4) Check that each customer's open invoice balances add up to the report total for that customer; list every customer where they differ, with both numbers. Write ar-aging.md: a three-line summary (total open, total past 60 days, the three largest late balances), then one table per bucket order with customers past 60 days first, each with their late invoices (number, date, due date, balance, days late). Then a Fix first section: invoices with EmailStatus NeedToSend or NotSet, invoices with no DueDate, open credits and unapplied payments by customer. Write ar-aging.csv with one row per open invoice (customer, doc_number, txn_date, due_date, balance, days_past_due, bucket, email_status, bill_email). Write reminders.md with one draft email per customer more than 30 days past due, except those named in the notes: a subject line and a short, polite body listing each overdue invoice number, date and balance, signed with a placeholder for the owner's name. End with JSON {as_of, totals: {current, d1_30, d31_60, d61_90, d91_plus, total}, customers: [{name, current, d1_30, d31_60, d61_90, d91_plus, total}], mismatches: [], fix_first: [], reminders_drafted: [customer names]}."
}
  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. 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

ar-aging.md and ar-aging.csv hold the client's receivables by age bucket, and reminders.md drafts a reminder for each overdue customer. They come back among the session's files, beside the JSON in the session's result, which the run.completed webhook carries to the portal's server. The portal shows the client the bucket totals and the customers past 60 days, and puts the drafts in the bookkeeper's queue. Every number traces to the report or the invoice it came from, and any customer whose invoices do not add up to the report total is listed rather than smoothed over.

What the bookkeeper checks before the owner sees it: the Fix first list, because applying an open credit or an unapplied payment can take a customer out of the late buckets entirely, and the invoices that may never have been emailed, which call for a resend rather than a reminder. Then the drafts: the bookkeeper or the owner edits and sends each one from their own email, or deletes it when they already know the cheque is in the post. The agent sends nothing, applies nothing and changes nothing in the books.

Run it on every Monday morning

The portal starts one run per client every Monday at 6:00 in the client's timezone: POST /o/{org}/sessions with {"agent": "<agent id>", "input": "…"} for that client's agent, the input written from the date and the notes the bookkeeper keeps in the portal, and a request_id that is a UUID v5 of the client id and the date, so a retried scheduler starts nothing twice.

A firm with eighty clients starts eighty runs at once, each on its own computer and each reading only its own client's company. When an owner asks on a Thursday who still owes them before a big supplier payment, the bookkeeper starts that client's agent again with the day's date and gets the same report as of that day.

The use case this job follows, with its automation and trigger: Run an agent per customer task.

Why run it on Rush?

Each client's Intuit sign-in is held in Rush's connection under that client's own agent, so the firm keeps no Intuit tokens and no run can read another client's books. Each session lists the QuickBooks company it read in accounts by realm id, and GET /o/{org}/sessions?account=<realm id> lists every run that touched a client's books, which answers a client who asks what the firm's software read.

An exported aging summary tells the owner who is late but not why, and a script that formats it cannot notice the unapplied payment that makes a good customer look ninety days late or the invoice that was never emailed. The agent reads the invoices behind each bucket, says what to fix before anyone calls, and drafts the calls it cannot make. Each run has its own computer and a record of every query it made, and GET /o/{org}/sessions?agent=<agent id> adds up what each client's reports cost in model calls.

Frequently asked questions

What is an accounts receivable aging report?

It lists every customer who owes the business money and splits each balance by how long it has been outstanding, usually current, 1 to 30, 31 to 60, 61 to 90 and over 90 days. The older a balance gets, the less likely it is to be paid, so the report tells the owner who to chase first.

Does it send the reminders?

No. It writes drafts in reminders.md, and a person edits and sends each one. The QuickBooks connection could also write, so the template's instructions and the prompt keep the agent to reading and sending nothing, which keeps a person deciding what goes to a customer who may be on a payment plan or disputing an invoice.

Why does it read invoices as well as the aging report?

The QuickBooks aging summary shows a total per customer, not the invoices behind it. Reading the open invoices gives the invoice numbers a reminder needs, shows which were never emailed, and lets the agent check that the invoices add up to the summary.

Can it age by invoice date instead of due date?

Yes, in the CSV. The agent already reads each open invoice's TxnDate and DueDate, so when a client prefers aging from the invoice date, say so in the input: it computes the buckets from TxnDate, labels the report that way, and keeps the QuickBooks summary beside it for comparison.

More QuickBooks jobs

More jobs like this: Run an agent per customer task

Keep reading