[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BX446T2GJXKTBTH2HC3FS4":3,"skill-same:01M7BX446T2GJXKTBTH2HC3FS4":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":14,"repositoryHtmlUrl":59,"repositoryHomepageUrl":6,"ownerHtmlUrl":60,"ownerBlogUrl":6,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M7BX446T2GJXKTBTH2HC3FS4","siyuan",null,"SiYuan Note API for searching, reading, creating, and managing blocks and documents in a self-hosted knowledge base via curl.","yuxua24\u002Fworkspace","yuxua24","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F145311182?v=4","01M7BWRX3SGTW32KC66ZKHKKJT","Yuxuan Ao","01M7BWRX4GD7VN7NV8WQPWHQJE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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\nplatforms: [linux, macos, windows]\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 `${HERMES_HOME:-~\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 `${HERMES_HOME:-~\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":24,"license":15,"version":25,"metadata":26,"platforms":38,"description":7,"prerequisites":42,"required_environment_variables":48},"FEUAZUR","1.0.0",{"hermes":27},{"tags":28,"homepage":34,"related_skills":35},[29,30,31,32,33],"SiYuan","Notes","Knowledge Base","PKM","API","https:\u002F\u002Fgithub.com\u002Fsiyuan-note\u002Fsiyuan",[36,37],"obsidian","notion",[39,40,41],"linux","macos","windows",{"commands":43,"env_vars":46},[44,45],"curl","jq",[47],"SIYUAN_TOKEN",[49,52],{"help":50,"name":47,"prompt":51},"Settings > About in SiYuan desktop app","SiYuan API token",{"name":53,"prompt":54,"required_for":55},"SIYUAN_URL","SiYuan instance URL (default http:\u002F\u002F127.0.0.1:6806)","remote instances","autoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901","762e83a83bedbed565e95e7d42d39204c367c9eb","hermes-agent\u002Foptional-skills\u002Fproductivity\u002Fsiyuan","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace","https:\u002F\u002Fgithub.com\u002Fyuxua24","I am Ao Yuxuan, a student in Xi'an Jiaotong University. I am eager to learn on GitHub and contribute my part to this community.","2026-09-01 17:37:09",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add yuxua24\u002Fworkspace --skill siyuan",{"tool":69,"command":70},"bunx","bunx skills add yuxua24\u002Fworkspace --skill siyuan",{"tool":72,"command":73},"pnpm","pnpm dlx skills add yuxua24\u002Fworkspace --skill siyuan","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",true,[],[78,85,92,99,106,113],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7BXERWENH07XE9XAV53QZ2D","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7BXEMHAJQA0RVGZ43ZNDFH2","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7BXEGNTY1MJD5W8GSWT7MAP","spike","Throwaway experiments to validate an idea before build.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fspike\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7BXEE77341X1N35WV5CBXAY","simplify-code","Parallel 3-agent cleanup of recent code changes.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fsimplify-code\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M7BXEASY2T61Y8FRYTXGMKWY","requesting-code-review","Pre-commit review: security scan, quality gates, auto-fix.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Frequesting-code-review\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M7BXE6H4KWMW0DKVXR5G61E4","python-debugpy","Debug Python: pdb REPL + debugpy remote (DAP).","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fpython-debugpy\u002FSKILL.md",[],[]]