# Query filters

Bunny's GraphQL API follows standard practices and allows you to use `first`, `limit`, cursors etc. But filters make it possible to get very specific in a simple way.

The admin UI's table filters give a good idea of what's possible as they are using the GraphQL filters. You can search for ranges, relative dates and much more. For example:

```graphql
{
  invoices(filter: "createdAt is after 2024-07-14") {
    nodes {
      number
    }
  }
}
```

You can also combine conditions.

```graphql
{
  accounts(filter: "createdAt is after 2024-01-14 and billingState = 'CA'") {
    nodes {
      name
    }
  }
}
```

The operators vary by data type.

<table><thead><tr><th width="156">Field type</th><th width="595">Operators</th></tr></thead><tbody><tr><td>Boolean</td><td>is, is_not</td></tr><tr><td>Integer</td><td>&#x3C;. >, =, &#x3C;=, =>, !=, in [ ], not in [ ]</td></tr><tr><td>String</td><td>begins_with, ends_with, contains, contains_not, equals, not_equals, !=, =, in [ ], not in [ ]</td></tr></tbody></table>

You can also test for null values using `is blank`and `is not blank`.

### Dates

Dates have the most complex syntax and are best explained in the simplified grammar below.

```
date_condition  : field (is|is_not) specific_date
                | field (is|is not) relative date

specific_date   : yesterday | today | tomorrow
                | ((before | on | after | on or after | on or before ) date) 
                | in 
                | ago

in              : in int period

ago             : int period ago

relative_date   : which period[s]

which           : current
                | (past | next) [int] 

period          : day[s] | week[s] | month[s] | quarter[s] | year[s]

date            : “yyyy-mm-dd” | "yyyy-mm-ddThh:mm:ss"
```

The date syntax is very powerful and allows you to easily express relative times, such as:

* in three weeks
* last month
* is current week
* on or after '2024-10-10'
* next quarter

### Grouping

The filter syntax also allows you do group expressions using parenthesis and combine them with `and` and `or`, for example:

```graphql
{
  accounts(filter: "revenue > 100 and (billing_state = 'CA' or billing_state = 'WA') {
    nodes {
      id
    }
  }
}
```
