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

# Fetch Rows

> Query rows from a custom table with filters, sorting and pagination

Returns a paginated page of rows from a custom table.

> [!WARNING]
>
> Row endpoints capture the caller's identity but **enforce no authorization** — any caller who can reach your project can read these rows. See [Security: open row CRUD](https://docs.sublay.io/v7/custom-tables.md#security-open-row-crud).

> [!NOTE]
>
> `tableName` is the **logical** name. The server applies the `custom_` prefix itself, so pass `orders`, not `custom_orders`. Only custom tables are reachable here — a built-in or bundle table returns `database/table-not-found`, so the existence of built-in tables is never revealed through this surface.

## Path Parameters

**tableName** `string` *required*

Logical name of the custom table. Must match `^[a-zA-Z_][a-zA-Z0-9_]{0,62}$`.

## Query Parameters

**page** `number`

1-indexed page number. Defaults to `1`.

**limit** `number`

Rows per page. Defaults to `50`. Maximum `200`.

**sortBy** `string`

Column to sort by. Must be a real column on the table, or the request fails with `database/invalid-sort-column`.

**sortDir** `string`

`asc` or `desc`.

**includeDeleted** `string`

`"true"` to include soft-deleted rows on a paranoid table. Defaults to `"false"`.

**filters** `string`

A **JSON-encoded array** of filter clauses, URL-encoded. Maximum 50 clauses, all AND-combined.

Each clause is `{ "column": string, "operator": string, "value": unknown }`.

**Operators and their value shapes**

**eq, ne, gt, gte, lt, lte, contains, like** `string | number | boolean`

A single non-null primitive.

**in** `array`

A non-empty array of primitives.

**isNull** `boolean`

`true` matches `IS NULL`, `false` matches `IS NOT NULL`.

The value, before encoding:

```json theme={null}
[{ "column": "status", "operator": "eq", "value": "open" }]
```

And the same request ready to run — the JSON must be percent-encoded, so let your HTTP client do it rather than pasting raw braces into a URL:

```bash theme={null}
curl -G "https://api.sublay.io/v7/$PROJECT_ID/db/orders" \
  --data-urlencode 'filters=[{"column":"status","operator":"eq","value":"open"}]'
```

A column that does not exist on the table fails with `database/invalid-filter-column`.

## Response

**data** `object[]`

The page of rows. Each row is a free-form column map, including the managed columns (`id`, and `createdAt` / `updatedAt` / `deletedAt` where the table has them).

**pagination** `object`

**pagination fields**

**page** `number`

Current 1-indexed page.

**pageSize** `number`

Rows per page, as requested.

**totalPages** `number`

Total pages available.

**totalItems** `number`

Total matching rows.

**hasMore** `boolean`

Whether more pages follow.

## Error Responses

> [accordion] Invalid Parameters — 400
>
> ```json theme={null}
> { "error": "Bad Request", "code": "database/invalid-params" }
> ```

> [accordion] Invalid Query — 400
>
> Malformed `filters` JSON, an unknown operator, a value of the wrong shape for its operator, or an out-of-range `page` / `limit`.
>
> ```json theme={null}
> { "error": "Bad Request", "code": "database/invalid-query" }
> ```

> [accordion] Invalid Filter Column — 400
>
> ```json theme={null}
> {
>   "error": "Bad Request",
>   "code": "database/invalid-filter-column",
>   "column": "<column name>"
> }
> ```

> [accordion] Invalid Sort Column — 400
>
> ```json theme={null}
> { "error": "Bad Request", "code": "database/invalid-sort-column" }
> ```

> [accordion] Table Not Found — 404
>
> Also returned for a built-in or bundle table, which this surface never exposes.
>
> ```json theme={null}
> { "error": "Not Found", "code": "database/table-not-found" }
> ```

> [accordion] Server Error — 500
>
> ```json theme={null}
> { "error": "Internal Server Error", "code": "database/server-error" }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.