Notion Python SDK
Official Python client for the Notion API, maintained by the community (ramnes/notion-sdk-py). Current version is 2.7.0 (Oct 2025). Notion API itself is versioned separately — the SDK version and the API version are two different things. Multiple breaking API versions have shipped in 2024-2026.
Warnings
- breaking API version 2026-03-11 (released Mar 11 2026) removes 'archived' field — replaced by 'in_trash'. Any code reading or writing 'archived' on pages, databases, or blocks will break when using this API version.
- breaking API version 2026-03-11: Append block children endpoint no longer accepts flat 'after' string parameter. Now requires a 'position' object.
- breaking API version 2026-03-11: 'transcription' block type renamed to 'meeting_notes'.
- breaking API version 2025-09-03: Multi-source databases introduced. /v1/databases endpoints now refer to the database container, not the data source. Integrations that create pages or define relations must now pass data_source_id.
- breaking notion.databases.list() raises APIResponseError: 'This API is deprecated'. The List databases endpoint was removed in API version 2022-02-22. Still widely referenced in tutorials.
- gotcha API token prefix changed from secret_ to ntn_ in September 2024. Code doing regex validation or prefix checks on tokens will reject new ntn_ tokens.
- gotcha SDK version and Notion API version are independent. notion-client 2.7.0 does not automatically use the latest API version. Default API version may lag behind latest.
- gotcha notion-py (PyPI: notion) is an unofficial package using private undocumented Notion APIs. It breaks without warning when Notion changes internals. Widely referenced in old tutorials.
Install
-
pip install notion-client
Imports
- Client
from notion_client import Client
- AsyncClient
from notion_client import AsyncClient
- notion-py (abandoned)
from notion_client import Client
Quickstart
import os
from notion_client import Client
notion = Client(auth=os.environ['NOTION_TOKEN'])
# query a database
results = notion.databases.query(
database_id='YOUR_DATABASE_ID'
)
# retrieve a page
page = notion.pages.retrieve(page_id='YOUR_PAGE_ID')
print(page['properties'])