Documentation Index
Fetch the complete documentation index at: https://docs.moralis.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Filters let you control exactly which events trigger webhooks. Events that don’t match your filters are ignored and don’t consume usage. Each chain exposes its own filtering primitives, because each chain models on-chain activity differently.Filtering by Chain
- EVM
- Bitcoin
- Solana
EVM streams support the most filtering options:
- Addresses — match transactions where
fromortois a watched address - Contract events (ABI +
topic0) — match specific decoded events emitted by smart contracts - Advanced JSON filter expressions — value comparisons, AND/OR logic, special stream variables (see below)
filterPossibleSpamAddresses— exclude events involving contracts flagged as spam
Advanced JSON Filter Expressions (EVM)
The JSON filter expression system below is an EVM-only feature. It applies to decoded event data and requires a valid ABI for the event being filtered. Bitcoin and Solana streams use the chain-specific primitives above.
How filters work
Filters are defined as a JSON expression using logical operators and comparison rules.- Filters apply to decoded event data
- Filters require a valid ABI for the event being filtered
- All conditions must resolve to
truefor the event to trigger a webhook
Supported Operators
Logical operators
| Operator | Description | Notes | Example |
|---|---|---|---|
and | All nested conditions must match | Need at least 2 filters | { "or" : [ {..filter1}, {...filter2} ]} |
or | At least one nested condition must match | Need at least 2 filters | { "and" : [ {..filter1}, {...filter2} ]} |
Comparison operators
| Operator | Description | Notes | Example |
|---|---|---|---|
eq | Equal to | { "eq": ["value", "1000"] } | |
ne | Not equal to | { "ne": ["address", "0x...325"] } | |
lt | Less than | Numeric values only | { "lt": ["amount", "50"] } |
gt | Greater than | Numeric values only | { "gt": ["price", "500000"] } |
lte | Less than or equal | Numeric values only | { "lte": ["amount", "100"] } |
gte | Greater than or equal | Numeric values only | { "gte": ["amount", "100"] } |
in | Value exists in array | Array required | { "in": ["name": ["alice", "bob"]]} |
nin | Value not in array | Array required | { "nin": ["name": ["bob", "alice"]]} |
Special Stream Variables (EVM)
Moralis provides special variables that can be used in filters to access stream-level metadata. These are EVM-specific.| Variable | Description |
|---|---|
moralis_streams_contract_address | Contract emitting the event (lowercase) |
moralis_streams_chain_id | Chain ID for the event |
moralis_streams_possibleSpam | Indicates if the event is flagged as spam |
Example: filter by contract address
Note: contract addresses must be lowercase. EVM addresses are case-insensitive, so always
toLowerCase() for comparison.Filtering Possible Spam Events (EVM)
Some EVM contract addresses are associated with spam, phishing attempts, or other suspicious activity. Moralis identifies these and flags them withpossibleSpam = true.
You can exclude these events entirely by enabling:
- Events involving contracts flagged as possible spam are excluded
- No webhook is sent
- No usage is consumed
filterPossibleSpamAddresses is set to false. Spam detection is currently EVM-only — see Spam Detection.
Example: Different Rules per Contract (EVM)
You can apply different thresholds depending on which contract emitted the event.Example: Filtering by Value Range (EVM)
Filter transfers where the amount is between two values:Example assumes a token with 6 decimals (e.g. USDC).
Example: Mint and Burn Detection (EVM)
A zero address indicates:- Mint when used as
from - Burn when used as
to
Important Notes (EVM JSON filters)
- Filters require a valid ABI for the event being filtered
- Filters are evaluated before webhook delivery
- Invalid filters will prevent the stream from working
- Filters use AND / OR logic only (no implicit precedence)
When to Use Filters
Use filters to:- Reduce webhook volume
- Exclude spam or low-value events (EVM)
- Trigger alerts only for meaningful activity
- Apply different logic per contract or chain

