If you’d like to create your own Notion API integration, you need to take care of authentication & authorization. The steps vary depending on what’s your end goal, but I’ll assume that you got here because you’d like to add something to your Notion Page/Database from your own backend. I’ve written about this kind of integration here:
Creating an integration
Start by going to the My integrations page on the Notion website. There you’ll see a list of all integrations which you’ve added
Tap the Create new integration card. You’ll need to fill out the name, logo (optionally) and then capabilities. Content Capabilities and User Capabilities should be picked depending on the things you’d like your app to be able to do. It’s a good practice to select the minimum scope which will do the job, as it protects you in case the API key would ever be stolen.
After clicking on Submit, you’ll be presented with your Secret API Token – this is basically a password and you should treat it as such, make sure to store it securely. Do not hardcode it into the codebase, as it will stay in the git history, it’s best to keep it in a configuration file that is not committed (for local development) and in special vaults (for deployed apps). I mention how to keep these secure in this article.
Access to pages/databases
Now that you have a token, you also need to make sure that your integration has access to the pages/databases that it needs to access.
To share the page/database with the integration, just open it in your option app, select Share (top right corner), click on the People, emails, groups, or integrations and select your new integration. Then click Invite and that’s it, your integration now should have access to the object you’ve shared.
That’s it – Notion API is now open to your apps!
You’re now ready to use the token & shared pages/databases to create cool things. Let me know what you’ve created or if you’d have any issues with the process – I’d be happy to help, so feel free to reach out on Twitter 🚀