# Querying rows

Source: https://cubibase.com/docs/data-api/querying

Also available: [Markdown version](https://cubibase.com/docs/data-api/querying.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt)

Filter with column=op.value, pick columns with select, sort with order, and page with limit and offset. All of it in the query string.

## Filters

Any query parameter that is not reserved (`select`, `order`, `limit`, `offset`) is a filter: `column=op.value`. Multiple filters combine with AND.

**Operators**

| Operator | Meaning | Example |
| --- | --- | --- |
| `eq` | Equals | `plan=eq.pro` |
| `neq` | Not equals | `plan=neq.free` |
| `gt` / `gte` | Greater than (or equal) | `age=gte.18` |
| `lt` / `lte` | Less than (or equal) | `price=lt.100` |
| `like` | Pattern match (case-sensitive) | `name=like.M%25` |
| `ilike` | Pattern match (case-insensitive) | `name=ilike.m%25` |
| `is` | `null`, `true`, or `false` | `archived_at=is.null` |

**Pro customers whose name starts with M**

```http
GET https://example-project.api.cubibase.com/rest/v1/customers?plan=eq.pro&name=ilike.m%25
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
```

> **tip**: URL-encode the `%` wildcard as `%25` in like/ilike patterns. Values are always bound as parameters — never concatenated into SQL.

## Choosing columns

`select` takes a comma-separated list of 1 to 64 columns. Without it, every column is returned.

**Only names and emails**

```http
GET https://example-project.api.cubibase.com/rest/v1/customers?select=name,email
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
```

## Sorting

`order` takes `column.asc` or `column.desc`, up to three columns separated by commas.

**Newest plans first, then name**

```http
GET https://example-project.api.cubibase.com/rest/v1/customers?order=plan.desc,name.asc
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
```

## Pagination

| Parameter | Default | Maximum | Notes |
| --- | --- | --- | --- |
| `limit` | `20` | `1000` | Rows per page |
| `offset` | `0` | `100000` | Rows to skip |

**Page 3, 25 rows per page**

```http
GET https://example-project.api.cubibase.com/rest/v1/customers?order=name.asc&limit=25&offset=50
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
```

> **note**: Always pair pagination with a stable `order`. Without it, PostgreSQL does not guarantee row order between pages.

## Reading one row

`GET /rest/v1/{table}/{id}` reads a single row by primary key. A missing row — or one the user’s policy hides — returns `404 not_found`.

**One customer**

```http
GET https://example-project.api.cubibase.com/rest/v1/customers/8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
```

## Additional resources

- [Writing rows](https://cubibase.com/docs/data-api/writing) The other half of the API.
- [Row-level security](https://cubibase.com/docs/database/row-level-security) Why a query may return fewer rows than exist.
