explaingit

makenotion/notion-sdk-js

5,601TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

The official Notion JavaScript and TypeScript client library that lets Node.js code read and write Notion pages, databases, and users via the Notion API, with built-in automatic retry when rate limits are hit.

Mindmap

mindmap
  root((notion-sdk-js))
    What it does
      Read Notion databases
      Create and update pages
      Manage users and comments
    Built-in features
      Automatic rate-limit retry
      Request timeout config
      Structured error handling
    Developer experience
      TypeScript types shipped
      Autocomplete in editors
      Debug request logging
    Setup
      Single npm install
      Integration token required
      Mock server for testing
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Query a Notion database and display its rows in a web application or dashboard.

USE CASE 2

Automatically create a new Notion page whenever a form is submitted or a webhook fires from another service.

USE CASE 3

Build a sync script that reads records from an external API and updates matching rows in a Notion database.

USE CASE 4

Handle Notion API rate limits gracefully in a bulk-import script by relying on the SDK's built-in retry logic.

Tech stack

TypeScriptNode.jsnpm

Getting it running

Difficulty · easy Time to first run · 30min

Requires a Notion integration token created at notion.so/my-integrations and the integration connected to the target pages.

In plain English

This is the official JavaScript and TypeScript client library for the Notion API, published by Notion itself. It lets developers write code that talks to a Notion workspace: reading pages and databases, creating or updating content, querying filtered lists of records, and managing users or comments, all from a Node.js application or any JavaScript environment. Installing the package takes a single command, and the setup is straightforward. You provide an authentication token, which Notion calls an integration token, and the client handles the rest of the connection. Every Notion API endpoint is available as a method on the client object, with all the parameters (whether they normally go in the URL, the query string, or the request body) grouped into one plain object so you do not have to track where each one belongs. The library handles several common problems automatically. If Notion's servers are temporarily overloaded or return a rate-limit response telling the client to slow down, the SDK will wait and retry the request on its own, using progressively longer delays between attempts. You can configure how many retries to allow, how long to wait between them, or turn the behavior off entirely. Error handling is structured so that specific failure codes (like a database not being found, or a token not having permission to access something) can be caught and handled distinctly in your code. For debugging, the client can log the details of every request and response to the console or to a custom logging function of your choosing. Configuration options include setting a request timeout, pointing the client at a mock server for testing, and routing traffic through an HTTP proxy. The package is written in TypeScript and ships with type definitions, so editors with type-checking support will show autocomplete suggestions and catch mismatched parameters before the code runs. It is published on npm under the name @notionhq/client.

Copy-paste prompts

Prompt 1
Using @notionhq/client in Node.js, help me query a Notion database and filter for all rows where a Status property equals Done, then print the page titles.
Prompt 2
Show me how to create a new page inside a Notion database using notion-sdk-js, setting a title property and adding a paragraph of body text.
Prompt 3
I need to sync data from an external REST API into a Notion database on a schedule. Help me write a Node.js script that uses notion-sdk-js to upsert rows, creating a page if it does not exist and updating it if it does.
Prompt 4
Help me add structured error handling to my Notion API script so I can catch not-found errors and permission errors separately using notion-sdk-js.
Open on GitHub → Explain another repo

← makenotion on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.