> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hooksnode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filters

> Send a destination only the events that match.

A filter is a JSON object. Each key is a path in the event body. Each value is what the path must hold. An event goes to the destination only if **all** keys match.

```json theme={null}
{ "type": "bank.credit.received" }
```

## Rules

| Rule                 | Example                                               | Matches                                                                                                |
| -------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Equals               | `{"event": "charge.success"}`                         | `event` is `charge.success`.                                                                           |
| Nested path          | `{"data.status": "success"}`                          | `data.status` is `success`.                                                                            |
| `$.` prefix          | `{"$.data.status": "success"}`                        | Same as above.                                                                                         |
| Any of               | `{"event": ["charge.success", "transfer.success"]}`   | `event` is one of the values.                                                                          |
| Numbers and booleans | `{"data.amount": 5000}`                               | Compared as text. Write numbers as numbers, not as `"5000"`, because large numbers print as `4.5e+06`. |
| All keys             | `{"event": "charge.success", "data.currency": "NGN"}` | Both match.                                                                                            |

A path goes through objects only. It cannot pick an array element. A missing path does not match.

There are no other operators, such as "greater than" or "contains".

## Filters run after the transform

hooksnode runs the transform first, then the filter. Write the filter for the body **after** the transform.

## What you see

* A filtered event shows as `delivered` for that destination, with status code `0` and the response `{"filtered":true}`.
* If the filter is not valid JSON, or the body is not a JSON object, hooksnode delivers the event and records a warning.

<Tip>Use the **Test** panel in the destination editor to check a filter against a sample body before you save.</Tip>

## Examples

<AccordionGroup>
  <Accordion title="Paystack: successful charges only">
    ```json theme={null}
    { "event": "charge.success" }
    ```
  </Accordion>

  <Accordion title="Bank credits in naira">
    ```json theme={null}
    { "type": "bank.credit.received", "transaction.currency": "NGN" }
    ```
  </Accordion>

  <Accordion title="Emails from one sender">
    ```json theme={null}
    { "type": "email.received", "message.from.email": "orders@supplier.com" }
    ```
  </Accordion>

  <Accordion title="New items from a watched URL">
    ```json theme={null}
    { "type": "http_poll.item.added" }
    ```
  </Accordion>
</AccordionGroup>
