Method

reconcile.finish

Finish a reconciliation: ticked splits become reconciled and the statement date becomes the last reconcile date.

Finishes a reconciliation: every ticked split becomes reconciled (y) with the statement date as its reconcile date, and the statement date becomes the account's last reconcile date. A postponed reconciliation is cleared.

It is refused with invalid unless the difference is zero, the message saying how far off it is; force: true finishes anyway, as GnuCash does when you confirm "The account is not balanced". Unticked splits keep their state.

Examples

Example: with a copy of the reports/reconcile example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"reconcile.finish","params":{"account":"Root:Asset:Bank","statementDate":"1970-03-01","endingBalance":"21.00","ticked":["d0000000000000000000000000000005"]}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "reconciled": [
      {
        "split": "d0000000000000000000000000000005",
        "transaction": "c0000000000000000000000000000002",
        "from": "c",
        "to": "y"
      }
    ],
    "difference": {
      "num": "0",
      "denom": "100"
    },
    "…": "…"
  }
}

Request:

{"jsonrpc":"2.0","id":2,"method":"reconcile.info","params":{"account":"Root:Asset:Bank"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "lastDate": "…",
    "postponeDate": null,
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
reconcile.finish {"account":"Root:Asset:Bank","statementDate":"1970-03-01","endingBalance":"21.00","ticked":["d0000000000000000000000000000005"]}
reconcile.info {"account":"Root:Asset:Bank"}
EOF

It prints:

[
  {
    "reconciled": [
      {
        "split": "d0000000000000000000000000000005",
        "transaction": "c0000000000000000000000000000002",
        "from": "c",
        "to": "y"
      }
    ],
    "difference": {
      "num": "0",
      "denom": "100"
    },
    "…": "…"
  },
  {
    "lastDate": "…",
    "postponeDate": null,
    "…": "…"
  }
]

MCP tool call

Tool call:

{"name":"reconcile.finish","arguments":{"account":"Root:Asset:Bank","statementDate":"1970-03-01","endingBalance":"21.00","ticked":["d0000000000000000000000000000005"]}}

Result:

{
  "structuredContent": {
    "reconciled": [
      {
        "split": "d0000000000000000000000000000005",
        "transaction": "c0000000000000000000000000000002",
        "from": "c",
        "to": "y"
      }
    ],
    "difference": {
      "num": "0",
      "denom": "100"
    },
    "…": "…"
  }
}

Tool call:

{"name":"reconcile.info","arguments":{"account":"Root:Asset:Bank"}}

Result:

{
  "structuredContent": {
    "lastDate": "…",
    "postponeDate": null,
    "…": "…"
  }
}

An unbalanced statement is refused:

Example: with a copy of the reports/reconcile example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"reconcile.finish","params":{"account":"Root:Asset:Bank","statementDate":"1970-03-01","endingBalance":"9.00","ticked":[]}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 2001,
    "message": "…",
    "data": {
      "help": "error/invalid"
    }
  }
}

Command line

red-ale exec --book book.gnucash reconcile.finish '{"account":"Root:Asset:Bank","statementDate":"1970-03-01","endingBalance":"9.00","ticked":[]}'

It fails with exit status 2, printing on standard error:

{
  "error": {
    "code": 2001,
    "message": "…",
    "data": {
      "help": "error/invalid"
    }
  }
}

MCP tool call

Tool call:

{"name":"reconcile.finish","arguments":{"account":"Root:Asset:Bank","statementDate":"1970-03-01","endingBalance":"9.00","ticked":[]}}

Result:

{
  "isError": true,
  "structuredContent": {
    "error": {
      "code": 2001,
      "name": "invalid",
      "message": "…",
      "data": {
        "help": "error/invalid"
      }
    }
  }
}

Effect: write, on the Book.

Params

Params of reconcile.finish and reconcile.postpone.

  • account (AccountRef, required): The account reconciled.
  • statementDate (Date, required): The statement date.
  • endingBalance (Amount, required): The statement's ending balance, raw sign.
  • includeSubaccounts (boolean or null): Reconcile the sub-accounts too. Defaults to the account's stored choice.
  • utcOffsetMinutes (integer (int32) or null): A fixed offset from UTC in minutes to use instead of the server's local time zone.
  • ticked (array of Guid, required): The ticked splits.
  • force (boolean): reconcile.finish only: finish even though the difference is not zero (GnuCash's "finish anyway").

Result

What reconcile.finish did.

  • reconciled (array of StateChangeWire, required): The splits now reconciled.
  • statementTime (Timestamp, required): The statement date, now the last reconcile date and the splits' reconcile date.
  • lastInterval (IntervalWire or null): The interval recorded for proposing the next statement date.
  • difference (Amount, required): The difference at Finish (zero unless forced).