V2
Query Database
Query database page records with filters, sorts, and pagination.
Query Database
Use Case
Use this endpoint to list database records as pages, optionally filtered, sorted, and paginated.
Endpoint
| Item | Value |
|---|---|
| Method | POST |
| Path | /v2/databases/:database_id/query |
| Request body | JSON |
| Returns | list of page objects |
| Scope | databases.read |
Permissions
Requires databases.read and access to the database.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
database_id |
string | Yes | Database ID. |
filter |
object | No | Database filter object. |
sorts |
array | No | Sort definitions. |
start_cursor |
string | No | Pagination cursor. |
page_size |
number | No | Defaults to 20; maximum is 100. |
Request Example
{
"filter": {
"property": "Status",
"select": {
"equals": "Doing"
}
},
"sorts": [
{
"property": "Name",
"direction": "ascending"
}
],
"start_cursor": null,
"page_size": 20
}
Response Example
{
"object": "list",
"results": [
{
"object": "page",
"id": "11111111-1111-4111-8111-111111111111",
"page_type": "page",
"created_time": "2026-04-09T08:00:00.000Z",
"last_edited_time": "2026-04-09T09:30:00.000Z",
"created_by": {
"object": "user",
"id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb"
},
"last_edited_by": {
"object": "user",
"id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb"
},
"parent": {
"type": "page_id",
"page_id": "55555555-5555-4555-8555-555555555555"
},
"in_trash": false,
"icon": null,
"cover": null,
"properties": {
"title": {
"id": "title",
"type": "title",
"title": [
{
"type": "text",
"text": {
"content": "Release Checklist",
"link": null
},
"plain_text": "Release Checklist",
"href": null
}
]
}
},
"url": "https://buildin.ai/docs/11111111-1111-4111-8111-111111111111"
}
],
"next_cursor": null,
"has_more": false
}
Behavior
- Results are
pageobjects because database records are pages. - Filters and sorts must match the database property schema.
- Unsupported filters or sorts return explicit errors.
- Use
next_cursorandhas_morefor pagination.
Errors
400 validation_error: invalid filter, sort, or pagination shape.400 unsupported_filter: unsupported filter type.400 unsupported_sort: unsupported sort type.401 unauthorized: invalid or expired token.403 forbidden: missingdatabases.reador no access.404 not_found: database does not exist.