> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oneshotagent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bank Reconciliation

> Review unreconciled Xero bank lines, proposed matches and a cited, unsent missing-document chase list.

Returns a read-only review pack for one client and one calendar month: every observed unreconciled Xero bank line, supported proposed matches, coverage and a cited missing-document chase list. It never changes the ledger, files a return, drafts mail or sends the chase text.

Select an active Xero ledger connection. Optional Outlook/Gmail and Box/OneDrive/Google Drive connections must belong to the same client; connection labels alone do not prove this. Document comparison requires explicit client identity evidence matching the ledger account. Google Drive reads Sheets CSV only; Gmail reads inline MIME attachments. Unsupported documents remain review items.

Omitted materiality\_threshold defaults to 0 in quote, paid input and result scope. The threshold is in each line’s native currency, without conversion; it affects the chase only, never removes lines. Unknown amounts or currencies always require review. The month must be real and its search windows must remain within 1900 through 9999.

One fixed price per request with a fixed internal spending cap and a 900-second deadline; see the pricing page. Bounds are 500 bank lines in 5 pages, 10 combined candidate pages, 20 combined searches, 10 combined content reads, 5 attachment metadata reads and 50 connected reads total. Content is limited to 10 MiB per document and 20 MiB per request; only bounded labelled plain text or CSV is parsed.

Quote first, retry with X-Quote-ID and payment, then poll GET /v1/requests/:id after the paid 202 response. Deadline, budget and work limits return the latest valid partial with an explicit end reason. Counts do not claim an unseen total. Exhaustive zero lines and all-unmatched results are useful; no usable result refunds the full price as credits once. A useful partial has no automatic refund.

Sources name exact provider records and successful receipt calls. Raw mail bodies, snippets and document bytes are not retained. The chase text says when the review is incomplete and is returned for the firm to review and send itself.

Before reporting a document not found, search each selected source by the observed reference first, then by counterparty plus invoice, receipt or remittance. Values are literal search terms, quoted and escaped for each connected system’s search syntax. A missing reference skips that stage; a missing counterparty cannot establish absence in optional sources. Every search page and returned document must be inspected. Pending cursors or unreadable documents require an incomplete review.

## How it runs

The goal may use only these tools:

* `ledger_attachments`
* `ledger_bank_transactions`
* `ledger_bills`
* `ledger_invoices`

Selecting `mailbox_connection_id` also permits `mailbox_messages` and `mailbox_attachment`; selecting `files_connection_id` also permits `files_search` and `files_read`.

It spends at most a fixed budget of its own, never yours, and stops after 15 minutes. You pay the quoted price once.

1. Call the route. The answer is `402` with a quote of the fixed price (`context.quote_id`).
2. Pay, and send the same body again with the `X-Quote-ID` header. The answer is `202` with a `request_id`.
3. Poll `GET /v1/requests/{request_id}` until `status` is `completed` or `failed`.

## Authentication

Requires x402 payment in the `payment-signature` header on the paid call.

## Request Body

**ledger\_connection\_id** `string` *required*

Ledger connection id.

**mailbox\_connection\_id** `string`

Mailbox connection id.

**files\_connection\_id** `string`

Files connection id.

**files\_folder\_id** `string`

Files folder id.

**month** `string` *required*

Month.

**bank\_account\_id** `string`

Bank account id.

**materiality\_threshold** `number`

Chase threshold in each line’s native currency, without conversion; never hides bank lines. Defaults to `0`.

<Snippet file="audit-context-params.mdx" />

## Response (202 Accepted)

**request\_id** `string`

The request to poll at `/v1/requests/{request_id}`.

**receipt\_id** `string`

The receipt of the call. Once the request ends it lists every step the goal ran: the tool, its `call_id`, when it ran and what it cost.

## Result

Nested under `data.result` of `GET /v1/requests/{request_id}`.

**data.result.partial** `boolean`

`false` for an exhaustive review. `true` for the latest valid partial when a deadline, budget, work limit or incomplete evidence prevents completion.

**data.result.end\_reason** `string`

Why the goal ended: `check_passed` for a complete result; `limit_reached` for read/line ceilings; otherwise the actual ending, including `deadline_passed`, `budget_exhausted`, `check_failed` or `planner_failed`.

**data.result.result.scope** `object`

Scope.

**data.result.result.as\_of** `string`

As of.

**data.result.result.rows** `array`

Rows.

**data.result.result.no\_match\_lines** `array`

No match lines.

**data.result.result.missing\_documents** `array`

Missing documents.

**data.result.result.chase\_text** `string`

Chase text.

**data.result.result.counts** `object`

Counts.

**data.result.result.coverage** `object`

Coverage.

Each row preserves the bank line and its exact source, proposed match, document sources, search/document states and chase classification. Coverage records exhausted bank pagination, selected sources and stop reasons; counts and chase text are derived from the verified rows.

Every source identifies its connection, provider system, exact record id, parent id where applicable, and receipt call ids. Document matches require both metadata and content evidence; provider-linked ledger attachments require exact parent metadata. Unverified citations cannot support a match or a missing-document claim.

```bash cURL theme={null}
curl -X POST https://win.oneshotagent.com/v1/tools/ledger/bank-reconciliation \
  -H "Content-Type: application/json" \
  -H "X-Quote-ID: <quote_id from the 402>" \
  -H "payment-signature: <base64 x402 payment>" \
  -d '{
    "ledger_connection_id": "00000000-0000-4000-8000-000000000001",
    "month": "2024-02"
  }'
```

```typescript SDK theme={null}
const result = await agent.tool('ledger/bank-reconciliation', {
  ledger_connection_id: '00000000-0000-4000-8000-000000000001',
  month: '2024-02',
  timeout: 1020
});
console.log(result.result);
```

```json Result theme={null}
{
  "request_id": "uuid",
  "status": "pending",
  "tool": "bank_reconciliation"
}
```

> [!NOTE]
>
> See [Pricing](https://docs.oneshotagent.com/pricing.md) for this tool's price. The 402 quote states it before anything is charged.

## Notes

* A goal that ends with no valid result fails the request with `error_code` `no_result`, and the price is returned as credits.
* The goal is internal: it is not listed among your goals, and you cannot fund, pause or read it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.