[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71FPS9SWT5AV147KPQST6NW":3,"skill-same:01M71FPS9SWT5AV147KPQST6NW":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},"01M71FPS9SWT5AV147KPQST6NW","siyuan",null,"SiYuan Note API for searching, reading, creating, and managing blocks and documents in a self-hosted knowledge base via curl.","gjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6","gjbvsjjvgm-sketch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F278511911?v=4","01M71F3JXKZQ70H2KCHHTXKZDA","01M71F3JY8A79Z3NZBW08TF4JD",0,"MIT","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes-agent\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],"desktop app","for","reading","URL","remote","app","token","knowledge base","self","notion","instances","default","self-hosted","pkm","knowledge","api","notes","documents","obsidian","2026-11-10 10:12:30",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.yousef\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.yousef\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.yousef\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.yousef\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",[46,37],{"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","93bbc269671fbb340afa15b36a8766f15dc30df2","hermes-agent\u002Foptional-skills\u002Fproductivity\u002Fsiyuan","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch","2026-04-27 02:51:28",{"source":8,"skillName":5,"commands":85,"prompt":95,"zipAvailable":96},[86,89,92],{"tool":87,"command":88},"npx","npx skills add gjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6 --skill siyuan",{"tool":90,"command":91},"bunx","bunx skills add gjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6 --skill siyuan",{"tool":93,"command":94},"pnpm","pnpm dlx skills add gjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6 --skill siyuan","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes-agent\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",true,[],[99,135,163,179,198,219],{"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},"01M71G6TJ2RAQ1J0PV3K6D9GQA","writing-plans","Use when you have a spec or requirements for a multi-step task. Creates comprehensive implementation plans with bite-sized tasks, exact file paths, and complete code examples.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\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,29,133,134],"writing","writing plans","plans","design","review","workflow","documentation","tasks","development","code","planning","code-review","subagent","superpowers","paths","test-driven-development","you","test-driven","when",{"skillNo":136,"name":131,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":148,"publishedAt":47},"01M71G6R81013R3T7W5VP56GCB","Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle with test-first approach.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[140,143,146,147],{"categoryNo":141,"categoryName":142,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":144,"categoryName":145,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":109,"categoryName":110,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":113,"categoryName":114,"taxonomyType":25,"taxonomyTypeDesc":26},[149,150,124,151,152,116,153,125,154,128,129,155,156,157,158,159,160,161,162,134],"test","test driven development","driven","testing","debugging","refactor","red-green-refactor","cycle","green","systematic","bugfix","implementing","systematic-debugging","test-first",{"skillNo":164,"name":161,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":169,"publishedAt":47},"01M71G6N0Y546JZEDF25E2PMCE","Use when encountering any bug, test failure, or unexpected behavior. 4-phase root cause investigation — NO fixes without understanding the problem first.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[168],{"categoryNo":144,"categoryName":145,"taxonomyType":20,"taxonomyTypeDesc":21},[170,153,158,116,149,124,128,171,129,172,173,174,118,175,131,176,133,177,178,134],"systematic debugging","use","bug","root-cause","problem-solving","problem","fixes","phase","root cause",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":191,"publishedAt":47},"01M71G6J0DXEGY48GH4KVW2SJH","subagent-driven-development","Use when executing implementation plans with independent tasks. Dispatches fresh delegate_task per task with two-stage review (spec compliance then code quality).","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fsoftware-development\u002Fsubagent-driven-development\u002FSKILL.md",[185,186,187,188],{"categoryNo":109,"categoryName":110,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},{"categoryNo":113,"categoryName":114,"taxonomyType":25,"taxonomyTypeDesc":26},{"categoryNo":189,"categoryName":190,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000037","律师与法务",[124,192,128,151,116,120,121,193,123,125,194,127,195,196,129,118,197,131,133,134],"subagent driven development","code quality","delegation","parallel","delegate","fresh",{"skillNo":199,"name":200,"nameZh":6,"description":201,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":202,"categories":203,"keywords":206,"publishedAt":47},"01M71G6EFFBQX6634E6XHB09Y1","requesting-code-review","Pre-commit verification pipeline — static security scan, baseline-aware quality gates, independent reviewer subagent, and auto-fix loop. Use after code changes and before committing, pushing, or opening a PR.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fsoftware-development\u002Frequesting-code-review\u002FSKILL.md",[204,205],{"categoryNo":141,"categoryName":142,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[207,120,125,208,116,209,127,210,211,212,213,128,214,215,216,129,131,217,218,133],"code review","requesting code review","commit","verification","security scan","pipeline","loop","reviewer","fix","auto","static","auto-fix",{"skillNo":220,"name":221,"nameZh":6,"description":222,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":223,"categories":224,"keywords":225,"publishedAt":47},"01M71G6CM8ANSWVFXCN9AAD58Y","plan","Plan mode for Hermes — inspect context, write a markdown plan into the active workspace's `.hermes\u002Fplans\u002F` directory, and do not execute the work.","https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fsoftware-development\u002Fplan\u002FSKILL.md",[],[221,116,226,121,124,126,227,128,228,229,230,231,232,233,118,234,235,236,29,237],"directory","markdown","workspace","work","write","implementation","do","active","plan mode","inspect","mode","plan-mode"]