Install
openclaw skills install obsidian-restRead, write, search, append, patch, and manage notes in any Obsidian vault via the Local REST API on Windows, macOS, or Linux.
openclaw skills install obsidian-restControl any Obsidian vault from OpenClaw using the Local REST API plugin. Works on any OS where Obsidian Desktop runs (Windows, macOS, Linux). No extra CLI tools needed — just curl.
These issues were discovered in real-world use and will cause silent failures if ignored:
The API returns {"message":"Not Found","errorCode":40400} if you omit trailing slashes on directory endpoints.
| Path | Result |
|---|---|
$OBSIDIAN_URL/vault/ | ✅ Correct — lists vault root |
$OBSIDIAN_URL/vault | ❌ 40400 error |
$OBSIDIAN_URL/vault/My%20Folder/ | ✅ Correct — lists subfolder |
$OBSIDIAN_URL/vault/My%20Folder | ❌ 40400 error |
/ — nothing elseThere is no /api/, /api/healthz, /healthz, /status, or /health endpoint.
| Path | Result |
|---|---|
$OBSIDIAN_URL/ | ✅ Returns plugin status JSON |
$OBSIDIAN_URL/api/ | ❌ 40400 error |
$OBSIDIAN_URL/api/healthz | ❌ 40400 error |
$OBSIDIAN_URL and $OBSIDIAN_API_KEY are available in the gateway process but child shells
spawned by the exec tool may not inherit them depending on your OpenClaw configuration.
Always test variable expansion before using them in curl:
echo "URL=$OBSIDIAN_URL KEY_LEN=${#OBSIDIAN_API_KEY}"
If either is empty, use hardcoded values in your curl commands for this session.
Always interpret API responses and reply in plain English. See the Output Formatting section.
27124). HTTPS is strongly recommended.sudo nano /etc/systemd/system/openclaw.service
Add these two lines in the [Service] block:
Environment=OBSIDIAN_URL=https://YOUR_OBSIDIAN_HOST:27124
Environment=OBSIDIAN_API_KEY=your_api_key_here
Then reload and restart:
sudo systemctl daemon-reload
sudo systemctl restart openclaw.service
PID=$(pgrep -f "openclaw-gateway" | head -1)
cat /proc/$PID/environ | tr "\0" "\n" | grep "^OBSIDIAN"
Both OBSIDIAN_URL and OBSIDIAN_API_KEY should appear with correct values.
curl -sk \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
"$OBSIDIAN_URL/" \
| python3 -c "import json,sys; d=json.load(sys.stdin); print('OK — Obsidian', d['versions']['obsidian'], '| Plugin', d['versions']['self'], '| Auth:', d['authenticated'])"
Expected: OK — Obsidian 1.x.x | Plugin 3.x.x | Auth: True
If $OBSIDIAN_URL is empty, substitute the literal URL:
curl -sk \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
"https://YOUR_OBSIDIAN_HOST:27124/" \
| python3 -c "import json,sys; d=json.load(sys.stdin); print('OK — Obsidian', d['versions']['obsidian'], '| Plugin', d['versions']['self'], '| Auth:', d['authenticated'])"
# Via ClawHub
openclaw skills install obsidian-rest
# Or manually
git clone https://github.com/nj070574-gif/openclaw-obsidian-vault-skill.git
cp -r openclaw-obsidian-vault-skill/skill ~/.openclaw/workspace/skills/obsidian-rest
| Variable | Required | Description |
|---|---|---|
OBSIDIAN_URL | ✅ Yes | Full base URL including protocol and port, e.g. https://192.168.1.100:27124 |
OBSIDIAN_API_KEY | ✅ Yes | API key from Obsidian → Settings → Local REST API |
Always use curl -sk — the plugin uses a self-signed certificate by default.
All requests require the auth header:
Authorization: Bearer $OBSIDIAN_API_KEY
curl -sk -H "Authorization: Bearer $OBSIDIAN_API_KEY" "$OBSIDIAN_URL/"
Returns: {"status":"OK","authenticated":true,"versions":{"obsidian":"1.x.x","self":"3.x.x"}, ...}
curl -sk -H "Authorization: Bearer $OBSIDIAN_API_KEY" "$OBSIDIAN_URL/vault/" \
| python3 -c "import json,sys; [print(f) for f in sorted(json.load(sys.stdin)['files'])]"
curl -sk -H "Authorization: Bearer $OBSIDIAN_API_KEY" "$OBSIDIAN_URL/vault/My%20Folder/" \
| python3 -c "import json,sys; [print(f) for f in json.load(sys.stdin)['files']]"
URL encoding: spaces →
%20| forward slash within a path segment →%2F
Encode any path automatically:
python3 -c "import urllib.parse; print(urllib.parse.quote('My Folder/My Note.md', safe=''))"
curl -sk -H "Authorization: Bearer $OBSIDIAN_API_KEY" \
"$OBSIDIAN_URL/vault/PATH%2FTO%2FNOTE.md"
Returns raw Markdown content.
curl -sk -X PUT \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: text/markdown" \
--data-binary "# My Note Title
Content goes here." \
"$OBSIDIAN_URL/vault/PATH%2FTO%2FNOTE.md"
Returns HTTP 204 No Content on success.
Warning: PUT replaces the entire file. Use POST to append safely.
curl -sk -X POST \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: text/markdown" \
--data-binary "
## New Section $(date +%Y-%m-%d)
Content to append." \
"$OBSIDIAN_URL/vault/PATH%2FTO%2FNOTE.md"
Returns HTTP 204 No Content on success.
curl -sk -X PATCH \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: text/markdown" \
-H "Obsidian-API-Operation: append" \
-H "Heading: My Section Heading" \
--data-binary "Content to insert under the heading." \
"$OBSIDIAN_URL/vault/PATH%2FTO%2FNOTE.md"
Valid operations: append | prepend | replace
curl -sk -X DELETE \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
"$OBSIDIAN_URL/vault/PATH%2FTO%2FNOTE.md"
Returns HTTP 204 No Content on success.
curl -sk -X POST \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
"$OBSIDIAN_URL/search/simple/?query=YOUR+SEARCH+TERM&contextLength=150" \
| python3 -c "
import json, sys
results = json.load(sys.stdin)
if not results:
print('No matches found.')
else:
print(f'Found {len(results)} match(es):')
for r in results[:5]:
print(' -', r['filename'])
for m in r.get('matches', [])[:1]:
ctx = m.get('context', '').strip()
if ctx: print(' ...', ctx[:100])
"
curl -sk -H "Authorization: Bearer $OBSIDIAN_API_KEY" "$OBSIDIAN_URL/active/"
curl -sk -H "Authorization: Bearer $OBSIDIAN_API_KEY" "$OBSIDIAN_URL/commands/" \
| python3 -c "import json,sys; [print(c['id'], '|', c['name']) for c in json.load(sys.stdin).get('commands',[])]"
curl -sk -X POST \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"commandId": "editor:save-file"}' \
"$OBSIDIAN_URL/commands/execute/"
Never dump raw JSON to the user. Always interpret results and reply in plain English.
| Situation | What to say |
|---|---|
Status check returns "authenticated": true | "✅ Obsidian vault connected — Obsidian v1.x.x, plugin v3.x.x" |
| Status check fails / 40400 error | "❌ Cannot reach Obsidian vault: [exact error]. Check Obsidian is running." |
| Vault listed | "Your vault contains X items: [list files and folders]" |
| Subfolder listed | "Found X notes in [folder]: [list]" |
| Note read | Return the note content (or a summary if it's long) |
| Note created (HTTP 204) | "✅ Created [path]" |
| Note saved / overwritten (HTTP 204) | "✅ Saved to [path]" |
| Note appended (HTTP 204) | "✅ Appended to [path]" |
| Search returns results | "Found X notes matching '[query]': [list filenames]" |
| Search returns nothing | "No notes found matching '[query]'" |
| 40400 error | "❌ API returned Not Found — check the path and trailing slashes" |
| 401 error | "❌ Unauthorised — check OBSIDIAN_API_KEY is set correctly" |
echo "URL=$OBSIDIAN_URL LEN=${#OBSIDIAN_API_KEY}"Infrastructure/, daily log → Daily/)Setup-Guide-2026-04-12.mdGET /vault/PATH.md — HTTP 404 means safe to createPUT to create, POST to append to existingInfrastructure/Setup-Guide.md"POST /search/simple/?query=TERMGET the file and return its content or a summaryPOST to append, or PATCH with Heading header for targeted insertionNew folders are created automatically when you PUT a file into a path that doesn't exist yet.
NOTE_PATH="Infrastructure%2FRunbook-$(date +%Y-%m-%d).md"
curl -sk -X PUT \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: text/markdown" \
--data-binary "# Runbook — $(date +%Y-%m-%d)
## Steps
1. Step one
2. Step two
" \
"$OBSIDIAN_URL/vault/$NOTE_PATH"
echo "Saved to vault/$NOTE_PATH"
curl -sk -X POST \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: text/markdown" \
--data-binary "
- $(date '+%Y-%m-%d %H:%M') — Log entry here" \
"$OBSIDIAN_URL/vault/Daily%2FLog.md"
| Character | Encoded |
|---|---|
Space | %20 |
/ (within a path segment) | %2F |
# | %23 |
& | %26 |
+ | %2B |
| Symptom | Likely cause | Fix |
|---|---|---|
curl: (7) Failed to connect | Obsidian not running or wrong host/port | Check Obsidian is open; verify OBSIDIAN_URL |
{"message":"Not Found","errorCode":40400} | Wrong path — missing trailing slash, or non-existent endpoint | Add / to end of directory paths; use only documented endpoints |
HTTP 401 Unauthorized | Wrong or missing API key | Verify OBSIDIAN_API_KEY matches plugin settings |
| SSL certificate error | Self-signed cert | Always use curl -sk — never curl -s alone |
$OBSIDIAN_URL empty in curl | Env var not inherited by exec shell | Test with echo $OBSIDIAN_URL; use literal values if empty |
Skill shows △ needs setup | Env vars not set | Add Environment= lines to openclaw.service, reload, restart |
| Obsidian on Windows, agent on Linux | Firewall blocking port | Allow TCP 27124 inbound in Windows Defender Firewall |
Windows Defender Firewall → Advanced Settings → Inbound Rules → New Rule
→ Port → TCP → 27124 → Allow → All profiles → Name: "Obsidian Local REST API"
271240.12.03.2.0