> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-console/filters.md).

# Filters

Filter users and event histories, choose monitor events, and select batch users with the same rules.

Find transfers, filter the Users list, choose monitor events, or select users for a batch. Join rules with **AND** when both must match, or **OR** when either can match. Nest groups when you need both, for example: an amount of at least 100 tokens **AND (sender is Alice OR Bob)**.

## Where you can filter

| Where                                                                                                                | What a rule selects                       | Fields                                                                   |
| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------ |
| [Contracts Explorer](/baas-console/contracts/explorer.md#filter-the-feed)                                            | The events of one deployment              | `args.<name>`, `occurredAt`, `key`, `wallet`                             |
| [Users Explorer](/baas-console/users/explorer.md)                                                                    | The events of one user on one deployment  | `args.<name>`, `occurredAt`, `key`, `direction`                          |
| [Monitor trigger](/baas-console/automations/triggers/monitor.md#filter-the-events)                                   | The events that fire the automation       | `args.<name>`                                                            |
| [Users list](/baas-console/users.md#find-a-user) / [Batch mode](/baas-console/automations/batch.md#select-the-users) | The users to display or run an action for | `id`, `email`, `createdAt`, `contractData.<chainId>.<address>.<dataKey>` |

**User history searches events involving one user. Users-list and Batch filters select user profiles.** They share the group structure, but offer different fields.

## Add a rule

1. Click **Filters** in the Users list or an Explorer, or open the rules panel in the monitor or batch form.
2. Click **Add filter**, then pick a field, an operator, and a value.
3. Add another rule and choose **AND** or **OR** before it. Use **Add group** to put related conditions together, like parentheses in an expression.
4. In the Users list or an Explorer, click **Apply** or press Enter. In an automation, save the form.

In the Explorer, the transfers sent by Alice or Bob, of at least `1000` tokens, since the start of the year, are three rules joined with **AND**: `args.from` **is one of** the two addresses, `args.value` **≥** `1000` with **Smart Unit** on, and `occurredAt` **≥** `2026-01-01 00:00`.

In an Explorer, each applied rule shows as a chip, with the **AND** or **OR** connector between them. Remove a rule with its cross, or every filter with **Clear all**.

## Fields

| Field                                        | What it reads                                                                                                                                                                                 | Where              |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `args.<name>`                                | An argument of the selected event, mapped or not. Single-value arguments only: an address, an integer, a flag, a text or bytes. A list, a struct, or a hashed indexed argument is not offered | Explorers, monitor |
| `occurredAt`                                 | When the event happened, the block's time                                                                                                                                                     | Explorers          |
| `key`                                        | The mapped key of the event, such as a token id. Events without a mapped key never match                                                                                                      | Explorers          |
| `wallet`                                     | An address in the event's mapped groups: sender, recipient or related party                                                                                                                   | Contracts Explorer |
| `direction`                                  | The user's role in the event: `out`, `in`, or `related`. `related` matches only when the user is in neither `out` nor `in`                                                                    | Users Explorer     |
| `id`                                         | The user's wallet address                                                                                                                                                                     | Users list, Batch  |
| `email`                                      | The user's email                                                                                                                                                                              | Users list, Batch  |
| `createdAt`                                  | When the user was created — two rules on it select the users created inside a period                                                                                                          | Users list, Batch  |
| `contractData.<chainId>.<address>.<dataKey>` | A piece of contract data kept per user, when its value is a single number, address, flag or text; supported amounts accept Smart Units. For data kept per key, any key may match              | Users list, Batch  |

In an Explorer, select an **Event** first to see its arguments; the other fields need no event.

## Operators

| Operator                                     | Applies to                                                           | Keeps what                                          |
| -------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------- |
| **=**                                        | Every field                                                          | Equals the value                                    |
| **≠**                                        | Scalar fields, except mapped history `wallet`, `key` and `direction` | Differs from the value; missing values do not match |
| **contains**, **starts with**, **ends with** | Text and email                                                       | Matches literal text                                |
| **is one of**                                | Text, email, addresses, bytes, keys and integers                     | Equals any of the values you list, one per line     |
| **>**, **≥**, **<**, **≤**                   | Integers and dates                                                   | Compares as a number, or as an instant              |

Available operators depend on the field. Monitor text filters ignore case and cannot contain a backslash or both single and double quotes. For monitors, integer widths are limited to 8, 16, 32, 64, 128 or 256 bits; byte arguments must be `bytes` or `bytes32`.

## Values

| Type         | What to enter                                                                                                                                                                                           |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Amount or id | For an amount with a [unit](/baas-console/contracts/units.md), turn on **Smart Unit** and enter tokens, such as `1.5`. Use raw integer strings for ids, unbound amounts or values already in base units |
| Address      | An EVM address: lowercase, uppercase, or valid EIP-55 mixed case; case does not matter                                                                                                                  |
| Date         | A date and time, picked in your local time zone and sent as UTC. Event times can include milliseconds                                                                                                   |
| Boolean      | `true` or `false`                                                                                                                                                                                       |
| Text         | The text, or leave it empty to match an empty text. With **is one of**, one value per line, an empty line being an empty text. Case counts in histories and user text fields                            |
| Email        | Trimmed and lowercased before comparison. An empty value is refused                                                                                                                                     |

The **Smart Unit** switch appears on an amount the contract has a unit for, which BaaS [sets up on its own](/baas-console/contracts/units/automatic-units.md) for recognized standards like ERC-20. Turn it on to type a decimal amount, converted for you with the contract's decimals; leave it off to type the exact integer that travels on-chain. An amount whose unit depends on a token id, as on an ERC-6909, gets no switch. Switching clears the value.

{% hint style="info" %}
**Note:** Correct any error shown for a rule before applying or saving. A Smart unit amount with too many decimals is refused, never rounded.
{% endhint %}

## Limits

| Item                      | Limit |
| ------------------------- | ----- |
| Characters per text value | 256   |

Groups and **is one of** lists must contain at least one item.

## Through the API and the SDK

Put your filter in `where`. Each rule has a `field`, an `operator` and a `value`. Each group has a `combinator` and a list of `rules`:

* `and`: every rule must match.
* `or`: at least one rule must match.
* To combine both, put a group inside another group's `rules`.

### Find transfers by amount and sender

See the [JSON and helper examples](/baas-sdk/blockchain/events.md#combine-conditions) for transfers of at least **1.5 tokens**, sent by **Alice or Bob**. For one user's received transfers, see [user searches](/baas-sdk/manage-user.md#filter-the-users-history).

### Apply the filter

For HTTP queries, send `where` as URL-encoded JSON. The SDK handles this for you.

| Where           | What to provide                                                                                          |
| --------------- | -------------------------------------------------------------------------------------------------------- |
| Contract events | `GET /contracts/deployments/{chainId}/{address}/events`: pass `event` and `where` as query parameters    |
| User events     | `GET /users/{userId}/contracts/{chainId}/{address}/events`: pass `event` and `where` as query parameters |
| Event totals    | Add `/count` to either events route, with the same `event` and `where` and no `cursor` or `limit`        |
| Users list      | `GET /users`: optional `search` and `where` query parameters, combined with AND                          |
| SDK events      | `events({ event: 'Transfer', where })`; `eventsCount({ event: 'Transfer', where })` for the total        |
| Monitor trigger | Set `where`; on update, `where: null` removes the filter                                                 |
| User batch      | Set `batch.where`; at least one rule is required                                                         |

When filtering `args.<name>`, set `event` to one event name. If several events share that name, use its full signature, such as `Transfer(address,address,uint256)`.

Users and event lists return `data`, `limit` and `nextCursor`, without a total; for events, the `/count` routes return it. Keep the same filters and pass `nextCursor` as `cursor` until it is null; omit `cursor` when changing filters. See [pagination](/baas-sdk/blockchain/events.md#page-through-events).

Omit `where` to read users or events without a filter or create an unfiltered monitor. On a monitor update, omission keeps the existing filter. A supplied batch requires a non-empty filter; omit `batch` on update to keep it, or use `batch: null` to disable it with a compatible action configuration.

Invalid filters are refused with `400`; see [filter errors](/baas-sdk/resources/error-handling.md#event-filter-errors).
