Receiving 404 object_not_found error when accessing pages via Notion API

I set up an internal integration token in Notion and granted it all permissions available. However, when I attempt to retrieve page information through the API, I consistently encounter 404 errors.

To illustrate, I’m executing the following command:

curl -H 'Authorization: Bearer secret_YYYYYYYYYYYY' -H 'Notion-Version: 2022-06-27' https://api.notion.com/v1/pages/GGGGGGGGGGGG

But the response I get is:

{
  "object": "error",
  "status": 404,
  "code": "object_not_found",
  "message": "Could not find page with ID: GGGGGGGG-GGGG-GGGG-GGGG-GGGGGGGGGGGG. Make sure the relevant pages and databases are shared with your integration."
}

I’m retrieving the page ID from the URL in this format:
https://www.notion.so/myteam/Page-name-GGGGGGGGGGG

Additionally, the workspace permissions allow everyone in the organization to access it. I’ve also tried fetching child blocks with /v1/blocks/GGGGGG/children, yet I receive the same not-found error.

The error message suggests that I should share the integration with the pages, but I can’t find my integration in the invite search box when attempting to invite it through the page’s sharing option. What could I be overlooking?

Those workspace permissions won’t give your integration access to individual pages. Integrations start with zero access no matter what your workspace settings are. You’ve got to manually connect it to each page or database you want to hit through the API. Go to your page, click the three dots, then find “Connections” or “Add connections.” Your integration should be in that list - not in the regular sharing menu. If it’s not showing up, check that it’s configured right in workspace settings and you’re in the correct workspace. I ran into this same thing when I started with Notion’s API - wasted hours debugging before I realized I’d missed the connection step.

first, make sure your integration token is still valid. also, check if you’re using the correct page ID format, as notion URLs can be confusing. if you can’t find the integration in the invite options, it’s likely not set up right in your workspace settings.

This is a common hurdle with Notion integrations. Your API configuration appears correct, but the key issue lies in sharing permissions. Even if workspace permissions are granted, you must explicitly share each page and database with your integration. Navigate to the specific page you want to access, find the three dots in the upper right corner, and select “Add connections” or “Connect to,” depending on your Notion version. Your integration will be listed there, rather than in standard invite options. Select it and confirm. I faced this challenge early on with Notion’s API as well; full permissions don’t automatically equate to access. You need to connect the integration individually to each relevant page or database.