返回顶部
s

siyuan-api

Local SiYuan API integration for notebook/document/block/asset operations and SQL search. Uses only local HTTP endpoints and environment-based token auth.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.4.3
安全检测
已通过
240
下载量
1
收藏
概述
安装方式
版本历史

siyuan-api

# SiYuan Skill 本技能用于调用本地运行的 SiYuan HTTP API,支持笔记本、文档、块、资源、SQL 查询等常见操作。 它只描述调用规范和示例,不包含可执行安装脚本或第三方依赖。 ## Security Scope - Only call local SiYuan endpoint (`127.0.0.1`, `localhost`, or user-provided local URL). - Do not send requests to third-party internet endpoints. - Never hardcode or print `SIYUAN_API_TOKEN` in logs. - This skill has read/write authority over your SiYuan notes. Use only in trusted local environments. ## Configuration Configuration can be provided via environment variables in your shell, for example: ```bash export SIYUAN_API_TOKEN=your_token_here export SIYUAN_API_URL=http://127.0.0.1:6806 ``` - `SIYUAN_API_TOKEN` (required): from SiYuan `Settings > About`. - `SIYUAN_API_URL` (optional): defaults to `http://127.0.0.1:6806`. ## Typical Use Cases - Create, rename, and remove notebooks - Create documents from Markdown - Insert, append, update, move, and delete blocks - Upload assets - Query notes by SQL - Export documents as Markdown - Read/write workspace files through SiYuan file APIs ## API References - [references/api-zh.md](references/api-zh.md) (Chinese) - [references/api.md](references/api.md) (English) ## Common Examples ### List Notebooks ```javascript const SIYUAN_API_TOKEN = process.env.SIYUAN_API_TOKEN; const SIYUAN_API_URL = process.env.SIYUAN_API_URL || 'http://127.0.0.1:6806'; fetch(`${SIYUAN_API_URL}/api/notebook/lsNotebooks`, { method: 'POST', headers: { 'Authorization': 'token ' + SIYUAN_API_TOKEN, 'Content-Type': 'application/json' }, body: JSON.stringify({}) }) ``` ### Create Document with Markdown ```javascript const SIYUAN_API_TOKEN = process.env.SIYUAN_API_TOKEN; const SIYUAN_API_URL = process.env.SIYUAN_API_URL || 'http://127.0.0.1:6806'; fetch(`${SIYUAN_API_URL}/api/filetree/createDocWithMd`, { method: 'POST', headers: { 'Authorization': 'token ' + SIYUAN_API_TOKEN, 'Content-Type': 'application/json' }, body: JSON.stringify({ notebook: '笔记本ID', path: '/文档路径', markdown: '# 文档标题\n\n正文内容...' }) }) ``` ### Append Block ```javascript const SIYUAN_API_TOKEN = process.env.SIYUAN_API_TOKEN; const SIYUAN_API_URL = process.env.SIYUAN_API_URL || 'http://127.0.0.1:6806'; fetch(`${SIYUAN_API_URL}/api/block/appendBlock`, { method: 'POST', headers: { 'Authorization': 'token ' + SIYUAN_API_TOKEN, 'Content-Type': 'application/json' }, body: JSON.stringify({ parentID: '父块ID', dataType: 'markdown', data: '追加的内容' }) }) ``` ### SQL Query ```javascript const SIYUAN_API_TOKEN = process.env.SIYUAN_API_TOKEN; const SIYUAN_API_URL = process.env.SIYUAN_API_URL || 'http://127.0.0.1:6806'; fetch(`${SIYUAN_API_URL}/api/query/sql`, { method: 'POST', headers: { 'Authorization': 'token ' + SIYUAN_API_TOKEN, 'Content-Type': 'application/json' }, body: JSON.stringify({ stmt: 'SELECT id, content FROM blocks WHERE content LIKE "%关键词%" LIMIT 10' }) }) ``` ## Notes - Repeated `createDocWithMd` on the same path does not overwrite existing documents. - Custom block attributes must be prefixed with `custom-`. - All endpoints use `POST` and return `{ code, msg, data }`. - Header format is `Authorization: token <your-token>` (lowercase `token`).

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 siyuan-api-1776101530 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 siyuan-api-1776101530 技能

通过命令行安装

skillhub install siyuan-api-1776101530

下载 Zip 包

⬇ 下载 siyuan-api v1.4.3

文件大小: 16.19 KB | 发布时间: 2026-4-14 10:19

v1.4.3 最新 2026-4-14 10:19
fix bug

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部