Obsidian REST API
Operate Obsidian via Local REST API plugin from WSL or remote environments.
First-Time Setup
On first use, automatically detect and save configuration:
- Check TOOLS.md for existing
OBSIDIAN_API_URLandOBSIDIAN_API_KEY - If not found:
- Get Windows host IP:
cat /etc/resolv.conf | grep nameserver | awk '{print $2}' - Ask user for API Key
- Save to TOOLS.md:
### Obsidian REST API (WSL → Windows) **API 端点**: https://<detected-ip>:27124 **API Key**: <user-provided-key>
- Get Windows host IP:
- Test connection with saved config
Configuration Format
Saved in TOOLS.md:
### Obsidian REST API (WSL → Windows)
**API 端点**: https://<windows-host-ip>:27124
**API Key**: <your-api-key>
Quick Start
# Get URL and KEY from TOOLS.md
URL=$(grep 'API 端点' ~/.openclaw/workspace/TOOLS.md | awk -F': ' '{print $2}')
KEY=$(grep 'API Key' ~/.openclaw/workspace/TOOLS.md | awk -F': ' '{print $2}')
# Test connection
curl -k -H "Authorization: Bearer $KEY" "$URL/"
# List vault files
curl -k -H "Authorization: Bearer $KEY" "$URL/vault/"
# Create note
curl -k -X PUT -H "Authorization: Bearer $KEY" -H "Content-Type: text/markdown" \
-d "# Title\nContent" "$URL/vault/note.md"
Common Tasks
Create/Update Note
curl -k -X PUT -H "Authorization: Bearer $KEY" -H "Content-Type: text/markdown" \
--data "<content>" "$URL/vault/<filename>.md"
Append to Note
curl -k -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: text/markdown" \
--data "<content-to-append>" "$URL/vault/<filename>.md"
Get Daily Note
curl -k -H "Authorization: Bearer $KEY" "$URL/periodic/daily/"
# Or specific date:
curl -k -H "Authorization: Bearer $KEY" "$URL/periodic/daily/2026/05/11/"
Search Notes
# Simple text search
curl -k -X POST -H "Authorization: Bearer $KEY" \
"$URL/search/simple/?query=keyword"
# Advanced search (Dataview-style)
curl -k -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"query":"tag:#work"}' "$URL/search/"
Get Active File
curl -k -H "Authorization: Bearer $KEY" "$URL/active/"
Open File in UI
curl -k -X POST -H "Authorization: Bearer $KEY" "$URL/open/note.md"
Execute Command
# List available commands
curl -k -H "Authorization: Bearer $KEY" "$URL/commands/"
# Execute command
curl -k -X POST -H "Authorization: Bearer $KEY" "$URL/commands/daily-notes"
Get All Tags
curl -k -H "Authorization: Bearer $KEY" "$URL/tags/"
API Reference
See references/api.md for complete endpoint documentation.
Troubleshooting
Connection refused: Windows firewall blocking port.
# PowerShell (admin)
New-NetFirewallRule -DisplayName "Obsidian REST API" -Direction Inbound -LocalPort 27124 -Protocol TCP -Action Allow
SSL error: Use -k flag (self-signed cert).
Vault not found: Ensure vault is open in Obsidian.
Windows Setup
- Install
Local REST APIplugin in Obsidian - Enable "Bind to all interfaces" in plugin settings
- Allow port in Windows firewall
- Generate API key