Troubleshooting Notion API 404 Error: Object Not Found

I’m having trouble with the Notion API. It’s giving me a 404 status with an “object_not_found” error code. I’ve double-checked everything:

  1. My database is connected to my Notion Integration
  2. I’m using the correct database ID
  3. My Notion Workspace is linked to the Integration
  4. I’ve triple-checked the bearer token in my Postman request

I’ve followed the official setup guide step by step, but it’s still not working. Has anyone else run into this issue? What could I be missing?

Here’s a simplified version of my API call:

const response = await fetch('https://api.notion.com/v1/databases/' + databaseId + '/query', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + notionToken,
    'Notion-Version': '2022-06-28',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({})
});

if (!response.ok) {
  console.error('API error:', response.status, await response.text());
}

Any ideas on what might be causing this 404 error?

I’ve dealt with this exact issue before, and it can be incredibly frustrating. One thing that’s not immediately obvious is that Notion’s API permissions are quite granular. Even if you’ve connected your database to the integration, you might not have the right level of access.

Here’s what worked for me: I went back to my Notion workspace, found the specific database I was trying to access, and manually shared it with my integration. It’s easy to miss this step because you might assume that connecting the integration at the workspace level is enough.

To do this, open your database in Notion, click the ‘Share’ button at the top right, and select your integration from the list. Make sure it has full edit access. After doing this, my 404 errors disappeared.

If that doesn’t solve it, double-check your database ID. Sometimes, especially if you’ve duplicated databases, the ID can change without you realizing it. You can find the correct ID in the URL when you’re viewing the database in Notion.

Hope this helps you resolve the issue!

I encountered a similar issue recently. One often overlooked aspect is the scope of your integration. When you create a Notion integration, you define its capabilities. If you didn’t select the appropriate permissions during setup, you might face 404 errors.

To rectify this, go to your integration settings in the Notion API dashboard. Ensure you’ve enabled the necessary capabilities, especially ‘Read content’ and ‘Query databases’. After updating the permissions, you may need to reinstall the integration in your workspace.

Another potential cause could be workspace-level permissions. If you’re part of a team, check with your workspace admin to confirm that your integration has the necessary access rights across the entire workspace.

Lastly, verify that your database isn’t in a page with restricted access. Notion’s security model can sometimes prevent API access to content in certain locations within your workspace hierarchy.

hey man, i had the same problem. try checking ur api version. sometimes notion updates it and ur code becomes outdated. also, make sure ur using the right endpoint for querying databases. it should be ‘/v1/databases/{database_id}/query’. if none of that works, maybe try regenerating ur integration token. good luck!