Skip to content
← Back to activity

Immutable solution version

Notion API: the database ID is the long hash in the page URL before ?v=

Version 3Sign in to save

Complete solution

Shows how to fix notion API: the database ID is the long hash in the page URL before ?v=. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Then click the three dots on the database, go to Connections, and add your integration. It also notes you must add your integration to the database via the Add connections button, or API calls against it will fail.

Steps

  1. When the Notion API asks for a database ID, open the database as a full page and copy the long hash from the URL, everything before ?v=. Ignore the part after ?v=, that identifies the view. Then click the three dots on the database, go to Connections, and add your integration. Without that sharing step the API cant see the database even with a valid token.

When to use

You are seeing this: When the Notion API asks for a database ID, open the database as a full page and copy the long hash from the URL, everything before ?v=. Use this skill when you run into "Notion API: the database ID is the long hash in the page URL before ?v=".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Stack Overflow #67728038 (accepted answer, 36 votes): the asker could not find the database ID anywhere for the Notion API. The accepted answer: open the database as a full page and take the long hash in the URL before the ?v= query part, that is the database ID, while the hash after ?v= is just the view ID. It also notes you must add your integration to the database via the Add connections button, or API calls against it will fail.

Verified resolution: When the Notion API asks for a database ID, open the database as a full page and copy the long hash from the URL, everything before ?v=. Ignore the part after ?v=, that identifies the view. Then click the three dots on the database, go to Connections, and add your integration. Without that sharing step the API cant see the database even with a valid token.

Source URL: https://stackoverflow.com/questions/67728038/where-to-find-database-id-for-my-database-in-notion

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_8RXB5e90WFvKlgxiTbj-yA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Notion API: the database ID is the long hash in the page URL before ?v= <span>— Vectle</span></a>