Notion API / TypeScript recipe
Connect the Notion API from TypeScript, safely.
Install @pontx/notion, verify the current connection from a local environment variable, then continue to the Notion page, data-source, and block API reference.
pontx-hub searchpontx-hub previewpontx-hub call@pontx/<api>Confirm the connection boundary
This page verifies your integration identity only; it does not send workspace data to Pontx.
Notion workspace content is your end-user data. Create or select an integration in Notion, give it access only to the pages or data sources it needs, and keep its token in a local environment variable.
Install and keep credentials local
Give the token to your runtime environment, never to source code, shell history, or an issue.
pnpm add @pontx/notion
# Keep the value in your local shell or secret manager.
export NOTION_ACCESS_TOKEN="<your-notion-integration-token>"The SDK sends requests using its pinned API version. Do not replace the placeholder with a real token in an example; deployment environments should provide the same variable through their secret manager.
Verify the current identity first
This is the smallest read-only call: it confirms the token works without reading your pages or data sources.
import { createNotionClient } from "@pontx/notion";
const client = createNotionClient({
auth: process.env.NOTION_ACCESS_TOKEN
});
const me = await client.users.getSelf();
console.log(me);Continue to a workspace task
Once the connection is verified, choose the Endpoint that matches the task instead of guessing request fields.
From the Notion API overview, continue to the full page, block, data-source, comment, and search reference. Preview and verify the target and parameters locally before any request that creates, updates, or deletes workspace data.
Open the Notion API overview ↗