nodecode-notion
Notion through its REST API: search the pages and databases shared with an integration, read pages, blocks and database rows, and create, update and append to pages. Written for Nodecode from Notion's API reference.
Get it
Tell the agent "add the notion cell", or run nodecode add nc://notion.
Set it up
- Create an internal integration at notion.so/profile/integrations and copy its token. Give it only the capabilities you want: read content alone is enough for a read-only setup.
- Share the pages and databases it may use with it: the page's
...menu, Connections. It sees nothing else. - Put the token in Nodecode's environment as
NOTION_TOKEN.
See config.example.jsonc:
| Key | Default | What it does |
|---|---|---|
base_url |
"https://api.notion.com" |
Where Notion's API answers: https://, or http:// on this machine. |
token_env |
"NOTION_TOKEN" |
The environment variable holding the integration token. |
token |
none | A token written here instead; the environment variable wins. |
notion_version |
"2026-03-11" |
The Notion-Version header this cell was written against. |
read_only |
false |
Refuse the three writing tools before any request. |
timeout |
30 |
One API call's ceiling, in seconds. |
max_results |
25 |
The most search results or rows one call asks for, and the default (Notion's ceiling is 100). |
max_blocks |
300 |
How many blocks one page or block read takes in. |
max_chars |
30000 |
How many characters one answer carries. |
Use it
| Tool | Notion API | For |
|---|---|---|
notion_search |
POST /v1/search |
Pages and data sources by title, newest edits first; kind (page, data_source), max_results, start_cursor. |
notion_get_page |
GET /v1/pages/{id}, GET /v1/blocks/{id}/children |
One page: title, URL, parent, properties, and its content unless content is false. |
notion_read_blocks |
GET /v1/blocks/{id}/children |
The blocks under a page or block, children nested to depth 1 to 3, from start_cursor. |
notion_query_database |
GET /v1/databases/{id}, POST /v1/data_sources/{id}/query |
A database's rows with Notion's filter and sorts objects; takes a database id or URL (its first data source) or a data source id. |
notion_create_page |
POST /v1/pages, PATCH /v1/blocks/{id}/children |
A page under a page, or a row in a database (parent_type: "database"), with title, content and properties. |
notion_update_page |
PATCH /v1/pages/{id} |
A page's title or properties; trash or restore it. |
notion_append_blocks |
PATCH /v1/blocks/{id}/children |
Content added at the end of a page or block, or after one of its blocks. |
Ids: pass a page URL, a dashed id or 32 hex digits; the cell reads the id out and nothing else reaches the request path.
Content is written markdown-like, one block per line: #/##/### headings, -/* bullets, 1. numbers, - [ ]/- [x] to-dos, > quotes, ``` code fences with a language, --- dividers, and paragraphs (consecutive lines join). Inline bold, italics and links stay plain text. Text is cut into Notion's 2000-character runs, and content past 100 blocks is appended in further calls.
Reading, a page's properties come back as Name: value lines and its blocks as markdown-like lines; an image or file is named by its caption, never by its signed URL, and a block with children says so with the id to read deeper.
page 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d - Launch plan https://www.notion.so/Plan-1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d parent: data source ds-1 created 2026-11-01T10:00:00.000Z, edited 2026-12-01T09:00:00.000Z Properties: Name: Launch plan Due: 2026-12-10 Status: In progress Tags: web, docs Content (3 blocks): ## Goals - [x] Ship it > Details (has children: b4)
/notion checks the connection and names the integration, its workspace, the API version and whether the cell writes.
The token
- The token rides only the
Authorization: Bearerheader, never a URL or a request body, and only overhttps://or to this machine. - Every answer and every refusal has the token scrubbed out, so an error that echoes it cannot carry it into the conversation.
- With no token the cell refuses before any request and says how to make one. A rejected token (401), a page the integration cannot see (404, with how to share it), a missing capability (403) and a rate limit (429) each say what to do.
- What the cell can reach is exactly what was shared with the integration.
read_onlystops this cell's writes; an integration without write capabilities stops them at Notion.
Test
.github/test-cell.sh tools/nodecode-notion
The tests run offline: nlk:http is stubbed to answer by method and URL, so ids read from URLs, each tool's request, the token's header and its scrubbing, the refusals, property and block rendering, markdown into blocks, chunked appends and read_only are asserted with no network.
License
MIT. See LICENSE. Notion is a hosted service; none of its code is included.