Notion API · api · fg-0455
dataSources.query returns object_not_found when given the database ID copied from the Notion URL
object_not_found from notion.dataSources.query with an ID taken from the page URL
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
Since 2025-09-03 a database is a container that holds one or more data sources, and each data source has its own ID. The URL shows the database ID, while query and page creation now take the data source ID.
Fix
Retrieve the database once with Notion-Version 2025-09-03, read data_sources[].id, and use that ID for queries and page parents. In the app, database settings > Manage data sources > Copy data source ID gives the same value.
Apply
const db = await notion.databases.retrieve({ database_id: DATABASE_ID });
const dataSourceId = db.data_sources[0].id;
const res = await notion.dataSources.query({ data_source_id: dataSourceId });Affects: Notion-Version 2025-09-03 and later; @notionhq/client 5.0.0 and later
Sources
- https://developers.notion.com/docs/upgrade-guide-2025-09-03
- https://github.com/makenotion/notion-sdk-js/issues/612
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp