
Transform complex Notion API interactions into simple, Pythonic code. Perfect for developers building AI agents, automation workflows, and dynamic content systems.
- AI-Native Design - Built specifically for AI agents with schema-driven markdown syntax
- Smart Discovery - Find pages and databases by name with fuzzy matching—no more hunting for IDs
- Extended Markdown - Rich syntax for toggles, columns, callouts, and media uploads
- Async-First - Modern Python with full async/await support and high performance
- Round-Trip - Read existing content, modify it, and write it back while preserving formatting
- Complete Coverage - Every Notion block type supported with type safety
pip install notionary
Set up your Notion integration and configure your token:
export NOTION_SECRET=your_integration_key
create_page_in_database_demo.mp4
Create styled project pages with properties, content, and rich formatting
upload_local_files.mp4
Upload videos and images using simple markdown syntax - files are automatically uploaded to Notion
import asyncio
from notionary import NotionPage, NotionDatabase
async def main():
# Find pages by name - fuzzy matching included!
page = await NotionPage.from_title("Meeting Notes")
# Option 1: Direct Extended Markdown
await page.append_markdown("""
## Action Items
- [x] Review project proposal
- [ ] Schedule team meeting
- [ ] Update documentation
[callout](Meeting decisions require follow-up "💡")
+++ Details
Additional context and next steps...
+++
""")
# Option 2: Type-Safe Builder (maps to same markdown internally)
await page.append_markdown(lambda builder: (
builder
.h2("Project Status")
.callout("Milestone reached!", "🎉")
.columns(
lambda col: col.h3("Completed").bulleted_list([
"API design", "Database setup", "Authentication"
]),
lambda col: col.h3("In Progress").bulleted_list([
"Frontend UI", "Testing", "Documentation"
]),
width_ratios=[0.6, 0.4]
)
.toggle("Budget Details", lambda t: t
.table(["Item", "Cost", "Status"], [
["Development", "$15,000", "Paid"],
["Design", "$8,000", "Pending"]
])
)
))
asyncio.run(main())
Every Notion block type with extended syntax:
Block Type | Markdown Syntax | Use Case |
---|---|---|
Callouts | [callout](Text "🔥") |
Highlighting key information |
Toggles | +++ Title\nContent\n+++ |
Collapsible sections |
Columns | ::: columns\n::: column\nContent\n:::\n::: |
Side-by-side layouts |
Tables | Standard markdown tables | Structured data |
Media | [video](./file.mp4)(caption:Description) |
Auto-uploading files |
Code | Standard code fences with captions | Code snippets |
Equations | $LaTeX$ |
Mathematical expressions |
TOC | [toc](blue_background) |
Auto-generated navigation |
- Report Generation: AI agents that create structured reports, documentation, and analysis
- Content Pipelines: Automated workflows that process data and generate Notion pages
- Knowledge Management: AI-powered documentation systems with smart categorization
- Project Management: Sync project status, update timelines, generate progress reports
- Data Integration: Connect external APIs and databases to Notion workspaces
- Template Systems: Dynamic page generation from templates and data sources
- Bulk Operations: Mass page updates, content migration, and database management
- Media Handling: Automated image/video uploads with proper organization
- Cross-Platform: Sync content between Notion and other platforms
|
|
mathisarends.github.io/notionary - Complete API reference, guides, and tutorials
- Getting Started - Setup and first steps
- Page Management - Content and properties
- Database Operations - Queries and management
- Block Types Reference - Complete syntax guide
Core Functionality:
- Page Management - Create, update, and manage pages
- Database Operations - Connect and query databases
- Workspace Discovery - Explore your workspace
Extended Markdown:
- Basic Formatting - Text, lists, and links
- Callouts & Highlights - Information boxes
- Toggle Sections - Collapsible content
- Multi-Column Layouts - Side-by-side design
- Tables & Data - Structured presentations
We welcome contributions from the community! Whether you're:
- Fixing bugs - Help improve stability and reliability
- Adding features - Extend functionality for new use cases
- Improving docs - Make the library more accessible
- Sharing examples - Show creative applications and patterns
Check our Contributing Guide to get started.
Ready to revolutionize your Notion workflows?
📖 Read the Docs • 🚀 Getting Started • 💻 Browse Examples
Built with ❤️ for Python developers and AI agents
Transform complex Notion API interactions into simple, powerful code.