All jobs

Which Ramp Transactions and Bills Failed to Sync to the Books? A Bookkeeping Firm's Close Check, One Agent per Client

A bookkeeping firm makes one agent per client, signed into that client's Ramp, that lists each card charge, bill and reimbursement that failed to sync before close.

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

What the agent does

This is for a bookkeeping firm that closes the books each month for twenty to two hundred small companies, many of which run their cards, bills and reimbursements through Ramp and sync them to an accounting system. A month cannot close while Ramp items sit unsynced: a card charge whose category was deleted in the ledger, a bill whose vendor does not exist there, a reimbursement refused for a closed period. Today a bookkeeper opens each client's Ramp, finds the sync screen and clicks through failures one at a time. The firm gives each client an agent that does that read on the third working day of the month and hands the bookkeeper one list per client.

The firm connects a Ramp account of its own and saves the agent once as a template with POST /o/{org}/agents, naming ramp in connections, with instructions that allow reads only. When a client joins, the firm's onboarding calls POST /o/{org}/agents {"template": "<template id>", "name": "ramp-close-<client id>"}, then POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "ramp"}, and shows the authorize_url to the client's controller inside the firm's portal. The controller signs in on Ramp's own page and chooses Read-only there. Ramp's docs say a read-only connection gets read scopes only, its tools that make changes are not listed, and each connection acts as the signed-in user with that user's Ramp permissions.

On a run the agent first calls ramp_get_erp_connection_status, which returns whether an accounting system is connected and which one; a client whose connection has dropped is reported at once, because nothing after that point can sync. Then it calls ramp_get_latest_sync once for each sync type Ramp names, TRANSACTION_SYNC, BILL_SYNC, BILL_PAYMENT_SYNC, REIMBURSEMENT_SYNC and TRANSFER_SYNC, and reads each commit's intended and successful counts. For every commit where the two differ, it calls ramp_get_sync_commit_failure_details with the commit's UUID to get the object-level failures: which transaction, bill or reimbursement failed and the reason the accounting system gave.

Last, it checks the month itself with ramp_get_transactions over the closing month, asking for submitted_items so it sees the accounting categories each charge was coded to, and keeps charges with no synced_at date. It reads each one with ramp_get_full_transaction_metadata to give the merchant, the amount from amount_decimal, the cardholder and the missing or rejected field. Every Ramp tool takes a required rationale, and the instructions have the agent write why it is making each call, so the record of the run explains itself. It never calls ramp_mark_ready_to_sync, ramp_edit_transaction or any approve tool.

Start it with one API call

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

{
  "agent": "<agent id>",
  "input": "Month-end sync check for this client. Closing month: October 2026 (2026-10-01 to 2026-10-31). Read only; fill every rationale with why you are making the call. 1) ramp_get_erp_connection_status: report the provider and whether it is connected. If it is not connected, stop and say so. 2) ramp_get_latest_sync for each sync_type: TRANSACTION_SYNC, BILL_SYNC, BILL_PAYMENT_SYNC, REIMBURSEMENT_SYNC, TRANSFER_SYNC. Record when each ran and its intended and successful counts. 3) For each commit where the counts differ, ramp_get_sync_commit_failure_details with its UUID; list every failed object with its type, id and the reason given. 4) ramp_get_transactions for the closing month with details_to_include_in_response ['submitted_items']; keep charges with no synced_at. For each, ramp_get_full_transaction_metadata: date, merchant, amount_decimal and currency, cardholder, the accounting fields chosen, and what is missing or rejected. Return JSON only: {erp: {provider, connected}, syncs: [{sync_type, ran_at, intended, succeeded}], failures: [{object_type, id, date (omit if unknown), counterparty (merchant, vendor or employee; omit if unknown), amount (omit if unknown), reason, likely_fix}], unsynced_charges: [{id, date, merchant, amount, currency, cardholder, missing}]}. likely_fix is one short sentence for a bookkeeper (for example 'category Meals was deactivated in the ledger; recode or reactivate'), never a decision. Never mark anything ready to sync, edit, approve, comment or upload."
}
  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

The run lists every Ramp transaction and bill that failed to sync to the books, with the reason the accounting system gave. The answer is JSON in the session's result and in the run.completed webhook the firm's API key sends. It also says whether the client's accounting connection is up, when each sync last ran and how much of it went through, and which of the month's charges have not synced at all. The firm's close checklist shows it under the client, with each failure as a line the bookkeeper ticks off.

What the bookkeeper checks before fixing anything: that a failure is still a failure, since a client's controller may have fixed it in Ramp after the run; that the likely_fix fits how this client keeps its books, because recoding a charge or reactivating a ledger account is the bookkeeper's decision, not the agent's; and any charge with no synced_at from the last day or two of the month, which may simply not have synced yet. The fixes themselves happen in Ramp and in the ledger, by a person.

Run it on every client's month-end close

The firm's practice-management system sends one POST /o/{org}/sessions per client on the third working day of the month, with that client's agent id as agent and the closing month in input, and a request_id that is a UUID v5 of the client id and the month, so a retried job never starts a second check for the same close. A bookkeeper who has fixed the failures can start the same request again from the client's page to confirm the list is empty.

Ramp's docs say a connection expires 30 days after it is made. The portal therefore asks each client's controller to sign in again before the close, by starting a new sign-in at /o/{org}/agents/{agent}/connections and showing the new authorize_url; an agent holds one sign-in per MCP server, so the new one replaces the old.

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 controller signs in on Ramp's page, and that sign-in belongs to their agent alone: a run for one client can never read another client's spend, and the firm's own runs never see any client's Ramp. When a client leaves, DELETE /o/{org}/agents/{agent} removes the agent and disconnects its Ramp. The firm registers no Ramp application and holds no Ramp token; it stores only the agent id beside the client.

Each run has its own computer and a record of every Ramp call, with the rationale the agent gave, so when a client asks why the firm flagged a bill, the bookkeeper opens that month's session and shows exactly what was read. Close week means two hundred checks on one morning; runs past the key's concurrent limit wait queued and start in turn, and adding up total_cost_usd over GET /o/{org}/sessions?agent=<agent id> gives the cost of the check for each client.

Frequently asked questions

Why not have the agent fix the failures?

A sync failure is usually a coding decision: which category, which vendor, which period. The template keeps the agent to reading, the client's controller connects with Ramp's Read-only choice, and Ramp refuses writes on such a connection. The bookkeeper fixes each item knowing the client's books.

What if a client's Ramp is not connected to an accounting system?

The first call, ramp_get_erp_connection_status, says so, and the prompt has the agent stop there and report it. That client's close starts with reconnecting the ledger, which the firm handles with the client.

Does the agent see every card in the client's company?

It sees what the person who signed in can see in Ramp, because each connection acts as that user with their permissions. The firm asks for a controller or admin to connect, so the check covers the whole company rather than one person's cards.

Can the firm run it more than once a month?

Yes. The same request can start any day, for example weekly during a busy quarter, and each run reads the latest sync for each type. Only the month in the prompt changes.

More Ramp jobs

More jobs like this: Run an agent per customer task

Keep reading