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

# Filtering, ordering, pagination

> Learn how to filter results using the APIs

## Querying

Chain after `GET https://api.basic.tech/account/{project_id}/db/{table}` endpoint as query params.

### Filtering (`filter`)

```js theme={null}
const options = {method: 'GET'};

//example to filter where name equals John
fetch('https://api.basic.tech/account/{project_id}/db/{table}?name=eq.John', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

* **Method:** `filter(conditions)`
* **Supported Operators:** eq, neq, gt, gte, lt, lte, like, ilike, in, not (see [list of operators](#supported-operators))

### Ordering (`order`)

```js theme={null}
const options = {method: 'GET'};

//example to filter where created_at is descending, and name is ascending
fetch('https://api.basic.tech/account/{project_id}/db/{table}?order=created_at.desc,name.asc', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

* **Method:** `order(field, direction?)` (`direction` defaults to 'asc')

### Pagination (`limit`, `offset`)

```js theme={null}
const options = {method: 'GET'};

//example to filter where limit is 10, offset is 20
fetch('https://api.basic.tech/account/{project_id}/db/{table}?limit=10&offset=20', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

* **Methods:** `limit(count)`, `offset(count)`

## Supported operators

| Operator | Description                | Example                  |
| -------- | -------------------------- | ------------------------ |
| `eq`     | Equality                   | `status=eq.active`       |
| `neq`    | Not equal                  | `status=neq.deleted`     |
| `gt`     | Greater than               | `priority=gt.3`          |
| `gte`    | Greater than or equal      | `priority=gte.3`         |
| `lt`     | Less than                  | `priority=lt.3`          |
| `lte`    | Less than or equal         | `priority=lte.3`         |
| `like`   | Pattern (case sensitive)   | `title=like.*project*`   |
| `ilike`  | Pattern (case insensitive) | `title=ilike.*todo*`     |
| `in`     | Value in set               | `tags=in.work,important` |
| `not`    | Negation                   | `tags=not.eq.work`       |

## Limitations

* Only one filterable condition per field per query (no compound filters across multiple fields)
* Range filters (e.g., `?field=gte.x&lte.y`) not supported
* Method chaining order is flexible, but all must be chained after `GET https://api.basic.tech/account/{project_id}/db/{table}`
