Overview

Filters allow you to refine your search results based on specific values or ranges in your data. In this guide, you’ll learn how to use filters to find what you want in your ledger.

Filters are reprented by the filter_by field in your request payload. This field can be matched against one or more values. For example:

  • "status:applied" returns documents where the status is “applied.”
  • "status:[applied, inflight]" returns documents where the status is “applied” or “inflight.”

Exact vs non-exact filtering

To match a field’s value verbatim, use the := exact match operator, e.g., status:=applied returns documents where the status is exactly “applied”.

Using the non-exact match operator, :, will do a word-level partial match, returning documents where the field has the word within it, e.g., account_name:John will match records with account_name equal to John, John Smith, Smith John.

Negation

Not equal to / negation is supported by the :!= operator, e.g., currency:!=USD. This will return records where the currency field is not equal to “USD”.

You can also negate multiple values, e.g., currency:!=[USD, EUR].

To exclude results that contain strings, use the :! operator, e.g., account_name:!John will exclude all records with account_name containing “John” from the search results.

Filtering numbers and dates

To filter records with numeric values or dates, you can use the simple comparison operators >, >=, <, <=, and =. To filter between a min and max value, use the range operator, [min..max]

OperatorMeaningExamples
>Greater thanbalance:>500000
>=Greater than or equal tobalance:>=500000
<Less than or equal tobalance:<500000
<=Less than or equal tobalance:<=500000
=Equal tobalance:=500000
[min..max]Between min and maxbalance:[200..500000] filters docs where balance value is between 200 and 500000.

You can also filter multiple values, e.g., balance:[200..500000, 0] returns docs where the value is between 200 and 500000 or exactly equal to 0.

The same syntax works for date fields as well such as created_at or scheduled_for, e.g., created_at:>2024-04-21 returns docs with dates later than than 21 April, 2024.

Note, when filtering by date, input the values in the same format it was stored in your ledger (YYYY-MM-DD).

Multiple conditions

You can combine more than one filter condition in your query using the AND and OR operators. AND means all conditions must be true, while OR means that at least one condition must be true.

Alternative syntaxes:

  • && can be used in place of AND.
  • || can be used in place of OR.

For example, to filter all USD transactions with the APPLIED and INFLIGHT statuses, our filter will look like this: currency:=USD && status:[applied, inflight].

To use OR, e.g., all balances with balance less than 500000 or credit_balance above 100000, we’ll have: balance:<500000 || credit_balance:>100000.

You can also use both AND and OR in the same clause, e.g., (status:=applied || amount:>500000 && created_at:=2024-04-12) will return only transactions records created on 12 April, 2024 with amounts greater than 500000 or status is APPLIED.

See also

Need help?

Are you stuck? Do you have a question that isn’t answered in this doc? Have you run into a problem you can’t solve? Want to file a bug report?

Join our Discord server and share your questions/thoughts with other developers building financial applications like you.

Was this page helpful?