Overview
A Notion database organizes pages. A data source defines the properties those pages share. The API treats the database, its data sources, and their pages as separate objects. This page explains that structure. For steps, see Create a page in a data source, Read page properties, or Update data source properties.Structure
A database contains data sources and views. Itsdata_sources array lists each source’s ID and name. A data source holds the schema and is the parent of its pages. A schema defines property names, types, and settings.
In a table view, a property appears as a column and a page appears as a row. The page’s property values fill the cells. Its content blocks form the body of the page.
These JSON excerpts show the fields that connect the objects. Other response fields are omitted.
Database properties
A property’s schema and its value answer different questions. The schema describes what a property accepts. The value describes what one page contains. A number format such asdollar belongs to the schema; an amount such as 1.49 belongs to the page.
Every data source has exactly one Name property, with API type title. Its display name can change. For example, a grocery list can call it “Grocery item.” Other properties may hold numbers, dates, people, files, or calculated values.
The tabs compare the same property across API objects. Schema and Page value examples each show one entry in a response’s properties object. Page write shows an Update page request body; Create page also needs a parent. Read-only types have no Page write tab.
For title, rich_text, people, and relation, the Property item tab shows one entry in a paginated results array. For other types, it shows the endpoint response. Replace example names and IDs with values from your workspace.
- Schema
- Page value
- Page write
- Property item
Schema
Iterate over a database object
Current API versions return schemas from Retrieve a data source. A database response lists data sources; it does not contain aproperties schema. Code that reads database.properties uses the model from before API version 2025-09-03.
For a current example that reads the schema and checks property types, see Check the schema. For older connections, see Upgrade to 2025-09-03.
Adding pages to a data source
A new page usesparent.data_source_id to identify its data source. Its properties keys refer to names or IDs in that source’s schema. This is why a connection needs the data source ID, even when the user selects a database in Notion.
Create a page in a data source shows a complete request. A page can also use a database template. Pages whose parent is another page have only a Name property.
Finding pages in a data source
Query a data source returns pages from a regular data source. A wiki query can also return child data sources. Withresult_type: "page", a query returns only pages; otherwise, check each result’s object field before reading page fields.
Retrieve a page reads a known page ID directly. Query results are paginated, so one response may contain only part of the matching set.
Filtering data source pages
A filter selects pages by a property’s value. Its condition must match the property’s type. For a Date property named “Last ordered,” this filter matches dates in the past week:Query request body
and or or. A query without a filter returns non-archived pages by default. The filter reference lists the conditions for each property type.
Sorting data source pages
Sorts order matching pages by a property value or a page timestamp. The request field issorts, an array. For example, this request puts the most recently created pages first:
Query request body
created_time timestamp exists even when the schema has no Created time property. The sort reference covers both choices. For a complete query that handles large result sets, see Query large data sources.