Skip to content

Query rows

POST
/api/v1/databases/{databaseId}/query
curl --request POST \
--url https://app.lyra-docs.com/api/v1/databases/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "filter": { "op": "and", "items": [ { "propertyId": "Status", "operator": "equals", "value": "In progress" }, { "propertyId": "Due", "operator": "lte", "value": "2026-12-31" } ] }, "sorts": [ { "propertyId": "Due", "direction": "asc" } ], "limit": 25 }'

Reads rows a page at a time, optionally through a view, with a filter, sorts and text search. Filters and sorts name properties by name or id, and select options by label. With a viewId, the view’s own filter and sorts apply too.

databaseId
required
string format: uuid

The database’s id, the same as its page id

Idempotency-Key
string
<= 200 characters

Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.

Media typeapplication/json
object
viewId
string format: uuid
filter

Conditions joined by and or or. Groups can hold other groups.

object
op
required
string
Allowed values: and or
items
required
Array
<= 50 items
Any of:

One condition on a property.

object
propertyId
required

The property’s name or id

string
<= 200 characters
operator
required
string
Allowed values: equals not_equals contains not_contains starts_with ends_with is_empty is_not_empty gt gte lt lte any_of none_of all_of within
value

For select, status and multi_select, option labels

Any of:
string
<= 2000 characters
sorts
Array<object>
<= 8 items
object
propertyId
required

The property’s name or id

string
<= 200 characters
direction
required
string
Allowed values: asc desc
search

Only rows whose text contains these words

string
<= 200 characters
cursor

The nextCursor of the previous page. Leave it out for the first page.

string
<= 4000 characters
limit
integer
default: 25 >= 1 <= 100

Example

{
"filter": {
"op": "and",
"items": [
{
"propertyId": "Status",
"operator": "equals",
"value": "In progress"
},
{
"propertyId": "Due",
"operator": "lte",
"value": "2026-12-31"
}
]
},
"sorts": [
{
"propertyId": "Due",
"direction": "asc"
}
],
"limit": 25
}

OK

Media typeapplication/json
object
rows
required
Array<object>

A database row, with its values keyed by property name.

object
id
required
string format: uuid
values
required

Values keyed by property name. select and status: the option label. multi_select: a list of labels. person: a list of names when read; emails or user ids when written. relation: a list of {id, title} when read; row ids when written. date: a time such as “2026-12-08T00:00:00.000Z”, or {“start”,“end”} for a range. checkbox: true or false.

object
key
additional properties
nextCursor
required

Pass it as cursor to get the next page, or null at the end

string | null

Example

{
"rows": [
{
"id": "0193a7c5-3333-7aaa-8bbb-000000000004",
"values": {
"Name": "Write the launch post",
"Status": "In progress",
"Due": "2026-12-10T00:00:00.000Z",
"Owner": [
"Sam Lee"
]
}
}
]
}
X-RateLimit-Limit
integer

How many requests the token can send in a minute

X-RateLimit-Remaining
integer

How many it has left this minute

X-RateLimit-Reset
integer

Seconds until the count starts again

X-Request-Id
string

The id of this request. Send it to support if something goes wrong.

The request does not match the schema: a missing field, a wrong type or a value out of range.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "invalid_request",
"message": "The request is not valid.",
"issues": [
{
"instancePath": "/title",
"message": "Too big: expected string to have <=500 characters"
}
]
}
}

The token is missing, wrong, revoked or expired.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "unauthorized",
"message": "Please sign in."
}
}

The token’s person can see this, but can’t do this to it.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "forbidden",
"message": "You don't have access to do that."
}
}

It doesn’t exist, or the token’s person can’t see it. The code names what, such as page_not_found.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "page_not_found",
"message": "This page doesn't exist or you don't have access to it."
}
}

A request with the same Idempotency-Key is still running.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "request_in_progress",
"message": "A request with this key is still running."
}
}

The request is well formed but Lyra can’t do it, such as a block id that isn’t on the page (block_not_found), or an Idempotency-Key used before with a different body (idempotency_key_reused).

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "block_not_found",
"message": "Block 'a9f0' is not on this page"
}
}

Too many requests. Each token can send 120 requests a minute. Wait for the seconds in Retry-After.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "rate_limited",
"message": "Too many requests. Try again in 21 seconds."
}
}
Retry-After
integer

Seconds to wait before sending again