{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "added": "pre-v0.10.1",
  "rpc": "bkpr-listincome",
  "title": "Command for listing all income impacting events",
  "description": [
    "The **bkpr-listincome** RPC command is a list of all income impacting events that the bookkeeper plugin has recorded for this node."
  ],
  "request": {
    "required": [],
    "additionalProperties": false,
    "properties": {
      "consolidate_fees": {
        "type": "boolean",
        "description": [
          "If true, we emit a single, consolidated event for any onchain-fees for a txid and account. Otherwise, events for every update to the onchain fee calculation for this account and txid will be printed. Note that this means that the events emitted are non-stable, i.e. calling **listincome** twice may result in different onchain fee events being emitted, depending on how much information we've logged for that transaction."
        ],
        "default": "True"
      },
      "start_time": {
        "type": "u32",
        "description": [
          "UNIX timestamp (in seconds) that filters events after the provided timestamp."
        ],
        "default": "zero"
      },
      "end_time": {
        "type": "u32",
        "description": [
          "UNIX timestamp (in seconds) that filters events up to and at the provided timestamp."
        ],
        "default": "max-int"
      }
    }
  },
  "response": {
    "required": [
      "income_events"
    ],
    "additionalProperties": false,
    "properties": {
      "income_events": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "account",
            "tag",
            "credit_msat",
            "debit_msat",
            "currency",
            "timestamp"
          ],
          "properties": {
            "account": {
              "type": "string",
              "description": [
                "The account name. If the account is a channel, the channel_id."
              ]
            },
            "tag": {
              "type": "string",
              "description": [
                "Type of income event."
              ]
            },
            "credit_msat": {
              "type": "msat",
              "description": [
                "Amount earned (income)."
              ]
            },
            "debit_msat": {
              "type": "msat",
              "description": [
                "Amount spent (expenses)."
              ]
            },
            "currency": {
              "type": "string",
              "description": [
                "Human-readable bech32 part for this coin type."
              ]
            },
            "timestamp": {
              "type": "u32",
              "description": [
                "Timestamp this event was recorded by the node. For consolidated events such as onchain_fees, the most recent timestamp."
              ]
            },
            "description": {
              "type": "string",
              "description": [
                "More information about this event. If a `invoice` type, typically the bolt11/bolt12 description."
              ]
            },
            "outpoint": {
              "type": "string",
              "description": [
                "The txid:outnum for this event, if applicable."
              ]
            },
            "txid": {
              "type": "txid",
              "description": [
                "The txid of the transaction that created this event, if applicable."
              ]
            },
            "payment_id": {
              "type": "hex",
              "description": [
                "Lightning payment identifier. For an htlc, this will be the preimage."
              ]
            }
          }
        }
      }
    }
  },
  "author": [
    "Lisa Neigut [niftynei@gmail.com](mailto:niftynei@gmail.com) is mainly responsible."
  ],
  "see_also": [
    "lightning-bkpr-listaccountevents(7)",
    "lightning-listfunds(7)",
    "lightning-bkpr-listbalances(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:bkpr-listincome#1",
        "method": "bkpr-listincome",
        "params": {
          "consolidate_fees": false
        }
      },
      "response": {
        "income_events": [
          {
            "account": "wallet",
            "tag": "deposit",
            "credit_msat": 200000000000,
            "debit_msat": 0,
            "currency": "bcrt",
            "timestamp": 1738500000,
            "description": "edited utxo description",
            "outpoint": "txidbk0000000000000000000000000000000000000000000000000000000000:1"
          },
          {
            "account": "wallet",
            "tag": "deposit",
            "credit_msat": 2000000000,
            "debit_msat": 0,
            "currency": "bcrt",
            "timestamp": 1738510000,
            "outpoint": "txidbk0101010101010101010101010101010101010101010101010101010101:1"
          },
          {
            "account": "wallet",
            "tag": "onchain_fee",
            "credit_msat": 0,
            "debit_msat": 1004927000,
            "currency": "bcrt",
            "timestamp": 1738520000,
            "txid": "channeltxid340000340000340000340000340000340000340000340000340000"
          },
          {
            "account": "wallet",
            "tag": "onchain_fee",
            "credit_msat": 1004927000,
            "debit_msat": 0,
            "currency": "bcrt",
            "timestamp": 1738530000,
            "txid": "channeltxid340000340000340000340000340000340000340000340000340000"
          }
        ]
      }
    },
    {
      "request": {
        "id": "example:bkpr-listincome#2",
        "method": "bkpr-listincome",
        "params": {}
      },
      "response": {
        "income_events": [
          {
            "account": "wallet",
            "tag": "deposit",
            "credit_msat": 200000000000,
            "debit_msat": 0,
            "currency": "bcrt",
            "timestamp": 1738510000,
            "description": "edited utxo description",
            "outpoint": "txidbk0101010101010101010101010101010101010101010101010101010101:1"
          },
          {
            "account": "channelid0230000230000230000230000230000230000230000230000230000",
            "tag": "invoice",
            "credit_msat": 500000000,
            "debit_msat": 0,
            "currency": "bcrt",
            "timestamp": 1738520000,
            "description": "edited invoice description from description send some sats l2 to l3",
            "payment_id": "paymentid0000202020202020202020202020202020202020202020202020202"
          },
          {
            "account": "channelid0340200340200340200340200340200340200340200340200340200",
            "tag": "onchain_fee",
            "credit_msat": 0,
            "debit_msat": 6960000,
            "currency": "bcrt",
            "timestamp": 1738530000,
            "txid": "channeltxid340200340200340200340200340200340200340200340200340200"
          }
        ]
      }
    }
  ]
}
