I want to build a blog that pulls content from Notion using their API. My goal is to fetch the actual page content in markdown format and display it on my website. I’ve been looking through the Notion API documentation but I’m having trouble finding the right endpoint or method to get the actual content of a page. I can see how to get page properties and metadata, but the actual text content seems harder to access. Has anyone successfully extracted the full page content using the Notion API? I need to get the markdown or rich text content so I can render it properly on my blog. Any guidance on which API endpoints to use would be really helpful.
the notion API’s tricky for this - you’ll need to hit the blocks endpoint recursively since everything’s stored as nested blocks. I wrote a function that walks through all blocks and converts them to markdown. worked great for what I needed. just make sure you handle each block type separately.
I’ve built something similar before. Notion doesn’t store content as markdown - it’s all blocks in a hierarchy. Start with the “/v1/blocks/{block_id}/children” endpoint using your page ID as the block_id. This gets you all the top-level blocks on that page. Here’s where it gets tricky: nested stuff like toggle lists or columns need separate API calls for their child blocks. I ended up writing a recursive function that handles each block type and builds the markdown piece by piece. Watch out for rate limits if you’ve got pages with tons of content. The API gives you rich text objects with formatting annotations, so reconstructing bold, italic, etc. is pretty straightforward once you get how it works.
I ran into the same issue when building a blog with Notion. Notion doesn’t give you markdown directly - you have to work for it. Use the “Retrieve block children” endpoint with your page ID. This gets you structured JSON with all your content blocks (headings, paragraphs, lists, etc.). Then you’ll need to build a parser that converts those blocks to markdown. The rich text objects have both the content and formatting info, so it’s doable. Takes some coding work, but totally manageable.