Actions6
Overview
This node provides an interface to query a Notion database using the Notion API. It allows users to specify a database by its ID or URL and apply filter criteria to retrieve matching entries. This is useful for workflows that need to fetch specific records from a Notion database based on dynamic conditions, such as filtering tasks by status or priority.
Common scenarios include:
- Retrieving all tasks marked as "Done" with high priority.
- Fetching recent project entries filtered by custom properties.
- Integrating Notion database queries into automation pipelines for reporting or data synchronization.
Example: Query a project management database to get up to 50 entries where the status is "In Progress" and priority is "High".
Properties
| Name | Meaning |
|---|---|
| Database ID | The ID or URL of the Notion database to query. |
| Query Filter | Filter criteria expressed either in natural language (e.g., "status is Done and priority is High") or as a JSON filter object. |
| Additional Options | Collection of optional parameters: • Icon: Emoji icon for the page (e.g., 📝, 🎯, 📊) • Cover Image URL: URL of cover image for the page • Max Results: Maximum number of results to return (1-100), default is 20 |
Output
The output JSON array contains objects representing the query result with the following fields:
databaseId: The resolved ID of the queried database.totalResults: Number of entries returned by the query.entries: Array of database entry objects matching the filter criteria. Each entry corresponds to a Notion page within the database and includes its properties and metadata.message: A human-readable summary string indicating how many entries were found.
No binary data is output by this operation.
Dependencies
- Requires valid Notion API credentials configured in n8n to authenticate requests.
- Uses the Notion API endpoint
/databases/{database_id}/queryto perform the database query. - No additional external services are required beyond the Notion API.
Troubleshooting
- Invalid Credentials Error: If the node throws an error about invalid Notion API credentials, verify that the API key/token is correctly set up and has sufficient permissions to access the target database.
- Malformed Query Filter: If the
Query Filterproperty contains invalid JSON, the node attempts to interpret it as a simple title filter. To avoid errors, ensure JSON filters are properly formatted. - Max Results Limit: The maximum number of results returned is capped at 100 by the Notion API. Setting
Max Resultsabove 100 will be automatically limited. - Empty Results: If no entries match the filter, the
entriesarray will be empty. Double-check the filter criteria syntax and database content. - Unknown Operation: If the operation parameter is incorrect or missing, the node will throw an "Unknown operation" error.
Links and References
- Notion API Documentation - Query a Database
- Notion Advanced Node GitHub Repository (general documentation for the node bundle)