Notion - Query Database
↩ Part of the Notion integration.
Description
Section titled “Description”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.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
credentials_id | credentials | Yes | Notion credential |
database_id | text | Yes | Database id |
filter | json | No | Filter in Notion format |
sorts | json | No | Sort array in Notion format |
page_size | number | No | Maximum results (1-100) |
Credentials
Section titled “Credentials”This module requires a Notion credential.
| Field | Description |
|---|---|
token | Internal Integration Secret from notion.so/my-integrations |
notion_version | Optional. Value for the Notion-Version header (default 2022-06-28) |
Output
Section titled “Output”{ "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 }}Usage Example
Section titled “Usage Example”Open leads, newest first
Section titled “Open leads, newest first”{ "credentials_id": 12, "database_id": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d", "filter": { "property": "Status", "select": { "equals": "New" } }, "sorts": [ { "property": "Created", "direction": "descending" } ], "page_size": 50}Two conditions at once
Section titled “Two conditions at once”{ "credentials_id": 12, "database_id": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d", "filter": { "and": [ { "property": "Status", "select": { "equals": "New" } }, { "property": "Amount", "number": { "greater_than": 1000 } } ] }}Find a page by email before creating it
Section titled “Find a page by email before creating it”{ "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_sizeat 100. When there are more rows,_meta.has_moreistrueand_meta.next_cursorholds 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
filterorsortsis 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.
Related Nodes
Section titled “Related Nodes”- Notion - Get Page — read a single page when you already have the id.
- Notion - Create Page — create the row when the query comes back empty.
- Notion - Update Page — update each row returned by the query.