Notion Database Query

Notion Database Query

Query entries from a Notion database with optional filtering and sorting

Node Type

Action

Category

Notion

Icon

Database

Overview

The Notion Database Query node is an action node that retrieves entries from a Notion database with powerful filtering and sorting capabilities. This integration enables you to programmatically access and process data from your Notion databases, perfect for data analysis, content management, and workflow-based database operations.

Key Features

  • Database Selection: Choose from your Notion databases with an integrated picker
  • Advanced Filtering: Apply complex filters using Notion's query syntax
  • Flexible Sorting: Sort results by any database property
  • Pagination Support: Handle large datasets with built-in pagination
  • Rich Data Access: Retrieve all database properties and metadata
  • OAuth Security: Secure authentication through Notion OAuth

Prerequisites

Notion Account Connection

Must have a connected Notion account with appropriate permissions

Notion account connected via OAuth
Notion read scope permissions
Access to the target Notion workspace

Database Requirements

Understanding of Notion database structure and query capabilities

The target database must be accessible through your Notion workspace
Database must be a valid Notion database (not a page)
Clear understanding of database properties and structure

Technical Requirements

Technical setup and configuration requirements

Notion OAuth service properly configured
Internet connectivity for Notion API communication
Proper exception handling for API failures and authentication issues

Node Configuration

Required Fields

Database

Type:dynamic_select
Required:Yes
Value Type:string

The Notion database to query. You can select databases from your Notion workspace using the integrated database picker.

Optional Fields

Filter

Type:text_area
Required:No
Value Type:JSON

JSON filter object to apply to the query. Use Notion's query syntax to filter results by property values, dates, text content, and more.

Sorts

Type:text_area
Required:No
Value Type:JSON

JSON array of sort objects to order the results. Each sort object should specify the property to sort by and the direction (ascending or descending).

Page Size

Type:number
Required:No
Value Type:number

Maximum number of results to return (1-100). Defaults to 100 if not specified.

Examples & Use Cases

Content Management Workflow

Automatically process and organize content from Notion databases

Workflow Structure

📊 Notion Query → 🤖 AI Analysis → 📝 Content Processing → 📧 Distribution

Query content from Notion databases, analyze with AI for insights, process and format content, then distribute via email or other channels.

Data Synchronization

Sync Notion database data with other platforms

Workflow Structure

📊 Notion Query → 🔄 Data Transform → 📈 Google Sheets Write → ✅ Confirm

Query data from Notion databases, transform the data format, then write to Google Sheets or other platforms for analysis and reporting.

Filter Examples

Common filtering patterns for Notion database queries

Filter by Status

{
  "property": "Status",
  "select": {
    "equals": "Published"
  }
}

Filter by Date Range

{
  "property": "Created",
  "date": {
    "after": "2024-01-01"
  }
}

Complex Filter

{
  "and": [
    {
      "property": "Status",
      "select": {
        "equals": "Draft"
      }
    },
    {
      "property": "Priority",
      "select": {
        "equals": "High"
      }
    }
  ]
}

Best Practices

Do's

  • Use the database picker for easy database selection
  • Test filter syntax in Notion's interface before using in workflows
  • Handle pagination properly for large datasets
  • Validate database permissions before querying
  • Use appropriate page sizes to balance performance and data needs
  • Store database IDs for repeated access to avoid re-selection

Don'ts

  • Don't assume all database properties are available
  • Avoid querying very large databases without pagination
  • Don't forget to handle authentication errors
  • Avoid hardcoding database IDs when possible
  • Don't process sensitive data without proper security measures
  • Avoid exceeding Notion API rate limits
💡
Pro Tip: Notion's query syntax is powerful but can be complex. Start with simple filters and gradually add complexity. Use Notion's interface to test your filter syntax before implementing in workflows. For large datasets, always implement pagination using the Next Cursor output.

Troubleshooting

Common Issues

Database Not Found

Symptoms: Node fails with database not found error

Solution: Verify the database ID is correct and the database exists in your Notion workspace. Check that the user has access to the database and it hasn't been deleted or moved.

Permission Errors

Symptoms: Node fails with insufficient permissions

Solution: Ensure the Notion account connection has read scope permissions. Reconnect the Notion account if needed and verify OAuth permissions in your workspace settings.

Invalid Filter Syntax

Symptoms: Node fails with invalid filter error

Solution: Check your filter JSON syntax. Ensure property names match exactly and use the correct filter operators. Test your filter in Notion's interface first.

Empty Results

Symptoms: Query returns no results when data exists

Solution: Check your filter criteria - they might be too restrictive. Verify that the database contains data matching your filter conditions. Try querying without filters first.

Rate Limit Exceeded

Symptoms: Node fails with rate limit error

Solution: Notion has API rate limits. Implement delays between requests or reduce the frequency of queries. Consider caching results for repeated access.

Related Resources