Skip to content

Notion - Query Database

↩ Part of the Notion integration.

This module queries a Notion database with POST /databases/{id}/query. It accepts a filter and a sort array in Notion’s own format and returns the matching pages.

Unlike the other Notion nodes, the output data is the array of pages (results), so the next node in the workflow can iterate over it directly.

FieldTypeRequiredDescription
credentials_idcredentialsYesNotion credential
database_idtextYesDatabase id
filterjsonNoFilter in Notion format
sortsjsonNoSort array in Notion format
page_sizenumberNoMaximum results (1-100)

This module requires a Notion credential.

FieldDescription
tokenInternal Integration Secret from notion.so/my-integrations
notion_versionOptional. Value for the Notion-Version header (default 2022-06-28)
{
"nextModule": null,
"data": [
{
"object": "page",
"id": "8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e",
"url": "https://www.notion.so/8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e",
"properties": {
"Name": { "type": "title", "title": [ { "plain_text": "Acme Ltd" } ] },
"Status": { "type": "select", "select": { "name": "New" } }
}
}
],
"_meta": {
"moduleVersion": "1.0.0",
"success": true,
"count": 1,
"has_more": false,
"next_cursor": null,
"totalMs": 221
}
}
{
"credentials_id": 12,
"database_id": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"filter": {
"property": "Status",
"select": { "equals": "New" }
},
"sorts": [
{ "property": "Created", "direction": "descending" }
],
"page_size": 50
}
{
"credentials_id": 12,
"database_id": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"filter": {
"and": [
{ "property": "Status", "select": { "equals": "New" } },
{ "property": "Amount", "number": { "greater_than": 1000 } }
]
}
}
{
"credentials_id": 12,
"database_id": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"filter": {
"property": "Email",
"email": { "equals": "{{data.email}}" }
},
"page_size": 1
}
  • Without a filter the node returns the whole database, page by page, capped by page_size.
  • Notion caps page_size at 100. When there are more rows, _meta.has_more is true and _meta.next_cursor holds the cursor for the following batch.
  • The filter shape depends on the column type: select, multi_select, rich_text, number, date, checkbox, and so on. A filter aimed at the wrong type returns 400.
  • If filter or sorts is not valid JSON, the value is silently ignored and the query runs without it — check the trace if you get more rows than you expected.
  • The database must be shared with the integration (··· → Add connections), otherwise the call returns 404.