Method

transaction.get

A transaction with its splits.

Returns one transaction with all its splits, found by its GUID. Each split has its account, its value (in the transaction's currency) and its amount (in the account's commodity); the values add up to zero. Void, read-only and reversed-by state are included. GUIDs come from the call that posted the transaction, from transaction.list or from transaction.find.

Examples

Example: with a copy of the reports/test-data example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"transaction.get","params":{"guid":"c0000000000000000000000000000007"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "currency": "CURRENCY::USD",
    "description": "$100bank -> $80expenses + $20wallet",
    "datePosted": "1971-02-14",
    "void": false,
    "balanced": true,
    "splits": [
      {
        "accountName": "Root:Expenses",
        "value": {
          "num": "8000",
          "denom": "100"
        },
        "…": "…"
      },
      {
        "accountName": "Root:Asset:Wallet",
        "value": {
          "num": "2000",
          "denom": "100"
        },
        "…": "…"
      },
      {
        "accountName": "Root:Asset:Bank",
        "value": {
          "num": "-10000",
          "denom": "100"
        },
        "…": "…"
      }
    ],
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash transaction.get '{"guid":"c0000000000000000000000000000007"}'

It prints:

{
  "currency": "CURRENCY::USD",
  "description": "$100bank -> $80expenses + $20wallet",
  "datePosted": "1971-02-14",
  "void": false,
  "balanced": true,
  "splits": [
    {
      "accountName": "Root:Expenses",
      "value": {
        "num": "8000",
        "denom": "100"
      },
      "…": "…"
    },
    {
      "accountName": "Root:Asset:Wallet",
      "value": {
        "num": "2000",
        "denom": "100"
      },
      "…": "…"
    },
    {
      "accountName": "Root:Asset:Bank",
      "value": {
        "num": "-10000",
        "denom": "100"
      },
      "…": "…"
    }
  ],
  "…": "…"
}

MCP tool call

Tool call:

{"name":"transaction.get","arguments":{"guid":"c0000000000000000000000000000007"}}

Result:

{
  "structuredContent": {
    "currency": "CURRENCY::USD",
    "description": "$100bank -> $80expenses + $20wallet",
    "datePosted": "1971-02-14",
    "void": false,
    "balanced": true,
    "splits": [
      {
        "accountName": "Root:Expenses",
        "value": {
          "num": "8000",
          "denom": "100"
        },
        "…": "…"
      },
      {
        "accountName": "Root:Asset:Wallet",
        "value": {
          "num": "2000",
          "denom": "100"
        },
        "…": "…"
      },
      {
        "accountName": "Root:Asset:Bank",
        "value": {
          "num": "-10000",
          "denom": "100"
        },
        "…": "…"
      }
    ],
    "…": "…"
  }
}

Effect: read.

Params

Params naming one transaction.

  • guid (Guid, required): The transaction's GUID.

Result

A transaction, as returned by every transaction method.

  • guid (Guid, required): The transaction's GUID.
  • currency (CommodityId, required): The transaction currency, which values are in.
  • num (string or null): Check or reference number.
  • description (string or null): Description.
  • notes (string or null): Notes.
  • datePosted (Date or null): The posted date.
  • datePostedTime (Timestamp, required): The posted instant as stored (the posted date's day-neutral time for transactions GnuCash or red-ale enters).
  • dateEntered (Timestamp, required): When it was entered.
  • void (boolean, required): Void, by GnuCash 5.17's rule: the void timestamp is set.
  • voidReason (string or null): Why it was voided.
  • voidTime (Timestamp or null): When it was voided.
  • readOnly (string or null): Why it may not be changed, when read-only (voided, or generated by a business document).
  • reversedBy (Guid or null): The transaction that reverses this one.
  • closing (boolean, required): A book-closing transaction.
  • balanced (boolean, required): The split values sum to zero; with trading accounts on, trading values and each commodity's amounts too.
  • docLink (string or null): The document link (assoc_uri slot), as stored: a URL, a file:// URI, or a path relative to the path head.
  • splits (array of SplitInfo, required): Its splits, in stored order (debits first).