Notion API

  • The Notion API is documented here: https://developers.notion.com/docs.
  • I have mainly used the Javascript API: https://github.com/makenotion/notion-sdk-js

Terms

Databases are made up of pages and pages have properties.

Getting Started

  1. Create a Table in Notion to hold your data. Add properties you will need.

  2. Create an integration in notion and copy the secret token for your integration. You’ll need this later to access Notion with our script.

  3. Share the table you created with your Integration. It should show up below the list of users when you select Share.

  4. While you’re there, copy the database ID, we’ll need that later. It is the string following the last / character and before the ? character 2021 06 03 07 35 43

  5. To use the Notion API in JS you will need to initialize it like so:

const { Client } = require("@notionhq/client");

// Initializing a client
const notion = new Client({
  auth: process.env.NOTION_TOKEN,
});

Functions

notion.databases.query({database_id: DATABASE_ID, filter: {}})

notion.pages.create({parent: {database_id: DATABASE_ID}, properties: {}})

Related Articles

  • Using Notion to Create a User Database: Part I

Contact

Content is copyrighted 2019-2021 © D.S. Chapman. This site was built using GatsbyJS. Code for this website is open source and available on Github