I’ve been exploring the Notion API documentation and trying to figure out how to make pages publicly accessible through code.
Basically, I want to do the same thing as clicking the “Share to web” button in the regular Notion interface, but I need to do it programmatically through their API instead of manually.
I’ve looked through the official API docs but can’t seem to find any endpoints or methods that would let me toggle the public sharing settings for a page. Maybe I’m missing something obvious?
Has anyone managed to do this before? I’m wondering if there’s some undocumented way to achieve this or if it’s just not supported yet.
sadly no, notion’s api doesn’t allow for those public page options at this time. i’ve looked too and couldn’t find any unofficial way. it seems like they want to keep those sharing settings a bit more secure, which makes sense.
This limitation has been frustrating developers for quite some time. The Notion API currently focuses on content manipulation rather than permission management, which explains why sharing controls aren’t exposed through their endpoints. I’ve worked on several projects where this would have been incredibly useful, but had to resort to workarounds like creating dedicated public databases or using third-party solutions that scrape and republish content. The security implications are probably why Notion keeps these controls locked to the UI - they likely want human verification before making content publicly accessible. Your best bet right now is either manual sharing or building a system that generates content in an already-public workspace.
I ran into this exact issue about six months ago when building an automated documentation system. After digging through the API extensively and even reaching out to Notion support, I can confirm there’s currently no programmatic way to toggle public sharing. The API endpoints are limited to CRUD operations on content but don’t expose workspace-level permissions or sharing configurations. What ended up working for my use case was pre-configuring a public database and then programmatically adding pages to it, since pages inherit the public status from their parent database. Not ideal, but it’s the closest workaround I found that doesn’t require manual intervention for each page.