
Exact Ledger Reconciler
Explains which charges, refunds and fees make up a Stripe, PayPal or bank payout, with an exact solver instead of a model: subset-sum over integer minor units (meet-in-the-middle, DP, branch-and-bound) across candidate fee schedules (percentage + fixed, tiers, caps), withholding, FX rates and rounding conventions (half-up, half-even, truncate; per line or on the total). Paste a Stripe balance or payout-reconciliation CSV, a PayPal activity CSV or structured rows. verdict.action is RECONCILED, MATCHED_WITH_UNSETTLED_ITEMS (every payout explained, some items belong to a later payout), AMBIGUOUS (with the exact count), UNMATCHED_SETTLEMENTS (missing items, phantom payouts and the closest near-miss) or SEARCH_INCOMPLETE. Reports which rounding convention reconciles and a hash-chained audit trail. Structured input, CSV and plain one-amount-per-line statements make zero LLM calls; other free text is normalized by a fast-tier LLM whose rows must quote the source verbatim. Not accounting or tax advice.
What you get
Finance teams and agents stop trusting a model's arithmetic: every matched payout, residual and ambiguity count is recomputable from a hash-chained audit trail.
Call it
Send the JSON body below to https://agents.writerslogic.com/api/v1/reconcile-ledger. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.
curl -i -X POST https://agents.writerslogic.com/api/v1/reconcile-ledger \
-H 'content-type: application/json' \
-d '{"text":{"items":"id,Type,Amount,Currency,Created (UTC)\nch_1,charge,100.00,usd,2026-10-01 09:12:44\nch_2,charge,250.00,usd,2026-10-01 14:03:10\nch_3,charge,40.00,usd,2026-10-02 08:45:31\nre_1,refund,25.00,usd,2026-10-02 16:20:05","settlements":"id,Amount,Currency,Arrival Date\npo_1,314.25,usd,2026-10-05"},"feeSchedules":[{"id":"stripe_us_card","rules":[{"percent":"2.9","fixed":"0.30"}]}]}'
Input
| Field | Type | Required | Description |
|---|---|---|---|
items | array<object>; max 2000 items | no | Ledger lines. Amounts are signed (refunds and disputes negative) strings in major units, e.g. "1234.56". |
settlements | array<object>; max 200 items | no | Payouts or bank settlement totals to explain. |
feeSchedules | array<object>; max 20 items | no | Candidate fee schedules; the solver reports which one reconciles each settlement. Omit for no fees. |
withholdings | array<object>; max 20 items | no | |
fxRates | array<object>; max 500 items | no | Direct rates only (1 from = rate to). The latest rate dated on or before the reference date applies; an undated rate is the fallback. |
text | object | no | Messy source text for collections not given structurally. A CSV with a header (Stripe balance or payout-reconciliation export, PayPal activity export, bank statement) is parsed by code with no model, and so are headerless lines with one amount each (date, id, amount, currency, and wording that names one kind, such as Payment or Refund); anything else goes to a fast-tier LLM that must quote every row verbatim. |
defaultCurrency | string; length 3..3 | no | Currency for text rows that state none. |
crossCheck | boolean | no | Run two independent LLM translations and keep only rows both produced (default true). |
conventions | object | no | Restrict the conventions searched (default: all rounding modes x both scopes x both FX date policies). |
toleranceMinor | integer; 0..1000000 | no | Accepted |residual| per settlement in minor units (default 0 = exact). |
nearMissToleranceMinor | integer; 1..1000000000 | no | Largest residual searched when reporting the closest near-miss for an unmatched settlement. |
maxLagDays | integer; 0..3650 | no | An item may settle at most this many days after its date. |
limits | object | no |
Example request body
{
"text": {
"items": "id,Type,Amount,Currency,Created (UTC)\nch_1,charge,100.00,usd,2026-10-01 09:12:44\nch_2,charge,250.00,usd,2026-10-01 14:03:10\nch_3,charge,40.00,usd,2026-10-02 08:45:31\nre_1,refund,25.00,usd,2026-10-02 16:20:05",
"settlements": "id,Amount,Currency,Arrival Date\npo_1,314.25,usd,2026-10-05"
},
"feeSchedules": [
{
"id": "stripe_us_card",
"rules": [
{
"percent": "2.9",
"fixed": "0.30"
}
]
}
]
}
Result
The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.
| Field | Type | Required | Description |
|---|---|---|---|
verdict | object | no | Machine-readable call, computed in code. Leads the answer; detail follows in the other fields. |
disclaimer | string | no | Not financial advice. |
status | string; one of "UNIQUE", "AMBIGUOUS", "NO_EXACT_MATCH", "BUDGET_EXCEEDED", "INSUFFICIENT_INPUT" | no | UNIQUE only when the search completed and exactly one assignment exists. |
deterministic | boolean | no | True when no LLM touched the verdict path (structured, CSV or line-grammar input). |
reconciled | boolean | no | Every settlement matched and no item left unsettled. |
summary | object | no | |
solution | one of | no | The recommended assignment (lowest date lag among the reported solutions); null when no settlement matched. |
alternatives | array<object> | no | |
ambiguity | object | no | |
conventions | object | no | Which rounding mode / scope / FX policy reproduces the settlements. |
discrepancies | object | no | Unsettled items, phantom settlements, residuals, closest near-misses. |
budget | object | no | |
audit | object | no | Solver, budgets, statistics, canonical input hash and the hash-chained step list. |
translation | object | no | |
notes | array<string> | no |
Pay and connect
Available through: x402 (USDC on Base), MCP, RapidAPI, Apify.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent