The Notion SDK for JavaScript calls Notion's REST API from Node or browsers. It types requests and responses, groups parameters per endpoint, and handles retries for rate limits and server errors.
Overview
This package is Notion's supported TypeScript and JavaScript client for integrations that read and write workspace data through the Notion API. Construct a Client with an integration token or OAuth access token, then invoke typed methods that mirror API endpoints.
Responses are promises with parsed JSON bodies. Endpoint helpers accept a single options object combining path, query, and body fields. Markdown read and write supports a v2 mode ahead of API defaults retiring v1.
Automatic retries cover 429, 529, and selected 5xx responses with configurable retry counts and backoff. Browser usage is blocked by default because tokens in pages are exposed to visitors; dangerouslyAllowBrowser opts in with explicit risk acceptance.
Pagination helpers iterate pages, collect results, and walk large data sources beyond single-query limits. Type guards distinguish full block, page, user, and comment objects in responses.
Key features
- Typed Notion REST API methods
- Grouped endpoint parameter objects
- Automatic rate-limit retries
- Markdown v1 and v2 support
- Pagination iteration helpers
- Type guards for API objects
- Optional browser usage flag
Use cases
- Workspace automation scripts
- Syncing Notion databases to other systems
- Internal tools backed by Notion content