> For the complete documentation index, see [llms.txt](/llms.txt).

# `eth_newFilter`

Creates a filter object based on the given filter options, to notify when the state changes (logs). To check if the state has changed, call [eth_getFilterChanges](/services/reference/ethereum/json-rpc-methods/filter-methods/eth%5Fgetfilterchanges/). This method uses [80 credits](/services/get-started/pricing/) from your daily balance.

Expires after 15 minutes of inactivity

Filters that are not polled using [eth_getFilterChanges](/services/reference/ethereum/json-rpc-methods/filter-methods/eth%5Fgetfilterchanges/) automatically expires after 15 minutes of inactivity. Filter IDs can be polled by any connection using the same API key.

## Parameters[​](#parameters "Direct link to Parameters")

A `filter object` with the following keys and their values:

- `address`: _[optional]_ A contract address or a list of addresses from which logs should originate.
- `fromBlock`: _[optional, default is `latest`]_ A hexadecimal block number, or one of the string tags `latest`, `earliest`, `pending`, `safe`, or `finalized`. See the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block).
- `toBlock`: _[optional, default is `latest`]_ A hexadecimal block number, or one of the string tags `latest`, `earliest`, `pending`, `safe`, or `finalized`. See the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block).
- `topics`: _[optional]_ An array of 32 bytes DATA topics. Topics are order-dependent.

### Specifying topic filters[​](#specifying-topic-filters "Direct link to Specifying topic filters")

Topics are order-dependent. A transaction with a log with topics `[A, B]` will be matched by the following topic filters:

- `[]`: Anything.
- `[A]`: `A` in the first position, and anything after.
- `[null, B]`: Anything in first position AND `B` in second position, and anything after.
- `[A, B]`: `A` in the first position AND `B` in second position, and anything after.
- `[[A, B], [A, B]]`: `(A OR B)` in first position AND `(A OR B)` in second position, and anything after.

## Returns[​](#returns "Direct link to Returns")

`filter ID`: A hexadecimal denoting the newly created filter ID.

## Example[​](#example "Direct link to Example")

Replace `<YOUR-API-KEY>` with an API key from your [Infura dashboard](https://app.infura.io/).

### Request[​](#request "Direct link to Request")

- curl
- WSS

```
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}'

```

```
wscat -c wss://mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}'

```

### Response[​](#response "Direct link to Response")

- JSON

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x10ff114de54f0bfdbd7855f8a1dd7317e6500495a24f"
}

```
