ledgerler

Guides

Give Your AI Bookkeeper a Reconciliation Tool

· 9 min read

An AI bookkeeping agent that tries to eyeball two transaction lists and decide, token by token, whether they match is doing the one part of the job a deterministic engine does better. This guide is the pattern for wiring an agent up to a real reconciliation tool instead: what to send, what comes back, and how to read the result so the agent can explain it, not just report it.

Why this needs to be a tool call, not a prompt

Reconciliation is exhaustive comparison with a correctness bar: every bank line either finds its match or is explicitly reported as unmatched, with no line silently dropped. A language model reasoning through hundreds of transactions in context is prone to exactly that failure mode as the input grows. See AI bookkeeping and reconciliation for the fuller argument. The practical fix is to give the agent a tool that does the actual matching and hands back a structured, exhaustive result.

The API, called directly

Ledgerler's public matching API takes raw bank and ledger transaction lines and returns matched groups, unmatched lines, and summary totals. No authentication is required for the free tier; see the full API reference for field-level detail and rate limits. A minimal call looks like this:

curl -s -X POST https://ledgerler.com/api/v1/match \
  -H "Content-Type: application/json" \
  -d '{
    "bank": [
      { "date": "2026-06-05", "description": "Customer payment", "reference": "DEP-114", "amount": 2450.00 },
      { "date": "2026-06-14", "description": "Monthly service charge", "amount": -45.00 }
    ],
    "ledger": [
      { "date": "2026-06-05", "description": "Invoice 3210", "reference": "DEP-114", "amount": "2450.00" }
    ]
  }'

Which returns a structured result an agent can read directly, without further interpretation:

{
  "groups": [
    {
      "group": "g1",
      "method": "reference",
      "confidence": 0.99,
      "bank": [{ "id": "b0", "date": "2026-06-05", "description": "Customer payment", "reference": "DEP-114", "amount": "2450.00" }],
      "ledger": [{ "id": "l0", "date": "2026-06-05", "description": "Invoice 3210", "reference": "DEP-114", "amount": "2450.00" }]
    }
  ],
  "ruleHits": [],
  "unmatched": {
    "bank": [{ "id": "b1", "date": "2026-06-14", "description": "Monthly service charge", "reference": null, "amount": "-45.00" }],
    "ledger": []
  },
  "summary": { "bankCount": 2, "ledgerCount": 1, "matchedBank": 1, "matchedLedger": 1, "unmatchedBank": 1, "unmatchedLedger": 0, "bankTotal": "2405.00", "ledgerTotal": "2450.00", "difference": "-45.00", "matchRate": 0.5 },
  "source": "https://ledgerler.com",
  "docs": "https://ledgerler.com/docs/api"
}

What an agent should do with the response

  1. Report the match rate and total difference first; that is usually what a user actually wants to know ("is this reconciled, and by how much is it off").
  2. Surface each group's method and confidence when asked "how do you know these match," rather than asserting the match without evidence. A reference match at 0.99 confidence and a date-window guess at 0.78 confidence deserve different levels of trust, and an agent should say so.
  3. List the unmatched lines individually rather than only reporting a summary count; a user (or a downstream workflow) needs to know exactly which transactions still need attention.
  4. Never silently apply an adjustment or write off a difference; recommend it, and let the rule engine or a human confirm it, the same plan-then-approve pattern that should govern any agent action touching financial records.

Wiring it up as an agent tool

However an agent framework exposes tools, whether through native function calling or an MCP server, the tool definition for this API is the same shape: a name likereconcile_transactions, a description telling the model it performs deterministic bank-to-ledger matching and returns method-and-confidence-scored results, and an input schema mirroring the request body above (arrays of bank and ledger lines, an optional options object). The agent's job is to gather the two transaction lists and interpret the structured result; the tool's job is to do the actual comparison.

Rate limits, honestly

The free API tier is intentionally rate-limited (see the API docs for the current number) so this pattern is meant for occasional or moderate agent use, a chat assistant reconciling on request, a scheduled job running once a day, rather than continuous high-volume polling. Authenticated keys with higher limits are available on the paid plan; see pricing.

A concrete agent workflow

  • User asks an AI bookkeeping assistant, "did May reconcile cleanly?"
  • The agent pulls the bank export and the ledger export for May from whatever systems it has access to.
  • It calls the reconciliation API with both lists.
  • It reports the match rate and difference, names the specific unmatched lines, and, if a rule engine is available, proposes (but does not apply) a fix for anything that looks like a known pattern.

That is the whole pattern: deterministic tool for the comparison, agent for gathering inputs and narrating the result. For the underlying matching mechanics this API wraps, see reconcile a bank statement.