pages API lets a block write to Notion. It works with or without React.
Create a page
Choosing a parent
pages.create() accepts these parent inputs. These inputs are separate from the NotionParent values returned in app context and page responses.
Prefer
data_source_key when the block uses one of its declared data sources. This keeps the block independent of the user’s data source ID.
The returned result.page.parent uses the same parent shapes as app context. See App context for the complete list of parent values.
Position
position controls where the new page is inserted:
startandendinsert the page directly under the page surface.beforeandafterinsert the page beside the anchor block.- The anchor can be nested inside a toggle, column, or another block.
- If the anchor is inside a toggle or column, the new page is also inserted inside that block.
- The
page_idmust identify a regular page or a wiki root.
icon and cover cannot be set at creation time. Create the page, then set
them with pages.update().Read a page
pages.get() returns page metadata and properties. It does not return block or Markdown content.
pages.get() and pages.update() accept a regular page ID or a wiki root ID.
On success, result.page is a NotionPage: its id, parent, properties, and — when available — created_time, last_edited_time, icon, cover, url, public_url, and in_trash.
Read archive status
Archiving keeps content you no longer actively use without deleting it. Learn about Archive. Readis_archived on a page or data source row. It is true when the page or an ancestor is archived.
Read Trash status
Pages in Trash are scheduled for permanent deletion. By default, Notion permanently deletes them 30 days after they enter Trash, unless you restore them first. Enterprise workspaces can configure a different retention period. Learn about Trash retention. Readin_trash on a page or data source row. It is true when the page or an ancestor is in Trash.
Update a page
Unlikepages.create, properties here is keyed by raw property ID only — declared keys are not resolved for you. Map them yourself with propertyIdsByKey from useDataSource:
For a row in one of your block’s bound data sources, prefer that row’s own
update method from useDataSource. It takes your declared keys and resolves them against the binding, so you avoid the ID mapping entirely.
Archive and unarchive a page
Usepages.archive(pageId) to archive a page. Use pages.unarchive(pageId) to remove its archive state.
pages.archive is shorthand for calling pages.update with is_archived: true.
pages.unarchive is shorthand for calling pages.update with is_archived: false.
Both methods return an UpdatePageResult.
Trashing and untrashing pages
This is not currently supported by the custom blocks SDK.Property support
This table shows property support for custom blocks running in Notion.- Read value shows
page.propertiesin responses frompages.get,pages.create, andpages.update. The table identifies top-level fields separately. Unavailable values are absent frompage.properties. - Create covers property writes through
pages.create. - Update covers property writes through
pages.update.
title. Other property writes require a data source row and a property in its schema.
- 🟢 Supported: The SDK supports this operation in Notion.
- 🟡 Limited: The SDK supports this operation with the restrictions shown in the cell.
- 🔴 Unavailable: The SDK does not expose this operation.
- ⚫ Not supported in Notion: Notion itself does not support this operation in the stated case.
Notes
- Select, multi-select, and status reads return option names and colors. They also return IDs when the options match the schema. Writes accept an existing option ID or a name and set the selected value. They do not edit option definitions. If you supply both an ID and a name, the host uses the ID. The host rejects unknown IDs.
- Date-time writes preserve hours and minutes but discard seconds and milliseconds.
- Title and rich text use text arrays, but reads and writes preserve only plain text. Reads and writes do not preserve formatting, links, mentions, or equations as structured rich text.
- File reads include link items only. File writes accept
externalURLs and existingfileURLs and store them as links. Upload references (file_upload) are unsupported. - Relation writes replace the value and reject
has_more: true. created_timeandlast_edited_timeare read-only top-level fields onpage, when available. The host omits them frompage.properties. The host does not returncreated_byorlast_edited_by, even as top-level fields. The host does not return structured page values for formula, rollup, unique ID, or the other omitted types.