Method

invoice.list

Invoices, bills and vouchers, optionally filtered.

Lists documents of every kind, without their lines, in GUID order. Filter by type (invoice, bill, expenseVoucher, creditNote), by owner (a customer's list includes its jobs' documents), by posted or unposted, by active, or by exact number. Numbers are only unique within a counter, so id may match an invoice and a bill.

Examples

Example: with a copy of the synthetic/business-editable example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"invoice.list","params":{"type":"expenseVoucher"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "invoices": [
      {
        "id": "000001",
        "type": "expenseVoucher",
        "posted": true,
        "entryCount": 1,
        "…": "…"
      }
    ]
  }
}

Request:

{"jsonrpc":"2.0","id":2,"method":"invoice.list","params":{"posted":false}}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "invoices": [
      {
        "guid": "71803cac5d8e4dceabfd0d56ec5e7521",
        "id": "000002",
        "posted": false,
        "…": "…"
      }
    ]
  }
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
invoice.list {"type":"expenseVoucher"}
invoice.list {"posted":false}
EOF

It prints:

[
  {
    "invoices": [
      {
        "id": "000001",
        "type": "expenseVoucher",
        "posted": true,
        "entryCount": 1,
        "…": "…"
      }
    ]
  },
  {
    "invoices": [
      {
        "guid": "71803cac5d8e4dceabfd0d56ec5e7521",
        "id": "000002",
        "posted": false,
        "…": "…"
      }
    ]
  }
]

MCP tool call

Tool call:

{"name":"invoice.list","arguments":{"type":"expenseVoucher"}}

Result:

{
  "structuredContent": {
    "invoices": [
      {
        "id": "000001",
        "type": "expenseVoucher",
        "posted": true,
        "entryCount": 1,
        "…": "…"
      }
    ]
  }
}

Tool call:

{"name":"invoice.list","arguments":{"posted":false}}

Result:

{
  "structuredContent": {
    "invoices": [
      {
        "guid": "71803cac5d8e4dceabfd0d56ec5e7521",
        "id": "000002",
        "posted": false,
        "…": "…"
      }
    ]
  }
}

Effect: read.

Params

Filters for invoice.list. All given filters must match.

  • type (DocumentKindWire or null): Only this type.
  • owner (Guid or null): Only this owner's documents; a customer or vendor also matches its jobs' documents.
  • posted (boolean or null): Only posted (true) or unposted (false) documents.
  • activeOnly (boolean): Only active documents.
  • id (string or null): The exact document number.

Result

Documents.

  • invoices (array of InvoiceInfo, required): In GUID order.