Skip to main content
The Notion SDK provides methods to work with page content as Markdown, making it easy to export or programmatically update page content.

pages.retrieveMarkdown

Retrieves a page’s content rendered as Notion-flavored Markdown.

Method Signature

Parameters

page_id
string
required
The ID of the page (or block) to retrieve as markdown. Non-navigable block IDs from truncated responses can be passed here to fetch their subtrees.
include_transcript
boolean
Whether to include meeting note transcripts. Defaults to false.
  • When true: Full transcripts are included in the markdown
  • When false: A placeholder with the meeting note URL is shown instead
auth
string
Bearer token for authentication. Overrides the client-level authentication.

Response

object
string
Always "page_markdown"
id
string
The ID of the page or block
markdown
string
The page content rendered as enhanced Markdown
truncated
boolean
Whether the content was truncated due to exceeding the record count limit
unknown_block_ids
array
Block IDs that could not be loaded (appeared as <unknown> tags in the markdown). Pass these IDs back to this endpoint to fetch their content separately.

Examples

Basic Markdown Retrieval

Save Page as Markdown File

Include Meeting Transcripts

Handle Truncated Content


pages.updateMarkdown

Updates a page’s content using Notion-flavored Markdown. You can insert new content or replace existing content ranges.

Method Signature

Parameters

page_id
string
required
The ID of the page to update.
type
string
required
The type of update operation. One of:
  • "insert_content" - Insert new content into the page
  • "replace_content_range" - Replace a range of existing content

For insert_content type:

insert_content
object
required
Configuration for inserting new content.

For replace_content_range type:

replace_content_range
object
required
Configuration for replacing existing content.
auth
string
Bearer token for authentication. Overrides the client-level authentication.

Response

Same as retrieveMarkdown - returns a PageMarkdownResponse with the updated content.

Examples

Insert Content at End

Insert Content After Specific Text

Replace Content Range

Replace with Permission to Delete

Update Documentation from Git

Append Daily Log Entry

Content Selection Format

The after and content_range parameters use an ellipsis format to select content:
  • Start text: The beginning of the content range
  • End text: The end of the content range
  • Ellipsis (...): Separator between start and end

Examples:

  • "## Introduction...## Methods" - Selects from “Introduction” heading to “Methods” heading
  • "First paragraph...Last paragraph" - Selects text between these paragraphs
  • "# Title...---" - Selects from title to a divider

Notion-Flavored Markdown

Notion’s markdown flavor supports:
  • Standard Markdown syntax (headings, lists, bold, italic, etc.)
  • Code blocks with syntax highlighting
  • Tables
  • Callouts and quotes
  • Links and inline mentions
  • LaTeX equations
  • Embeds and media
For detailed syntax, see Notion’s Markdown documentation.

Important Notes

When using replace_content_range, be careful with the content_range selection. If the selection is ambiguous or matches multiple locations, the operation may fail or produce unexpected results.
The truncated field in the response indicates if the page has more content than can be returned in a single response. Use the unknown_block_ids to fetch additional content.
Use markdown operations for:
  • Exporting Notion pages to static site generators
  • Programmatically updating documentation
  • Syncing content from external sources
  • Automating content generation

See Also