Filtering Accounts and Transactions with Partial Address Matching
Last updated: September 3, 2025
Overview
Ledger v2.3 introduces a new filtering capability that makes it easier to query accounts and transactions using partial account addresses. This enhancement extends the flexibility of the API by supporting patterns with the ... syntax, allowing you to match account hierarchies without needing to specify the full path.
This improvement streamlines working with account hierarchies by eliminating the need to know or specify full account addresses. It is particularly useful in cases where accounts are structured with predictable prefixes (e.g., wallet:, customer:, merchant:), but the trailing segments can vary.
What Changed
Partial address support: You can now use the
...syntax to filter accounts and transactions by address prefix. Using this syntax like "abc:123::…" to find all remaining segments (like a startWith)Improved type safety: Filter predicates now ensure proper casting of values to
string.Expanded coverage: Additional test cases validate the behavior of partial address queries across accounts and transactions.
How It Works
With the new syntax, you can query using partial addresses. For example:
# Chart of Accounts
chart:
wallet:
$id:
main:
_description: used to store a user available to spend balance
pending:
_description: used to store a user deposited funds pending settlement
hold:
payouts:
$id:
pending:
cancelled:
completed:By using the following filter, you’ll be able to get the entire chart of account (all "sub-accounts"), for a specific user xxx for instance
{
"$match": {"account": "wallet:xxx:..."}
}You can combine this with existing filtering capabilities for more granular queries.
Migration Notes
Queries without
...continue to work exactly as before.Partial address matching is optional—you can use it only where it simplifies queries.
No changes are required to existing clients unless you want to adopt the new feature.