Outcome
Fetch Xero's own trial balance as at a date and compare it with Books account by account. Returns whether they agree, and every difference worst first — including accounts Books has a balance on that Xero does not report. Read-only unless post is true, which carries every difference into one journal against opening balances and needs confirmation "POST"; it refuses to post when any Xero account cannot be matched, because a difference coded to the wrong account is worse than one left visible. Use this before trusting a migration or leaving Xero.
Before you start
- Verify the intended environment, authenticated identity and specifically approved organization context.
- The published application permission is migrations:write. Discover the exact granted canonical Books workspace and bind it separately from action input.
- Approve the actual mutation, accounting inputs and any provider/recipient effects before CLI --confirm or MCP confirm:true. Fixture identifiers and simulated provider responses authorize no live operation.
Discover the target
topolo whoami --json
topolo actions get app_topolo_books.migrations.xero.reconcile --detail --json
topolo resources topolo-books --json
topolo workspaces list topolo-books --json
- Set BOOKS_WORKSPACE_ID to the exact granted workspace returned by discovery.
Request
POST /api/migrations/xero/reconcile
Inspect and test this action. Save the reviewed input as payload.json; supply credential/resource context separately.
Input fields
| Field | Required | Meaning | Schema and constraints |
|---|---|---|---|
asOf | Optional | as Of | {"type":"string","pattern":"^\d{4}-\d{2}-\d{2}$"} |
post | Optional | Whether to post the reconciliation adjustment. Inspect differences before specifically authorizing a posting. | {"type":"boolean"} |
confirmation | Optional | Literal confirmation required by this schema, such as ERASE or REPAIR; obtain approval for the actual effects first. | {"type":"string","const":"POST"} |
raw | Optional | Whether to return the raw provider report rather than the normalized comparison. | {"type":"boolean"} |
Inspect nested fields and the complete input schema.
Effects
- Reads only, by default: fetches Xero's trial balance as at asOf and returns it beside Books account by account, with every difference worst first.
- With post true and confirmation "POST" it also writes one journal dated asOf, carrying every difference against the opening balances account, so Books then says exactly what Xero says.
Interpret the response
Read $.asOf for the returned xero_reconciliation identifier. Empty collections and nullable fields do not discover a target.
Inspect agrees, every differences/unmatched entry and both totals. HTTP 200 means the comparison ran, not that the systems agree. When post:true was specifically authorized, retain posted journal evidence and repeat the read-only comparison. Raw report mode returns the provider report instead.
Inspect the success schema. CLI/MCP add their own transport envelope; CLI --detail requests the full result.
Worked examples
Actual Books route handlers and the exported Worker were exercised against five local SQLite D1 concern databases with all committed migrations, the real posting Durable Object and local R2. Route captures use synthetic verified Auth; Worker captures use synthetic Auth transports. Nexus, Brand, Notify, Pay, Mercury and Xero responses are explicitly simulated at the provider transport boundary. Captures prove local request/response behavior and canonical SDK projection, not live bank access, payment movement, email delivery, provider eligibility, tax compliance, encrypted custody, scheduled execution, deployment or production completion. Fixture identities, credentials, addresses and records authorize no live operation.
Run a reviewed request
Save the input from the selected worked example as payload.json. Validate and inspect the plan before calling the action; refused examples demonstrate errors and are not instructions to execute.
CLI:
topolo actions validate app_topolo_books.migrations.xero.reconcile --data @payload.json --json
topolo actions plan app_topolo_books.migrations.xero.reconcile --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_books.migrations.xero.reconcile --resource-type workspace --resource-id "$BOOKS_WORKSPACE_ID" --data @payload.json --confirm --detail --json
MCP tool and arguments for the first successful example:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_books.migrations.xero.reconcile",
"input": {
"asOf": "2026-09-07",
"post": false
},
"resourceType": "workspace",
"resourceId": "<exact granted workspace id>",
"confirm": true,
"detail": true
}
}
Refused response · auth_error
Input · payload.json:
{
"asOf": "2026-09-07"
}
Captured response · HTTP 401
{
"error": "API key validation failed"
}
HTTP 401. SDK error code auth_error. Authenticate in the intended organization again. Verify whoami and the exact Books application/workspace binding before retrying; do not switch identity to work around a refusal.
Successful response · HTTP 200
Input · payload.json:
{
"asOf": "2026-09-07",
"post": false
}
Captured response · HTTP 200
{
"asOf": "2026-09-07",
"currency": "USD",
"agrees": false,
"xeroTotalDebitMinor": 10000,
"xeroTotalCreditMinor": 10000,
"booksTotalDebitMinor": 0,
"booksTotalCreditMinor": 0,
"differenceMinor": 0,
"differences": [
{
"accountId": "acc_f2f346966879492cbb8f6556646d7c83",
"code": "1000",
"name": "Mercury Checking ••8228",
"xeroMinor": 10000,
"booksMinor": 0,
"differenceMinor": 10000
},
{
"accountId": "acc_f43e49c883b24820a903f3e1be9a2b16",
"code": "200",
"name": "Sales",
"xeroMinor": -10000,
"booksMinor": 0,
"differenceMinor": -10000
}
],
"unmatched": [],
"posted": null
}
HTTP 200. Inspect agrees, every differences/unmatched entry and both totals. HTTP 200 means the comparison ran, not that the systems agree. When post:true was specifically authorized, retain posted journal evidence and repeat the read-only comparison. Raw report mode returns the provider report instead.
Refused response · dependency_unavailable
Input · payload.json:
{
"asOf": "2026-09-07"
}
Captured response · HTTP 503
{
"error": "dependency_unavailable",
"message": "Xero is temporarily unavailable. Try again shortly.",
"details": {
"provider": "xero",
"retryable": true,
"operation": "Reports/TrialBalance",
"upstreamStatus": 500
}
}
HTTP 503. SDK error code dependency_unavailable. Inspect details.provider, operation, upstreamStatus and retryable. Restore provider availability; after any uncertain write read current state before a serial retry. Preserve the request id.
Verify the result
- Inspect agrees, every differences/unmatched entry and both totals. HTTP 200 means the comparison ran, not that the systems agree.
- When post:true was specifically authorized, retain posted journal evidence and repeat the read-only comparison. Raw report mode returns the provider report instead.
Errors and recovery
auth_error(HTTP 401): Authenticate in the intended organization again. Verify whoami and the exact Books application/workspace binding before retrying; do not switch identity to work around a refusal.dependency_unavailable(HTTP 503): Inspect details.provider, operation, upstreamStatus and retryable. Restore provider availability; after any uncertain write read current state before a serial retry. Preserve the request id.
These are observed local refusals. Shared authentication, schema validation and resource authorization can also refuse before the route. Preserve the actual error, details and request id.
Recovery boundary
Reverse the journal this posted; its id is in the response. Nothing else is written.
Related actions
- Get trial balance: Every account holding a balance at the date, each on one side only: debitMinor carries a debit balance, creditMinor a credit balance, and the other is zero. Accounts that net to nothing are left out. totalDebitMinor and totalCreditMinor are the sums of those balances and must agree, which is what balanced reports. These are balances, not turnover: they do not add up everything ever posted to an account, which would count both sides of every entry and count an expense again when a year-end close reverses it.
- Reverse a journal: Post the reversal of a journal: the same lines negated, dated as requested (default the original date). A journal can be reversed once; corrections are reversals, never edits.
Evidence
Actual Books route handlers and the exported Worker were exercised against five local SQLite D1 concern databases with all committed migrations, the real posting Durable Object and local R2. Route captures use synthetic verified Auth; Worker captures use synthetic Auth transports. Nexus, Brand, Notify, Pay, Mercury and Xero responses are explicitly simulated at the provider transport boundary. Captures prove local request/response behavior and canonical SDK projection, not live bank access, payment movement, email delivery, provider eligibility, tax compliance, encrypted custody, scheduled execution, deployment or production completion. Fixture identities, credentials, addresses and records authorize no live operation.