# 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
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bunny.com/developer/using-the-graphql-api/using-filters-in-queries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
