Notion API will be released in spring, but you can use it now

4 min


The other day Notion spoke about the launch of a closed beta testing of its official API, which has been in development for at least two years. On page There is very little specific information, not even an approximate functionality is described, but you can leave an application for participation – the company promises to gradually disclose information and interview developers in order to roll out the most convenient and useful interface. The only snag is that this long-term construction is not yet close to completion, the launch is scheduled for the spring of 2021 and can easily move, as has happened before. But if there is no time to wait and want to work with the API now, you can use one of the custom implementations in different languages ​​and with different functionality.

There are quite a few APIs with access to reading public data, and full writing is implemented only in python notion-py. Since there is no normal opportunity to get a token, all options are wrappers for the internal Notion API and to access private data, you need to get the token from the cookies:


In DevTools, you can take the token_v2 value from the notion.so cookie

Unofficial API implementations

notion-py

The largest and most detailed project, written in python.
Repository (2.1k stars / 224 forks)

  • Reactive read / write anywhere
  • Converting data from internal Notion formats to python objects, compiling database tables into classes / attributes
  • Caching data in local storage
  • Callbacks for action and external change
  • Lots of examples and tests, coverage of basic use cases

notion-py is used in over 240 repositories and will definitely remain the best project until the official API is released. It can fully record any data, from text to file uploads, and reacts to changes in real time. There is no validation for most data types, so you have to write it yourself when working with user input. Centralized storage is disabled by default, but quite useful for large amounts of data and heavy operations. You can edit not only the entire pages, but also individual blocks by their id.

notionapi

Preceded and inspired by notion-py, implementation for Go
Repository (1.4k stars / 59 forks)

  • Reading public and private pages and blocks
  • Limited entry: you can change the titles and page formats
  • Out of the box types of blocks are available in which the received Notion blocks are saved
  • There are ready-made converters to HTML and Markdown

The recording functionality does not really suffer from any restrictions, the author simply wrote exactly as much as he needed himself. If you wish, you can finish it up to the notion-py level, but so far there have been no such Go-enthusiasts. notionapi is used in the project presstige.iowhere Notion acts as CMS and posts are published on presstige.

notion-api

Wrapper for JS, available on npm.
Repository (222 stars / 28 forks), npm (44 downloads per week)

This is a very simple library, it can only read public and (if a token is available) private pages by id or a list of pages by root id. The data is not parsed, the response is returned as a string.

notion-sdk-kotlin

Kotlin / Java implementation
Repository (45 stars)

There is also only basic functionality for reading by id and authorization both by token and by email with a password. There is a ready-made mapping of data from tables / collections. But on Kotlin.

Examples of using

notion-api-worker

Another example of using Notion as a CMS
Repository (538 stars / 38 forks)

there is hosting, but it’s more fun to deploy it yourself. Allows you to conveniently use data, interact with databases, uses the most fashionable stale-while-revalidate caching.

react-notion-x

Turbo Booster for Public Pages on Notion
Repository (137 stars / 9 forks)

NotionX is an almost completely finished project for rendering Notion pages in React. The application simply receives data from the API and renders it several times faster than the original. All blocks are supported (an impressive list), except for the calendar, but this is also a matter of time. The author loves to optimize:

md2notion

Markdown to Notion converter
Repository (175 stars / 12 forks)

Imports the contents of a md file into a Notion page. Written in python, there is a CLI. A very sophisticated tool, handles data carefully:

  • Preserves code formatting as much as possible
  • Saves inline HTML
  • Works with lists and nested structures
  • Can download images by URL and write alts in signatures in Notion

Conclusion

The official API may not be released soon, or it may even be paid, which will automatically cut off many directions for pet projects and integrations with IFTTT. Unofficial API wrappers, of course, can also cover up, but so far they have been working successfully for a long time and many projects are based on them, so they still look more attractive.


Advertising

VDSina offers VDS with daily payment, the ability to create your own server configuration in a couple of clicks, install any operating system. Each server is connected to an Internet channel of 500 Megabits and is protected from DDoS attacks for free!


0 Comments

Leave a Reply