[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71Q7JDN87DFTBW17B0SSXWX":3,"skill-same:01M71Q7JDN87DFTBW17B0SSXWX":98},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":47,"linkOnly":48,"markdownContent":49,"markdownBody":50,"frontMatter":51,"refName":78,"commitSha":79,"skillDirectory":80,"forksCount":13,"repositoryHtmlUrl":81,"repositoryHomepageUrl":6,"ownerHtmlUrl":82,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":83,"install":84,"resources":97},"01M71Q7JDN87DFTBW17B0SSXWX","siyuan",null,"SiYuan Note API for searching, reading, creating, and managing blocks and documents in a self-hosted knowledge base via curl.","gjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN","gjbvsjjvgm-sketch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F278511911?v=4","01M71F3JXKZQ70H2KCHHTXKZDA","01M71PENEVFN19DBZFNHJPCHQ7",0,"MIT","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[5,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"URL","for","self-hosted","pkm","reading","token","knowledge base","notes","self","api","documents","desktop app","remote","knowledge","obsidian","default","notion","instances","app","2026-11-10 13:02:02",false,"---\nname: siyuan\ndescription: SiYuan Note API for searching, reading, creating, and managing blocks and documents in a self-hosted knowledge base via curl.\nversion: 1.0.0\nauthor: FEUAZUR\nlicense: MIT\nmetadata:\n  hermes:\n    tags: [SiYuan, Notes, Knowledge Base, PKM, API]\n    related_skills: [obsidian, notion]\n    homepage: https:\u002F\u002Fgithub.com\u002Fsiyuan-note\u002Fsiyuan\nprerequisites:\n  env_vars: [SIYUAN_TOKEN]\n  commands: [curl, jq]\nrequired_environment_variables:\n  - name: SIYUAN_TOKEN\n    prompt: SiYuan API token\n    help: \"Settings > About in SiYuan desktop app\"\n  - name: SIYUAN_URL\n    prompt: SiYuan instance URL (default http:\u002F\u002F127.0.0.1:6806)\n    required_for: remote instances\n---\n\n# SiYuan Note API\n\nUse the [SiYuan](https:\u002F\u002Fgithub.com\u002Fsiyuan-note\u002Fsiyuan) kernel API via curl to search, read, create, update, and delete blocks and documents in a self-hosted knowledge base. No extra tools needed -- just curl and an API token.\n\n## Prerequisites\n\n1. Install and run SiYuan (desktop or Docker)\n2. Get your API token: **Settings > About > API token**\n3. Store it in `~\u002F.hermes\u002F.env`:\n   ```\n   SIYUAN_TOKEN=your_token_here\n   SIYUAN_URL=http:\u002F\u002F127.0.0.1:6806\n   ```\n   `SIYUAN_URL` defaults to `http:\u002F\u002F127.0.0.1:6806` if not set.\n\n## API Basics\n\nAll SiYuan API calls are **POST with JSON body**. Every request follows this pattern:\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002F...\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"param\": \"value\"}'\n```\n\nResponses are JSON with this structure:\n```json\n{\"code\": 0, \"msg\": \"\", \"data\": { ... }}\n```\n`code: 0` means success. Any other value is an error -- check `msg` for details.\n\n**ID format:** SiYuan IDs look like `20210808180117-6v0mkxr` (14-digit timestamp + 7 alphanumeric chars).\n\n## Quick Reference\n\n| Operation | Endpoint |\n|-----------|----------|\n| Full-text search | `\u002Fapi\u002Fsearch\u002FfullTextSearchBlock` |\n| SQL query | `\u002Fapi\u002Fquery\u002Fsql` |\n| Read block | `\u002Fapi\u002Fblock\u002FgetBlockKramdown` |\n| Read children | `\u002Fapi\u002Fblock\u002FgetChildBlocks` |\n| Get path | `\u002Fapi\u002Ffiletree\u002FgetHPathByID` |\n| Get attributes | `\u002Fapi\u002Fattr\u002FgetBlockAttrs` |\n| List notebooks | `\u002Fapi\u002Fnotebook\u002FlsNotebooks` |\n| List documents | `\u002Fapi\u002Ffiletree\u002FlistDocsByPath` |\n| Create notebook | `\u002Fapi\u002Fnotebook\u002FcreateNotebook` |\n| Create document | `\u002Fapi\u002Ffiletree\u002FcreateDocWithMd` |\n| Append block | `\u002Fapi\u002Fblock\u002FappendBlock` |\n| Update block | `\u002Fapi\u002Fblock\u002FupdateBlock` |\n| Rename document | `\u002Fapi\u002Ffiletree\u002FrenameDocByID` |\n| Set attributes | `\u002Fapi\u002Fattr\u002FsetBlockAttrs` |\n| Delete block | `\u002Fapi\u002Fblock\u002FdeleteBlock` |\n| Delete document | `\u002Fapi\u002Ffiletree\u002FremoveDocByID` |\n| Export as Markdown | `\u002Fapi\u002Fexport\u002FexportMdContent` |\n\n## Common Operations\n\n### Search (Full-Text)\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fsearch\u002FfullTextSearchBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"query\": \"meeting notes\", \"page\": 0}' | jq '.data.blocks[:5]'\n```\n\n### Search (SQL)\n\nQuery the blocks database directly. Only SELECT statements are safe.\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fquery\u002Fsql\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"stmt\": \"SELECT id, content, type, box FROM blocks WHERE content LIKE '\\''%keyword%'\\'' AND type='\\''p'\\'' LIMIT 20\"}' | jq '.data'\n```\n\nUseful columns: `id`, `parent_id`, `root_id`, `box` (notebook ID), `path`, `content`, `type`, `subtype`, `created`, `updated`.\n\n### Read Block Content\n\nReturns block content in Kramdown (Markdown-like) format.\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FgetBlockKramdown\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data.kramdown'\n```\n\n### Read Child Blocks\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FgetChildBlocks\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data'\n```\n\n### Get Human-Readable Path\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FgetHPathByID\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data'\n```\n\n### Get Block Attributes\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fattr\u002FgetBlockAttrs\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data'\n```\n\n### List Notebooks\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fnotebook\u002FlsNotebooks\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{}' | jq '.data.notebooks[] | {id, name, closed}'\n```\n\n### List Documents in a Notebook\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FlistDocsByPath\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"notebook\": \"NOTEBOOK_ID\", \"path\": \"\u002F\"}' | jq '.data.files[] | {id, name}'\n```\n\n### Create a Document\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FcreateDocWithMd\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"notebook\": \"NOTEBOOK_ID\",\n    \"path\": \"\u002FMeeting Notes\u002F2026-03-22\",\n    \"markdown\": \"# Meeting Notes\\n\\n- Discussed project timeline\\n- Assigned tasks\"\n  }' | jq '.data'\n```\n\n### Create a Notebook\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fnotebook\u002FcreateNotebook\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"My New Notebook\"}' | jq '.data.notebook.id'\n```\n\n### Append Block to Document\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FappendBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"parentID\": \"DOCUMENT_OR_BLOCK_ID\",\n    \"data\": \"New paragraph added at the end.\",\n    \"dataType\": \"markdown\"\n  }' | jq '.data'\n```\n\nAlso available: `\u002Fapi\u002Fblock\u002FprependBlock` (same params, inserts at the beginning) and `\u002Fapi\u002Fblock\u002FinsertBlock` (uses `previousID` instead of `parentID` to insert after a specific block).\n\n### Update Block Content\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FupdateBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"id\": \"BLOCK_ID\",\n    \"data\": \"Updated content here.\",\n    \"dataType\": \"markdown\"\n  }' | jq '.data'\n```\n\n### Rename a Document\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FrenameDocByID\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"DOCUMENT_ID\", \"title\": \"New Title\"}'\n```\n\n### Set Block Attributes\n\nCustom attributes must be prefixed with `custom-`:\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fattr\u002FsetBlockAttrs\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"id\": \"BLOCK_ID\",\n    \"attrs\": {\n      \"custom-status\": \"reviewed\",\n      \"custom-priority\": \"high\"\n    }\n  }'\n```\n\n### Delete a Block\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FdeleteBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"BLOCK_ID\"}'\n```\n\nTo delete a whole document: use `\u002Fapi\u002Ffiletree\u002FremoveDocByID` with `{\"id\": \"DOC_ID\"}`.\nTo delete a notebook: use `\u002Fapi\u002Fnotebook\u002FremoveNotebook` with `{\"notebook\": \"NOTEBOOK_ID\"}`.\n\n### Export Document as Markdown\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fexport\u002FexportMdContent\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"DOCUMENT_ID\"}' | jq -r '.data.content'\n```\n\n## Block Types\n\nCommon `type` values in SQL queries:\n\n| Type | Description |\n|------|-------------|\n| `d` | Document (root block) |\n| `p` | Paragraph |\n| `h` | Heading |\n| `l` | List |\n| `i` | List item |\n| `c` | Code block |\n| `m` | Math block |\n| `t` | Table |\n| `b` | Blockquote |\n| `s` | Super block |\n| `html` | HTML block |\n\n## Pitfalls\n\n- **All endpoints are POST** -- even read-only operations. Do not use GET.\n- **SQL safety**: only use SELECT queries. INSERT\u002FUPDATE\u002FDELETE\u002FDROP are dangerous and should never be sent.\n- **ID validation**: IDs match the pattern `YYYYMMDDHHmmss-xxxxxxx`. Reject anything else.\n- **Error responses**: always check `code != 0` in responses before processing `data`.\n- **Large documents**: block content and export results can be very large. Use `LIMIT` in SQL and pipe through `jq` to extract only what you need.\n- **Notebook IDs**: when working with a specific notebook, get its ID first via `lsNotebooks`.\n\n## Alternative: MCP Server\n\nIf you prefer a native integration instead of curl, install the SiYuan MCP server:\n\n```yaml\n# In ~\u002F.hermes\u002Fconfig.yaml under mcp_servers:\nmcp_servers:\n  siyuan:\n    command: npx\n    args: [\"-y\", \"@porkll\u002Fsiyuan-mcp\"]\n    env:\n      SIYUAN_TOKEN: \"your_token\"\n      SIYUAN_URL: \"http:\u002F\u002F127.0.0.1:6806\"\n```\n","# SiYuan Note API\n\nUse the [SiYuan](https:\u002F\u002Fgithub.com\u002Fsiyuan-note\u002Fsiyuan) kernel API via curl to search, read, create, update, and delete blocks and documents in a self-hosted knowledge base. No extra tools needed -- just curl and an API token.\n\n## Prerequisites\n\n1. Install and run SiYuan (desktop or Docker)\n2. Get your API token: **Settings > About > API token**\n3. Store it in `~\u002F.hermes\u002F.env`:\n   ```\n   SIYUAN_TOKEN=your_token_here\n   SIYUAN_URL=http:\u002F\u002F127.0.0.1:6806\n   ```\n   `SIYUAN_URL` defaults to `http:\u002F\u002F127.0.0.1:6806` if not set.\n\n## API Basics\n\nAll SiYuan API calls are **POST with JSON body**. Every request follows this pattern:\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002F...\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"param\": \"value\"}'\n```\n\nResponses are JSON with this structure:\n```json\n{\"code\": 0, \"msg\": \"\", \"data\": { ... }}\n```\n`code: 0` means success. Any other value is an error -- check `msg` for details.\n\n**ID format:** SiYuan IDs look like `20210808180117-6v0mkxr` (14-digit timestamp + 7 alphanumeric chars).\n\n## Quick Reference\n\n| Operation | Endpoint |\n|-----------|----------|\n| Full-text search | `\u002Fapi\u002Fsearch\u002FfullTextSearchBlock` |\n| SQL query | `\u002Fapi\u002Fquery\u002Fsql` |\n| Read block | `\u002Fapi\u002Fblock\u002FgetBlockKramdown` |\n| Read children | `\u002Fapi\u002Fblock\u002FgetChildBlocks` |\n| Get path | `\u002Fapi\u002Ffiletree\u002FgetHPathByID` |\n| Get attributes | `\u002Fapi\u002Fattr\u002FgetBlockAttrs` |\n| List notebooks | `\u002Fapi\u002Fnotebook\u002FlsNotebooks` |\n| List documents | `\u002Fapi\u002Ffiletree\u002FlistDocsByPath` |\n| Create notebook | `\u002Fapi\u002Fnotebook\u002FcreateNotebook` |\n| Create document | `\u002Fapi\u002Ffiletree\u002FcreateDocWithMd` |\n| Append block | `\u002Fapi\u002Fblock\u002FappendBlock` |\n| Update block | `\u002Fapi\u002Fblock\u002FupdateBlock` |\n| Rename document | `\u002Fapi\u002Ffiletree\u002FrenameDocByID` |\n| Set attributes | `\u002Fapi\u002Fattr\u002FsetBlockAttrs` |\n| Delete block | `\u002Fapi\u002Fblock\u002FdeleteBlock` |\n| Delete document | `\u002Fapi\u002Ffiletree\u002FremoveDocByID` |\n| Export as Markdown | `\u002Fapi\u002Fexport\u002FexportMdContent` |\n\n## Common Operations\n\n### Search (Full-Text)\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fsearch\u002FfullTextSearchBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"query\": \"meeting notes\", \"page\": 0}' | jq '.data.blocks[:5]'\n```\n\n### Search (SQL)\n\nQuery the blocks database directly. Only SELECT statements are safe.\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fquery\u002Fsql\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"stmt\": \"SELECT id, content, type, box FROM blocks WHERE content LIKE '\\''%keyword%'\\'' AND type='\\''p'\\'' LIMIT 20\"}' | jq '.data'\n```\n\nUseful columns: `id`, `parent_id`, `root_id`, `box` (notebook ID), `path`, `content`, `type`, `subtype`, `created`, `updated`.\n\n### Read Block Content\n\nReturns block content in Kramdown (Markdown-like) format.\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FgetBlockKramdown\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data.kramdown'\n```\n\n### Read Child Blocks\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FgetChildBlocks\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data'\n```\n\n### Get Human-Readable Path\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FgetHPathByID\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data'\n```\n\n### Get Block Attributes\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fattr\u002FgetBlockAttrs\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"20210808180117-6v0mkxr\"}' | jq '.data'\n```\n\n### List Notebooks\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fnotebook\u002FlsNotebooks\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{}' | jq '.data.notebooks[] | {id, name, closed}'\n```\n\n### List Documents in a Notebook\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FlistDocsByPath\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"notebook\": \"NOTEBOOK_ID\", \"path\": \"\u002F\"}' | jq '.data.files[] | {id, name}'\n```\n\n### Create a Document\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FcreateDocWithMd\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"notebook\": \"NOTEBOOK_ID\",\n    \"path\": \"\u002FMeeting Notes\u002F2026-03-22\",\n    \"markdown\": \"# Meeting Notes\\n\\n- Discussed project timeline\\n- Assigned tasks\"\n  }' | jq '.data'\n```\n\n### Create a Notebook\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fnotebook\u002FcreateNotebook\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"My New Notebook\"}' | jq '.data.notebook.id'\n```\n\n### Append Block to Document\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FappendBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"parentID\": \"DOCUMENT_OR_BLOCK_ID\",\n    \"data\": \"New paragraph added at the end.\",\n    \"dataType\": \"markdown\"\n  }' | jq '.data'\n```\n\nAlso available: `\u002Fapi\u002Fblock\u002FprependBlock` (same params, inserts at the beginning) and `\u002Fapi\u002Fblock\u002FinsertBlock` (uses `previousID` instead of `parentID` to insert after a specific block).\n\n### Update Block Content\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FupdateBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"id\": \"BLOCK_ID\",\n    \"data\": \"Updated content here.\",\n    \"dataType\": \"markdown\"\n  }' | jq '.data'\n```\n\n### Rename a Document\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Ffiletree\u002FrenameDocByID\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"DOCUMENT_ID\", \"title\": \"New Title\"}'\n```\n\n### Set Block Attributes\n\nCustom attributes must be prefixed with `custom-`:\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fattr\u002FsetBlockAttrs\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"id\": \"BLOCK_ID\",\n    \"attrs\": {\n      \"custom-status\": \"reviewed\",\n      \"custom-priority\": \"high\"\n    }\n  }'\n```\n\n### Delete a Block\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fblock\u002FdeleteBlock\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"BLOCK_ID\"}'\n```\n\nTo delete a whole document: use `\u002Fapi\u002Ffiletree\u002FremoveDocByID` with `{\"id\": \"DOC_ID\"}`.\nTo delete a notebook: use `\u002Fapi\u002Fnotebook\u002FremoveNotebook` with `{\"notebook\": \"NOTEBOOK_ID\"}`.\n\n### Export Document as Markdown\n\n```bash\ncurl -s -X POST \"${SIYUAN_URL:-http:\u002F\u002F127.0.0.1:6806}\u002Fapi\u002Fexport\u002FexportMdContent\" \\\n  -H \"Authorization: Token $SIYUAN_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"id\": \"DOCUMENT_ID\"}' | jq -r '.data.content'\n```\n\n## Block Types\n\nCommon `type` values in SQL queries:\n\n| Type | Description |\n|------|-------------|\n| `d` | Document (root block) |\n| `p` | Paragraph |\n| `h` | Heading |\n| `l` | List |\n| `i` | List item |\n| `c` | Code block |\n| `m` | Math block |\n| `t` | Table |\n| `b` | Blockquote |\n| `s` | Super block |\n| `html` | HTML block |\n\n## Pitfalls\n\n- **All endpoints are POST** -- even read-only operations. Do not use GET.\n- **SQL safety**: only use SELECT queries. INSERT\u002FUPDATE\u002FDELETE\u002FDROP are dangerous and should never be sent.\n- **ID validation**: IDs match the pattern `YYYYMMDDHHmmss-xxxxxxx`. Reject anything else.\n- **Error responses**: always check `code != 0` in responses before processing `data`.\n- **Large documents**: block content and export results can be very large. Use `LIMIT` in SQL and pipe through `jq` to extract only what you need.\n- **Notebook IDs**: when working with a specific notebook, get its ID first via `lsNotebooks`.\n\n## Alternative: MCP Server\n\nIf you prefer a native integration instead of curl, install the SiYuan MCP server:\n\n```yaml\n# In ~\u002F.hermes\u002Fconfig.yaml under mcp_servers:\nmcp_servers:\n  siyuan:\n    command: npx\n    args: [\"-y\", \"@porkll\u002Fsiyuan-mcp\"]\n    env:\n      SIYUAN_TOKEN: \"your_token\"\n      SIYUAN_URL: \"http:\u002F\u002F127.0.0.1:6806\"\n```\n",{"name":5,"author":52,"license":14,"version":53,"metadata":54,"description":7,"prerequisites":64,"required_environment_variables":70},"FEUAZUR","1.0.0",{"hermes":55},{"tags":56,"homepage":62,"related_skills":63},[57,58,59,60,61],"SiYuan","Notes","Knowledge Base","PKM","API","https:\u002F\u002Fgithub.com\u002Fsiyuan-note\u002Fsiyuan",[42,44],{"commands":65,"env_vars":68},[66,67],"curl","jq",[69],"SIYUAN_TOKEN",[71,74],{"help":72,"name":69,"prompt":73},"Settings > About in SiYuan desktop app","SiYuan API token",{"name":75,"prompt":76,"required_for":77},"SIYUAN_URL","SiYuan instance URL (default http:\u002F\u002F127.0.0.1:6806)","remote instances","main","6746276ba18cb774853eb61b3b9399658bc9bc5c","core\u002Foptional-skills\u002Fproductivity\u002Fsiyuan","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch","2026-04-28 17:01:03",{"source":8,"skillName":5,"commands":85,"prompt":95,"zipAvailable":96},[86,89,92],{"tool":87,"command":88},"npx","npx skills add gjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN --skill siyuan",{"tool":90,"command":91},"bunx","bunx skills add gjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN --skill siyuan",{"tool":93,"command":94},"pnpm","pnpm dlx skills add gjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN --skill siyuan","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",true,[],[99,136,161,178,197,216],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":115,"publishedAt":47},"01M71QG27G1R2H2ZWEG4S0WTZT","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fsoftware-development\u002Fwriting-plans\u002FSKILL.md",[105,108,111,112],{"categoryNo":106,"categoryName":107,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":109,"categoryName":110,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},{"categoryNo":113,"categoryName":114,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000036","内容创作者",[116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135],"writing","writing plans","plans","test-driven","test-driven-development","superpowers","design","workflow","code","tasks","subagent","code-review","review","documentation","write","paths","planning","development","test","implementation",{"skillNo":137,"name":120,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":147,"publishedAt":47},"01M71QFZYRTJXMAE551MRAKZ14","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[141,144],{"categoryNo":142,"categoryName":143,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":145,"categoryName":146,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量",[148,133,134,149,150,151,152,121,116,153,124,126,154,155,156,157,158,118,159,160],"test driven development","driven","green","red-green-refactor","testing","debugging","systematic","refactor","systematic-debugging","enforce","tests","tdd","quality",{"skillNo":162,"name":156,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":167,"publishedAt":47},"01M71QFWR5Q8EYEQ6MCS3SM6MC","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[166],{"categoryNo":145,"categoryName":146,"taxonomyType":20,"taxonomyTypeDesc":21},[168,153,154,119,169,170,120,121,116,126,171,172,133,173,118,174,134,175,176,177],"systematic debugging","problem","problem-solving","phase","bugs","root cause","root-cause","investigation","understand","hermes",{"skillNo":179,"name":180,"nameZh":6,"description":181,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":182,"categories":183,"keywords":189,"publishedAt":47},"01M71QFS9S04MD8JP747W5WM0N","subagent-driven-development","Execute plans via delegate_task subagents (2-stage review).","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fsoftware-development\u002Fsubagent-driven-development\u002FSKILL.md",[184,185,188],{"categoryNo":109,"categoryName":110,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":186,"categoryName":187,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":113,"categoryName":114,"taxonomyType":25,"taxonomyTypeDesc":26},[190,126,133,149,119,120,191,192,121,116,123,124,127,128,193,194,118,195,196,134],"subagent driven development","delegate","delegation","subagents","parallel","stage","task",{"skillNo":198,"name":199,"nameZh":6,"description":200,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":201,"categories":202,"keywords":205,"publishedAt":47},"01M71QFQ1DBCVAZ511MXFE6T2V","requesting-code-review","Pre-commit review: security scan, quality gates, auto-fix.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fsoftware-development\u002Frequesting-code-review\u002FSKILL.md",[203,204],{"categoryNo":142,"categoryName":143,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[206,207,124,128,119,120,208,209,121,210,116,211,212,126,127,213,214,133,215,118],"code review","requesting code review","fix","auto-fix","auto","security scan","commit","verification","security","scan",{"skillNo":217,"name":218,"nameZh":6,"description":219,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":220,"categories":221,"keywords":223,"publishedAt":47},"01M71QFM7KWM540YR67FRN807Q","python-debugpy","Debug Python: pdb REPL + debugpy remote (DAP).","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fsoftware-development\u002Fpython-debugpy\u002FSKILL.md",[222],{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[224,225,226,227,228,229,230,40,153,154,231,232,233,156,234,235,236,237,177,238],"debugpy","python debugpy","python","dap","inspect","post-mortem","pdb","debugger","node","commands","debug","post","breakpoints","node-inspect","tui"]