notion
TypeScript packages for Notion's unofficial API, data types, and related utilities.
Usage
import { NotionAPI } from 'notion-client'
const api = new NotionAPI()
// this will fetch all blocks for the given page as well as any collection data
// for collection views contained on the page
const page = await api.getPage('067dd719-a912-471e-a9a3-ac10710e7fdf')
// example of fetching the data for a specific collection instance
const collectionId = '2d8aec23-8281-4a94-9090-caaf823dd21a'
const collectionViewId = 'ab639a5a-853e-45e1-9ef7-133b486c0acf'
const colectionData = await api.getCollectionData(
collectionId,
collectionViewId
)
All examples use this public notion workspace which aims to cover 100% of Notion's public functionality.
Docs
Package | NPM | Docs | Description |
---|---|---|---|
notion-client | docs | TypeScript client for the unofficial Notion API. | |
notion-types | docs | TypeScript types for core Notion data structures. | |
notion-utils | docs | Useful utilities for working with Notion data. |
Related
- notion test suite - Comprehensive suite of public Notion pages to test individual features.
- react-notion - React renderer for Notion data.
- notion-api-worker - Notion API proxy exposed as a Cloudflare Worker.
- Currently doesn't handle collection data very robustly.
- notion-api-agent - Alternative Notion API client.
License
MIT © Travis Fischer
Support my OSS work by following me on twitter
This project extends MIT-licensed work by Timo Lins, Tobias Lins, Sam Wight, and other contributors.