An n8n community node package for SiYuan, the privacy-first personal knowledge base. Manage notebooks, documents, blocks, tags, assets, and more — all from your n8n workflows.
Designed for AI agent workflows. Includes dedicated AI Tool nodes that n8n AI agents can call directly, plus a polling Trigger node for reactive workflows.
Navigation
- Installation
- Nodes
- Credentials
- Operations Reference
- AI Agent Usage
- Trigger Node
- Example Workflows
- Compatibility
- Troubleshooting
- Resources
- Version History
- Contributing
- Go to Settings > Community Nodes in your n8n instance.
- Select Install.
- Enter
n8n-nodes-siyuanin the search box. - Click the Install button.
Alternatively, follow the generic installation guide in the n8n community nodes documentation.
Note for AI Tool usage: You may need to set the environment variable
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=trueon your n8n instance to use the AI Tool nodes with n8n's AI Agent.
This package provides 7 nodes:
| Node | Type | Purpose |
|---|---|---|
| SiYuan | Action | Full-featured node with all 56 operations across 8 resources |
| SiYuan Document Tool | AI Tool | Focused document operations for AI agents |
| SiYuan Block Tool | AI Tool | Focused block operations for AI agents |
| SiYuan Search Tool | AI Tool | Focused search/query operations for AI agents |
| SiYuan Notebook Tool | AI Tool | Focused notebook operations for AI agents |
| SiYuan Trigger | Trigger | Polls for document/block changes to start workflows |
To connect to your SiYuan instance:
- In SiYuan: Go to Settings > About > API Token. Copy the token.
- In n8n: Go to Credentials > Add credential > SiYuan API.
- Enter your API URL (default:
http://127.0.0.1:6806). - Paste your API Token.
- Click Test to verify the connection, then Save.
All nodes in this package share the same credential.
| Operation | Description |
|---|---|
| Create | Create a new empty notebook |
| List | List all notebooks with IDs and names |
| Rename | Change a notebook's name |
| Remove | Permanently delete a notebook (irreversible) |
| Open | Open a closed notebook |
| Close | Close an open notebook |
| Get Configuration | Retrieve notebook settings |
| Set Configuration | Update notebook settings |
| Operation | Description |
|---|---|
| Create | Create a document with Markdown content |
| Rename | Change a document's title |
| Remove | Permanently delete a document |
| Move | Move a document to another notebook or parent |
| Get ID by Path | Find document ID from human-readable path |
| Get Path by ID | Get human-readable path from document ID |
| Get Storage Path by ID | Get internal storage path |
| Get Readable Path from Storage Path | Convert storage path to readable path |
| List in Notebook | List all documents in a notebook |
| Export Markdown | Export document as Markdown with path |
| Get Content | Get full Markdown content (ideal for AI agents) |
| Get Document Tree | Get hierarchical block structure |
| Operation | Description |
|---|---|
| Append | Add content to end of a block |
| Prepend | Add content to beginning of a block |
| Insert | Insert content before/after a block |
| Update | Replace block content |
| Delete | Remove a block |
| Move | Move a block to a new position |
| Fold | Collapse a block |
| Unfold | Expand a block |
| Get Kramdown | Get raw Kramdown source |
| Get Content (Markdown) | Get clean Markdown content |
| Get Child Blocks | List direct children |
| Transfer References | Transfer references between blocks |
| Operation | Description |
|---|---|
| Get | Retrieve all attributes for a block |
| Set | Set custom (custom-*) or built-in attributes |
| Operation | Description |
|---|---|
| Add | Add a tag to a block |
| Remove | Remove a tag from a block |
| Get Tags for Block | List all tags on a block |
| List All | List all unique tags with counts |
| Rename | Rename a tag across all blocks |
| Find Blocks by Tag | Find all blocks with a specific tag |
| Operation | Description |
|---|---|
| Full-Text Search | Search all blocks by keywords |
| SQL Query | Run custom SQL against the SiYuan database |
| Search by Attribute | Find blocks by attribute name/value |
| Get Recent Changes | List recently modified documents |
| Operation | Description |
|---|---|
| Upload Asset | Upload a file (image, PDF, etc.) to SiYuan |
| Get File | Retrieve file content |
| Put File | Create or overwrite a file |
| Remove File | Delete a file |
| Rename File | Rename/move a file |
| List Files in Directory | List files in a workspace directory |
| Operation | Description |
|---|---|
| Get Version | Get SiYuan version |
| Get Current Time | Get server time in milliseconds |
| Push Message | Show a notification in SiYuan |
| Push Error Message | Show an error notification |
| Render Sprig Template | Process a Sprig template string |
| Export Resources | Export files/folders as a zip |
Real SiYuan database (AttributeView) CRUD via the /api/av/* endpoints. Use this for the :::database blocks you can insert in the SiYuan editor.
| Operation | Description |
|---|---|
| List | List all database (AttributeView) blocks in the workspace |
| Create | Append a new empty database block to a parent block |
| Get | Get the full schema and rows of a database |
| Get Schema | Get only the column definitions (no rows) |
| Add Row | Add a new detached row to a database |
| Remove Row | Remove a row by its row ID |
| Add Column | Add a column. Types: text, number, date, select, multi-select, checkbox, url, email, phone |
| Remove Column | Remove a column by its key ID |
| Set Cell | Set the value of a cell, with automatic type coercion |
Plain Markdown table CRUD — operates on standard pipe-delimited tables (\| col \| col \|). Use this when you want simple text tables rather than a real SiYuan database.
| Operation | Description |
|---|---|
| Create | Append a new empty Markdown table to a parent block |
| Get | Parse and return the structure and data of a Markdown table |
| Add Row | Append a row to the table |
| Update Row | Replace a row by its 0-based row index |
| Delete Row | Remove a row by its 0-based row index |
This package includes 4 AI Tool nodes designed for use with n8n's AI Agent node:
- SiYuan Document Tool — Create, read, list, and manage documents
- SiYuan Block Tool — Create, read, update, move, and delete blocks
- SiYuan Search Tool — Full-text search, SQL queries, tag search, attribute search
- SiYuan Notebook Tool — Create, list, rename, and delete notebooks
- Add an AI Agent node to your workflow.
- Connect one or more SiYuan Tool nodes to the agent's "tools" input.
- Configure each tool node with your SiYuan credentials.
- The agent will automatically choose which tool to call based on the user's request.
The AI Tool nodes have descriptions optimized for agent comprehension. For example:
- When an agent needs to store information, it will use the Document Tool's "create" operation.
- When an agent needs to find information, it will use the Search Tool's "fullText" operation.
- When an agent needs to update content, it will use the Block Tool's "update" operation.
The main SiYuan node also has usableAsTool: true, making all 56 operations available to agents as a single comprehensive tool.
The SiYuan Trigger node starts workflows when content changes in SiYuan.
| Parameter | Description |
|---|---|
| Event | "Document Changed" or "Block Changed" |
| Notebook ID | (Optional) Only trigger for a specific notebook |
| Max Results Per Poll | Maximum items per poll (default: 50) |
The trigger uses n8n's native polling mechanism. Set the polling interval in your workflow settings.
Each trigger event outputs the full block/document data including:
id— The block or document IDroot_id— The parent document IDtype— Block type (dfor document,pfor paragraph, etc.)content— The text contentupdated— Timestamp of the changebox— The notebook ID
Webhook/Chat → AI Agent → SiYuan Search Tool (find info)
→ SiYuan Document Tool (create/update docs)
→ SiYuan Block Tool (add/modify content)
Webhook (external data) → Transform → SiYuan (create document)
→ SiYuan (add tags)
SiYuan Trigger (doc changed) → SiYuan (export markdown) → HTTP Request (sync to external)
Schedule → SiYuan (list docs) → AI Agent (analyze & categorize)
→ SiYuan (add tags)
→ SiYuan (move docs)
- Minimum n8n version: v1.22.0+
- Node.js: v18.10+
- SiYuan: Developed against the SiYuan API. Compatible with recent SiYuan versions.
| Problem | Solution |
|---|---|
| "Cannot connect to SiYuan" | Ensure SiYuan is running and the API URL is correct |
| "Authentication failed" | Check your API token in Settings > About > API Token |
| "Request timed out" | Verify the API URL and that SiYuan is accessible from your n8n instance |
| Error | Solution |
|---|---|
| "Block not found" | Verify the block ID exists using Search > SQL Query |
| "Notebook not found" | Use Notebook > List to find valid notebook IDs |
| Invalid path errors | Ensure paths start with / (e.g., /My Notes/Topic) |
If the AI Tool nodes don't appear in the agent's tool selection, set the environment variable:
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
- n8n Community Nodes Documentation
- SiYuan API Documentation
- SiYuan User Guide
- Project Repository
- Report Issues
See CHANGELOG.md for the full version history.
Contributions, issues, and feature requests are welcome! Please check the issues page.
