The Notion extension provides read-only access to your Notion workspace via the Notion REST API. This allows Baudbot agents to search for documentation, retrieve specifications, and query project databases during development work.
- Go to Notion → My integrations
- Click "+ New integration"
- Give it a name (e.g., "Baudbot Agent")
- Select the workspace where your documentation lives
- Set capabilities to Read content only (no write access needed)
- Submit and copy the Internal Integration Token (starts with
secret_)
The integration can only access pages and databases explicitly shared with it:
- Navigate to the page or database you want the agent to access
- Click "•••" (top right) → Add connections
- Select your integration from the list
- The integration now has read access to that page and all its child pages
Tip: Share a top-level workspace page to give access to all nested documentation.
Add the integration token to ~/.config/.env:
NOTION_API_KEY=secret_abc123...Restart the control-agent to load the extension:
sudo baudbot stop
sudo baudbot startThe notion tool provides four actions:
Find content by text query or filter by type:
notion({
action: "search",
query: "deployment", // optional search text
filter: "page", // optional: "page" or "database"
limit: 20 // optional, default 20, max 100
})Returns a list of matching pages/databases with titles, URLs, and last-edited dates.
Example output:
Found 3 result(s):
📄 How to deploy a new service
URL: https://notion.so/How-to-deploy-...
Last edited: 2026-02-15
🗂️ Deployment Tracker
URL: https://notion.so/Deployment-Tracker-...
Last edited: 2026-02-20
📄 CI/CD Pipeline Overview
URL: https://notion.so/CI-CD-Pipeline-...
Last edited: 2026-01-10
Retrieve complete page content with all blocks formatted as markdown:
notion({
action: "get",
page_id: "303d77b00f4480f9973fdcdd869caa94" // from URL or search results
})Page ID extraction:
- URL:
https://notion.so/Page-Title-303d77b00f4480f9973fdcdd869caa94 - Page ID:
303d77b00f4480f9973fdcdd869caa94(last 32 hex characters)
The tool accepts IDs with or without hyphens.
Supported block types:
- Text blocks: paragraphs, headings (H1-H3), quotes
- Lists: bulleted, numbered, to-do (with checkboxes)
- Code blocks with syntax highlighting
- Callouts with emoji icons
- Toggles, dividers, breadcrumbs
- Child pages and databases (linked)
- Media: images, videos, files, PDFs, bookmarks, embeds
- Nested content (fetched up to 1 level deep)
Example output:
# API Authentication Guide
URL: https://notion.so/...
Last edited: 2026-02-20T15:30:00.000Z
## Overview
Our API uses JWT bearer tokens for authentication.
## Getting a Token
1. Log in to the dashboard
2. Navigate to Settings → API Keys
3. Click "Generate New Key"
⚠️ Keep your API key secret. Never commit it to version control.
## Making Requests
```bash
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.example.com/v1/resource
- 1000 requests per hour per token
- 10 requests per second burst limit
### Query database entries
List database rows with filtering and sorting:
```typescript
notion({
action: "list",
database_id: "abc123...",
filter: '{"property": "Status", "status": {"equals": "In Progress"}}', // optional JSON
sorts: '[{"property": "Created", "direction": "descending"}]', // optional JSON
limit: 20
})
The filter and sorts parameters accept JSON strings matching Notion's database query format.
Example output:
5 entries:
📄 Fix login timeout bug
Status: In Progress | Priority: High | Assignee: Alice
URL: https://notion.so/...
📄 Add export feature
Status: In Progress | Priority: Medium | Assignee: Bob
URL: https://notion.so/...
📄 Update documentation
Status: In Progress | Priority: Low | Assignee: Carol
URL: https://notion.so/...
Inspect database structure and property types:
notion({
action: "database",
database_id: "abc123..."
})Example output:
🗂️ Project Tasks
URL: https://notion.so/...
Properties:
- Name (title)
- Status (status)
- Priority (select)
- Assignee (people)
- Due Date (date)
- Tags (multi_select)
- Completed (checkbox)
Control-agent can retrieve setup guides, API references, and runbooks during task execution:
// Agent searches for deployment docs
notion({ action: "search", query: "kubernetes deployment" })
// Retrieves the specific guide
notion({ action: "get", page_id: "..." })Dev-agents can read specifications and architecture decision records:
// Find the PRD for the feature being worked on
notion({ action: "search", query: "user authentication PRD" })
// Read the full specification
notion({ action: "get", page_id: "..." })Query project databases for context on work items:
// Check current sprint tasks
notion({
action: "list",
database_id: "...",
filter: '{"property": "Sprint", "select": {"equals": "Sprint 23"}}'
})
// Get database structure for custom queries
notion({ action: "database", database_id: "..." })The integration provides read access only. The agent cannot:
- Create new pages or databases
- Update existing content
- Delete pages
- Add comments or mentions
This is intentional — documentation changes should go through human review.
Notion's API has rate limits:
- 3 requests per second per integration
- Burst allowance for occasional spikes
The extension does not implement request throttling. If you hit rate limits, the tool will return an error. Control-agent should wait and retry.
Query results are limited to 100 items per request. The extension does not handle pagination automatically. For large databases:
- Use filters to narrow results
- Or make multiple queries with different filter criteria
Child blocks are fetched only 1 level deep. If your pages have deeply nested content (e.g., toggles within toggles within toggles), the deepest levels won't be included.
To retrieve deep content:
- Flatten your documentation structure
- Or make multiple
getcalls for child pages
The integration can only see pages and databases explicitly shared with it. If the agent can't find a page:
- Verify the page exists and isn't archived
- Check that the integration has been added to the page via Add connections
- Check parent page permissions (child pages inherit access)
The NOTION_API_KEY is stored in ~/.config/.env with 600 permissions (readable only by the baudbot_agent user and root).
Only share the minimum necessary documentation with the integration:
- Don't share your entire workspace unless needed
- Share specific docs or a dedicated "Engineering Docs" section
- Review shared pages periodically
Notion's workspace settings include an audit log showing all integration access. Review this regularly to ensure the agent is only accessing expected pages.
The environment variable is missing or empty. Verify:
- Token is in
~/.config/.env - No typos in the variable name
- Agent was restarted after adding the token
The token is invalid or expired. Generate a new integration token and update .env.
The page or database ID is incorrect, or the integration doesn't have access. Verify:
- Page ID is correct (32 hex characters from the URL)
- Page isn't archived
- Integration has been added to the page
Too many requests in a short period. The agent should wait 60 seconds before retrying.
The integration can't see the pages. Make sure:
- Pages are shared with the integration
- Pages aren't in the trash
- Search query matches page titles or content
For advanced use cases, refer to Notion's official API documentation.
Scenario: Dev-agent needs to understand authentication before implementing a feature.
// Search for auth docs
notion({ action: "search", query: "API authentication" })
// Read the guide
notion({ action: "get", page_id: "abc123..." })Scenario: Before implementing, verify the feature isn't already described elsewhere.
// Search for existing work
notion({ action: "search", query: "payment processing" })
// Review each result
notion({ action: "get", page_id: "..." })Scenario: Control-agent checks upcoming priorities before allocating work.
// Get all high-priority items
notion({
action: "list",
database_id: "...",
filter: '{"property": "Priority", "select": {"equals": "High"}}',
sorts: '[{"property": "Due Date", "direction": "ascending"}]'
})If you add capabilities to the Notion extension (e.g., write operations, pagination, deeper nesting), update this documentation and submit a PR.
See CONTRIBUTING.md for guidelines.