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
Your Notion integration token or OAuth access token. Can also be provided per-request.
Base URL
The base URL for Notion API requests. Useful for testing or proxying.
Notion Version
The Notion API version to use. Defaults to
Client.defaultNotionVersion.Request Timeout
Request timeout in milliseconds. Requests exceeding this limit will throw a
RequestTimeoutError.Custom Fetch
Custom fetch implementation. Useful for testing or using alternative HTTP clients.
HTTP 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 therequest method:
Request Parameters
The API endpoint path (without the
/v1/ prefix).The HTTP method.
URL query parameters.
Request body for POST and PATCH requests.
Override the client-level auth for this request.
Additional HTTP headers.
Per-Request Authentication
You can override the client-level authentication for individual requests:OAuth Authentication
For OAuth flows, provideclient_id and client_secret: