notion-apinotion

Can i get notion page content using notion api?


I'm planning to make some blog using notion api.

I would like to use the notion api to bring the notion page markdown and show on my blog.

But, I can't find to get page content..

Is there a way to import page markdown content using api?


Solution

  • You need to use Notion's Blocks API. Treat a page as a block, and get its children:

    curl 'https://api.notion.com/v1/blocks/<your-page-id>/children?page_size=100' \
      -H 'Authorization: Bearer '"$NOTION_API_KEY"'' \
      -H "Notion-Version: 2022-02-22"
    

    Please remember that the content will come up as an array of text pieces that you will need to stitch together.