I have been using notion to track my habits and my finances. Now I want to get the data from the database using the Notion API. But the notion API requires Database ID and I can't seem to find it.
I have been using notion to track my habits and my finances. Now I want to get the data from the database using the Notion API. But the notion API requires Database ID and I can't seem to find it.
The official documentation is probably outdated or at least not working for UK users.
If your URL looks like below, then <long_hash_1> is the database ID and <long_hash_2> is the view ID.
https://www.notion.so/<long_hash_1>?v=<long_hash_2>
You must share the database with your integration! Click the share button in your database view, find your integration name and switch on the toggle next to it.
If you still haven't found your URL, you can get it from either the web client or an APP client:
If this is just for yourself, you can get the database ID from the URL of the page:
If you're using the Notion desktop app, click on the Share button once again and select Copy link. Paste and navigate to this URL in your browser. You may need to log into the Notion workspace if you haven't already. Follow the instructions for the browser in the next bullet.
If you're using Notion in a browser and viewing the database as a full page, the database ID is the part of the URL after your workspace name and the slash (acme/) and before the question mark (?). The ID is 32 characters long, containing numbers and letters. Copy the ID and paste it somewhere you can easily find later.
https://www.notion.so/myworkspace/a8aec43384f447ed84390e8e42c2e089?v=... |--------- Database ID --------|
If you are creating an integration for others, you can use the Search endpoint to get all databases your integration has access to. There is also a List databases endpoint, but apparently this is deprecated.