251
All tools
NotionN

by Notion

Query a data source

Returns the pages in a data source that match a filter, in the requested sort order.

Updated Sep 29, 2026

query-data-source.md

Query a data source

Returns the pages in a data source that match a filter, in the requested sort order.

Note: Over MCP, SQL is unlimited only on Business and Enterprise plans with Notion AI; on other plans, rows mode and single-data-source SQL share a per-workspace allowance.

Set up

Use the first option your agent supports.

MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

{ "mcpServers": { "notion": { "url": "https://mcp.notion.com/mcp" } } }

Call the MCP tool notion-query-data-sources.

Server URL: https://mcp.notion.com/mcp

CLI (official)

Install the command, then confirm it runs.

npm install --global ntn
ntn --version

Run ntn datasources query <data-source-id>.

Set $NOTION_API_TOKEN in your environment first (get a key: https://www.notion.so/developers/tokens).

API (official)

Before anything else, confirm access with the cheapest read-only call, like a list or a search. Never send or change anything to test access.

Rules

  • Ask the user before anything that sends messages, costs money, or changes data, and say how many records it touches. One approval covers a batch the user has seen.
  • Never print API keys.

Ways in

RouteSourceCallRequiredDocs
MCPOfficial · remotenotion-query-data-sourcesOAuthDocs
CLIOfficialntn datasources query <data-source-id>API key in $NOTION_API_TOKENDocs
APIOfficialPOST /v1/data_sources/{data_source_id}/queryAPI key in $NOTION_API_KEYDocs

Workflows using Query a data source