PagesAPI
Defined in: src/api/pages.api.ts:163
Pages API client for working with Notion pages.
Extends
Section titled “Extends”BaseAPI<NotionPage,Page>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PagesAPI(
client):PagesAPI
Defined in: src/api/pages.api.ts:170
Parameters
Section titled “Parameters”client
Section titled “client”NotionClient
Returns
Section titled “Returns”PagesAPI
Overrides
Section titled “Overrides”BaseAPI<NotionPage, Page>.constructor
Methods
Section titled “Methods”archive()
Section titled “archive()”archive(
pageId):Promise<Page>
Defined in: src/api/pages.api.ts:311
Move a page to trash (convenience method).
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to trash
Returns
Section titled “Returns”Promise<Page>
The trashed page wrapped in a Page model
create()
Section titled “create()”create(
options):Promise<Page>
Defined in: src/api/pages.api.ts:199
Create a new page.
Parameters
Section titled “Parameters”options
Section titled “options”CreatePageOptions
Options for creating the page
Returns
Section titled “Returns”Promise<Page>
The created page wrapped in a Page model
https://developers.notion.com/reference/post-page
getMarkdown()
Section titled “getMarkdown()”getMarkdown(
pageId,options?):Promise<{id:string;markdown:string;object:"page_markdown";truncated:boolean;unknown_block_ids:string[]; }>
Defined in: src/api/pages.api.ts:217
Retrieve a page’s content as markdown.
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to retrieve
options?
Section titled “options?”GetPageMarkdownOptions
Options for retrieving the markdown content
Returns
Section titled “Returns”Promise<{ id: string; markdown: string; object: "page_markdown"; truncated: boolean; unknown_block_ids: string[]; }>
The page’s markdown content
https://developers.notion.com/guides/data-apis/working-with-markdown-content
move()
Section titled “move()”move(
pageId,parent):Promise<Page>
Defined in: src/api/pages.api.ts:280
Move a page to a new parent page or data source.
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to move
parent
Section titled “parent”MovePageParent
The new parent (a page or a data source)
Returns
Section titled “Returns”Promise<Page>
The moved page wrapped in a Page model
https://developers.notion.com/reference/move-page
restore()
Section titled “restore()”restore(
pageId):Promise<Page>
Defined in: src/api/pages.api.ts:300
Restore a trashed page (convenience method).
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to restore
Returns
Section titled “Returns”Promise<Page>
The restored page wrapped in a Page model
retrieve()
Section titled “retrieve()”retrieve(
pageId,options?):Promise<Page>
Defined in: src/api/pages.api.ts:183
Retrieve a page by ID.
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to retrieve (with or without dashes)
options?
Section titled “options?”RetrievePageOptions
Options for filtering properties
Returns
Section titled “Returns”Promise<Page>
The page wrapped in a Page model
https://developers.notion.com/reference/retrieve-a-page
trash()
Section titled “trash()”trash(
pageId):Promise<Page>
Defined in: src/api/pages.api.ts:290
Move a page to trash (convenience method).
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to trash
Returns
Section titled “Returns”Promise<Page>
The trashed page wrapped in a Page model
update()
Section titled “update()”update(
pageId,options):Promise<Page>
Defined in: src/api/pages.api.ts:267
Update a page’s properties, icon, cover, or trash status.
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to update
options
Section titled “options”UpdatePageOptions
Options for updating the page
Returns
Section titled “Returns”Promise<Page>
The updated page wrapped in a Page model
https://developers.notion.com/reference/patch-page
updateMarkdown()
Section titled “updateMarkdown()”updateMarkdown(
pageId,options):Promise<{created_time:string;error?: {code:string;message:string;object:"error";status:number; };id:string;object:"async_task";operation: {name:string;surface:"rest"|"mcp"; };poll_after_seconds?:number;result?:unknown;status:"queued"|"running"|"retrying"|"succeeded"|"failed";status_url:string; } | {id:string;markdown:string;object:"page_markdown";truncated:boolean;unknown_block_ids:string[]; }>
Defined in: src/api/pages.api.ts:245
Update a page’s content as markdown.
Set allow_async: true to allow asynchronous processing for large writes.
In that case, the API returns an async_task handle instead of the completed
content. Poll the task with notion.asyncTasks.poll(task.id).
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
The ID of the page to update
options
Section titled “options”UpdatePageMarkdownOptions
The markdown update to apply
Returns
Section titled “Returns”Promise<{ created_time: string; error?: { code: string; message: string; object: "error"; status: number; }; id: string; object: "async_task"; operation: { name: string; surface: "rest" | "mcp"; }; poll_after_seconds?: number; result?: unknown; status: "queued" | "running" | "retrying" | "succeeded" | "failed"; status_url: string; } | { id: string; markdown: string; object: "page_markdown"; truncated: boolean; unknown_block_ids: string[]; }>
The updated markdown content, or an async task handle if processed asynchronously
https://developers.notion.com/guides/data-apis/working-with-markdown-content