Notion API · api · fg-0455

dataSources.query returns object_not_found when given the database ID copied from the Notion URL

If you see object_not_found from notion.dataSources.query with an ID taken from the page URL, the cause and the fix for Notion API are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
object_not_found from notion.dataSources.query with an ID taken from the page URLdatabases.query flagged as deprecated after upgrading @notionhq/client to v5Query that worked on 2022-06-28 fails after moving to Notion-Version 2025-09-03
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 });
Affected
Notion-Version 2025-09-03 and later; @notionhq/client 5.0.0 and later
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun