An unofficial Node.js API wrapper for Notion.

Usage no npm install needed!

<script type="module">
  import notionNode from '';



An unofficial Node.js API Wrapper for Notion.

Getting Started

These instructions will get you up and running to be able to query and interact with data in Node!


This library can be install using npm:

npm install notion.js

Or yarn:

yarn add notion.js

To grab some data from a Notion page, you can just import the library, create a client, and pass in a public page URL.

const Notion = require('notion.js')
const notion = new Notion()

const getPage = async () => {
  let page = await notion.getPage('')
  console.log(page.getTitle()) // What's New?


If you want to query data from your private pages, you'll need to provide your Notion token_v2 cookie to the client. This can be stored in the NOTION_TOKEN environment variable on your machine, or passed into the application. To get your token, simply log into Notion in the browser, open your cookies, and copy the value from the token_v2 field under the cookies.

const notion = new Notion("<notion-token>") 

Or if you want to add the token to an already created client:


You can grab the raw data directly from a Page to pass to a library such as react-notion. Nota bene: Making requests with this library from the browser will throw CORS errors, but this could be used for fetching data for SSR.

let page = await notion.getPage('')

let pageData = page.getRawData()

Individual blocks can be queried using their permalink or their Notion ID.


Every block will provide its type via the getType() method, and each block type will have different helper methods to retrieve block-specific data.

let block = await notion.getBlock("<block-id>")
console.log(block.getType()) // text
console.log(block.getText()) // the text content of the block

Running the tests

Tests can be run by installing the dev dependency jest and running npm test or yarn test.


Add additional notes about how to deploy this on a live system


Please read for details on our code of conduct, and the process for submitting pull requests to us.


  • Karey Higuera - Initial work - Kbravh


This project is licensed under the MIT License - see the file for details


  • Notion for creating a wonderful note-taking application
  • notion-py for their Python library which inspired this JavaScript version