I’m building a simple Notion client using their API. During the OAuth flow, users can select which pages they want to grant access to my application.
The problem is I can’t figure out how to retrieve information about what the user actually allowed. After completing the OAuth process, I need to know which specific pages or databases my app can work with.
Is there an endpoint or method in the Notion API that returns the list of authorized resources? I want to show users what content they’ve shared and avoid making requests to pages I don’t have permission for.
honestly, the easiest approach i’ve found is callin /v1/users/me first to check your integration status, then try accessing content thru normal page/database endpoints. notion returns 403s for stuff you can’t access anyway, so you’ll kno right away what didn’t get authorized. way simpler than trying to enumerate everything upfront, and avoids those search rate limits too.
There’s no direct way to get a list of what was authorized during OAuth. I use the database and page listing endpoints instead of search - hit /v1/databases and /v1/pages right after OAuth completes. These only return resources your integration can actually access. The search endpoint emmad mentioned works but gets unreliable with complex workspace setups. I store any page and database IDs I find in my own database, then periodically test if I still have access. Saves me from permission errors when users revoke access to specific pages later.
Once OAuth’s done, hit the search endpoint to find what you can access. Notion doesn’t have a ‘list authorized pages’ endpoint, but search only returns stuff your integration can see anyway. Just POST to ‘/v1/search’ with an empty query or filter by object type (page/database). You’ll get back everything your app can touch based on the OAuth permissions. Heads up - results are paginated, so handle ‘next_cursor’ if users have tons of pages. Cache these results too since the search endpoint has rate limits you can blow through pretty fast.