TypeScript SDK
Markdown content
Update a page's content as markdown
Insert or replace content in a page using enhanced markdown.
PATCH
TypeScript SDK
Documentation Index
Fetch the complete documentation index at: https://developers.notion.com/llms.txt
Use this file to discover all available pages before exploring further.
Use cases
Updating content with search-and-replace (recommended)
Use theupdate_content command to make targeted edits using an array of search-and-replace operations. Each operation specifies an old_str to find and a new_str to replace it with. This is the recommended approach for making precise edits without rewriting the full page.
Replacing all page content (recommended)
Use thereplace_content command to replace the entire page content with new markdown. Provide the full replacement content in new_str.
Inserting content (legacy)
Use theinsert_content command to add new markdown content to a page. Provide position: { "type": "start" } to prepend, position: { "type": "end" } to explicitly append, or omit position to append to the end of the page. You can also provide an after selection to insert at a specific point; after uses an ellipsis-based selection format: "start text...end text".
We recommend using
update_content or replace_content instead. The insert_content command is still supported but may be deprecated in a future version.Replacing a content range (legacy)
Use thereplace_content_range command to replace a matched range of existing content with new markdown. The content_range parameter uses the same ellipsis-based selection format as after.
We recommend using
update_content instead. The replace_content_range command is still supported but may be deprecated in a future version.General behavior
Returns apage_markdown object containing the full page content as enhanced markdown after the update, including truncated and unknown_block_ids fields for large pages.
RequirementsYour connection must have update content capabilities on the target page in order to call this endpoint. To update your connection’s capabilities, navigate to the Developer portal, select your connection, open the Configuration tab, and scroll to the Capabilities section.Attempting to call this endpoint without update content capabilities returns an HTTP response with a 403 status code.
Errors
| Error code | Condition |
|---|---|
validation_error | The content_range or after selection does not match any content in the page, or an old_str in update_content is not found. |
validation_error | Both insert_content.after and insert_content.position are provided. Use only one insertion target. |
validation_error | The operation would delete child pages or databases and allow_deleting_content is not true. |
validation_error | An old_str in update_content matches multiple locations and replace_all_matches is not true. |
validation_error | The provided ID is a database or non-page block. |
validation_error | The target page is a synced page. Synced pages cannot be updated. |
object_not_found | The page does not exist or the connection does not have access to it. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The API version to use for this request. The latest version is 2026-03-11.
Available options:
2026-03-11 Path Parameters
The ID of the page to update.
Body
application/json
Response
The type of object, always 'page_markdown'.
Allowed value:
"page_markdown"The ID of the page or block.
The page content rendered as enhanced Markdown.
Whether the content was truncated due to exceeding the record count limit.
Block IDs that could not be loaded (appeared as tags in the markdown). Pass these IDs back to this endpoint to fetch their content separately.
Maximum array length:
100