[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CR8DK968F4JS00XCGDAEZW":3,"skill-same:01M7CR8DK968F4JS00XCGDAEZW":75},{"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":55,"commitSha":56,"skillDirectory":57,"forksCount":14,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":60,"install":61,"resources":74},"01M7CR8DK968F4JS00XCGDAEZW","siyuan",null,"Query and edit a SiYuan knowledge base via its API.","thalhath2234\u002Ftimely-app","thalhath2234","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F69391707?v=4","01M7CQNWTHSAP0D50RQY6W9YZQ","Thalhath","01M7CQNWVQN600VKQXRGTWCDPH",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: siyuan\ndescription: Query and edit a SiYuan knowledge base via its API.\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]\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":37,"description":7,"prerequisites":41,"required_environment_variables":47},"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],"obsidian",[38,39,40],"linux","macos","windows",{"commands":42,"env_vars":45},[43,44],"curl","jq",[46],"SIYUAN_TOKEN",[48,51],{"help":49,"name":46,"prompt":50},"Settings > About in SiYuan desktop app","SiYuan API token",{"name":52,"prompt":53,"required_for":54},"SIYUAN_URL","SiYuan instance URL (default http:\u002F\u002F127.0.0.1:6806)","remote instances","dev","4d9b346961dd1d220a07fe4e6ed44b52daa57e0b","apps\u002Fagent\u002Fhermes\u002Foptional-skills\u002Fproductivity\u002Fsiyuan","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app","https:\u002F\u002Fgithub.com\u002Fthalhath2234","2026-11-14 05:26:10",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add thalhath2234\u002Ftimely-app --skill siyuan",{"tool":67,"command":68},"bunx","bunx skills add thalhath2234\u002Ftimely-app --skill siyuan",{"tool":70,"command":71},"pnpm","pnpm dlx skills add thalhath2234\u002Ftimely-app --skill siyuan","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Foptional-skills\u002Fproductivity\u002Fsiyuan\u002FSKILL.md",true,[],[76,83,90,97,104,111],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CRJRHHG68Q3XZX37TD85JB","timely","Test fixture standing in for the Timely skill (IDs, markdown dialect, workspace rule).","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Ftests\u002Ffixtures\u002Fskills\u002Ftimely\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CRJPPNS8SKWVTDP3TJ9EHG","product-price-monitor","Test fixture override of the upstream product-price-monitor skill.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Ftests\u002Ffixtures\u002Fskills\u002Foverrides\u002Fproduct-price-monitor\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7CRJKRY4QH4RAA2MKHNZT04","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M7CRJG3JC6PRSTH3MW62KTH6","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M7CRJ8K3ACJYKSYDJWKJM6HV","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M7CRJ3Q5QP1CVBG959M3A3BM","spike","Throwaway experiments to validate an idea before build.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Fspike\u002FSKILL.md",[],[]]