DEV Community

Cover image for Using Notion's new beta API
Christine Kim
Christine Kim

Posted on

Using Notion's new beta API

Recently, Notion released a beta public API. This is amazing news, as an avid user of Notion, I am excited to find ways to integrate my Notion workplace more seamlessly across tools. The documentation for the API is found here.

This post is just an intro into hitting the API using Postman - instead of using the SDK- just in case if I choose to write an integration in another language.

Setting up the workplace is comprehensive.

  1. Have a personal workspace
  2. Go to the Notion integration page. This should already be linked up with your account. Name your project, copy and paste your token somewhere safe!
  3. Make a page. Share a workspace with your integration, by clicking Share. Your integration you made should be listed.

Now here is a breakdown of the URLs, because I was slightly confused on how to get the ID of certain blocks.

First off, a POST request through Postman.
This is pretty straight forward. First, you need the ID of the database.

Say your workspace has this link (you can get this link by clicking Share, and clicking Copy link in the bottom right of the popup.

The link for this table page is for example is https://www.notion.so/904748e3b5214b28a5e6f74f32048e1f?v=4a8....
I changed the IDs of my pages, so clicking this link will result in a 404.

We want the 904748e3b5214b28a5e6f74f32048e1f part of the url. So copy your database ID down.

I created a page in this page, which contains a table already in my workspace.

Screen Shot 2021-05-26 at 10.11.43 AM

With the database ID copied down, I go into Postman and fill a POST request.
In the url field, paste in https://api.notion.com/v1/pages

Screen Shot 2021-05-26 at 10.33.04 AM

Remember the secret token we got earlier? Under the Authorization tab, select the TYPE as 'Bearer Token', and paste that token in the text field.
Screen Shot 2021-05-26 at 10.34.58 AM

Then in the Body tab, we are going to fill in the data to write an entry into the table.
Screen Shot 2021-05-26 at 10.36.36 AM

Make sure to change your database_id with your respective ID (mine was 9047e... ).

Now click Send. If everything was filled out correctly, you should get a JSON response with the id, and the properties of the page!
Congrats, you made your first POST request in Postman with Notion's beta API!

Top comments (0)