A data source is a table of pages under a Notion database. For background on how databases and data sources fit together, see Working with databases. All examples below assume you’ve already authenticated withDocumentation Index
Fetch the complete documentation index at: https://developers.notion.com/llms.txt
Use this file to discover all available pages before exploring further.
ntn login.
To work with data sources, you use a combo of ntn datasources and ntn api commands.
Find a data source ID
Data sources live under a database. Retrieve the parent database to list its data sources. See Working with databases for how to find a database ID from a Notion URL:data_sources array contains an id. To get the ID from the Notion app: open the database’s settings menu, choose Manage data sources, click the data source’s ••• menu, and click Copy data source ID.
Retrieve a data source
Fetch the schema (properties, title, parent) for a single data source. See Retrieve a data source for the response shape:Create a data source
Add a new data source to an existing database.parent[type]=database_id is the type discriminator; parent[database_id] is the database’s unique ID. properties is a map of column name to property schema. See Create a data source for every supported field:
Query a data source
Usentn datasources query to list pages in a data source:
--filter with the same shape documented in Filter data source entries:
--start-cursor using the next_cursor from the previous response. Add --json for machine-readable output.
For sorts, filter_properties, or other options, drop down to ntn api. See Query a data source for the full request and response:
filter_properties query param (it accepts property IDs or names):
start_cursor from the previous response’s next_cursor until has_more is false. Query results cap at 10,000 pages. For larger data sources, narrow with filters or subscribe to webhooks.
Update a data source
PATCH updates the title, description, parent, or schema. To add a column, pass it under properties keyed by name:
name or null: