Skip to main content
The Client class is the main entry point for interacting with the Notion API. It handles authentication, request management, and provides access to all API endpoints.

Basic Initialization

Create a client instance with your Notion API token:
Get your API key from the Notion integrations page.

Client Options

The client accepts several configuration options:

Authentication

auth
string
Your Notion integration token or OAuth access token. Can also be provided per-request.

Base URL

baseUrl
string
default:"https://api.notion.com"
The base URL for Notion API requests. Useful for testing or proxying.

Notion Version

notionVersion
string
default:"2025-09-03"
The Notion API version to use. Defaults to Client.defaultNotionVersion.

Request Timeout

timeoutMs
number
default:60000
Request timeout in milliseconds. Requests exceeding this limit will throw a RequestTimeoutError.

Custom Fetch

fetch
SupportedFetch
Custom fetch implementation. Useful for testing or using alternative HTTP clients.

HTTP Agent

agent
Agent
Node.js HTTP agent for connection pooling and proxy support. Silently ignored in browsers.

Retry Configuration

See Retries for detailed retry configuration.

Logging

See Logging for logging configuration options.

Making Requests

The client provides namespaced methods for each API resource:

Custom Requests

For advanced use cases, you can make custom requests using the request method:

Request Parameters

path
string
required
The API endpoint path (without the /v1/ prefix).
method
'get' | 'post' | 'patch' | 'delete'
required
The HTTP method.
query
Record<string, string | number | boolean | string[]>
URL query parameters.
body
Record<string, unknown>
Request body for POST and PATCH requests.
auth
string | { client_id: string; client_secret: string }
Override the client-level auth for this request.
headers
Record<string, string>
Additional HTTP headers.

Per-Request Authentication

You can override the client-level authentication for individual requests:

OAuth Authentication

For OAuth flows, provide client_id and client_secret:
See the OAuth guide for more details.

Type Safety

All methods return fully typed responses:
See TypeScript for more on working with types.