obsidian-api
Skill1 starsChanged 13 months agoApache-2.0View on GitHub
ADVANCED Obsidian operations via REST API. Use ONLY for Dataview queries, periodic notes, or patch operations (insert after heading/block). For standard vault operations (search, read, write), use the 'obsidian' skill instead (4-7x faster).
- Reads credentials
In this repository23 other files it gives its agents.
- app-runnerSkill
- delegateSkill
- env-managerSkill
- lexical-recall-guardSkill
- narrative-inventorySkill
- narrative-keywordsSkill
- narrative-mapsSkill
- obsidianSkill
- project-indexerSkill
- skill-api-conversionSkill
- skill-creatorSkill
- skill-distillSkill
- slipbox-integrationSkill
- story-structure-22-step-apiSkill
- story-structure-22-step-distilledSkill
- story-structure-22-stepSkill
- story-structure-7-stepsSkill
- story-structure-crime-distilledSkill
- story-structure-crimeSkill
- story-structure-myth-distilledSkill
- story-structure-mythSkill
- symbol-webSkill
- webapp-testingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 16 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Search for "Local REST API" and install
- Very specific: line 48
Search - use obsidian skill (7x faster with ripgrep)
- Very specific: line 49
Read/Write files - use obsidian skill (50x faster, direct filesystem)
- Very specific: line 52
Delete files - use obsidian skill
- Distinctive: line 60
All paths are relative to vault root
- Distinctive: line 65
All operations are performed through Python helper scripts that interact with the Obsidian REST API:
- Distinctive: line 82
Search all notes (including slipbox):
- Distinctive: line 87
Search only in slipbox:
- Distinctive: line 94
Read a single note:
- Distinctive: line 111
Create a new note:
- Distinctive: line 123
Add content to end of note:
- Distinctive: line 180
Delete a note (prompts for confirmation):
- Very specific: line 220
Always check environment first: - Use env-manager skill if API key is not set
- Distinctive: line 221
Use relative paths: - All paths are relative to vault root
- Very specific: line 222
Include file extensions: - Always use .md for markdown files
- Distinctive: line 224
Search before creating: - Check if note exists before creating new ones
- Very specific: line 254
All requests require Authorization: Bearer {API_KEY} header.
- Distinctive: line 260
Default server uses self-signed SSL certificate
- Distinctive: line 262
No authentication beyond API key
- Distinctive: line 266
Skill not working: Check if REST API plugin is enabled in Obsidian
- Distinctive: line 267
Can't find notes: Verify paths are relative to vault root, not filesystem
- Very specific: line 268
SSL errors: Add --no-verify-ssl flag to scripts if needed
- Distinctive: line 291
Read multiple files at once:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Obsidian REST API (Advanced Features)
⚠️ Note: For standard vault operations, use the obsidian skill (faster, simpler).
This skill provides API-only features via the Obsidian Local REST API that require Obsidian's parser and index.
Prerequisites
REQUIRED: Install and configure the Obsidian Local REST API community plugin:
- In Obsidian: Settings → Community Plugins → Browse
- Search for "Local REST API" and install
- Enable the plugin
- Copy the API key from plugin settings
- Note the server URL (default: https://127.0.0.1:27124)
No Python dependencies required - uses only Python standard library (urllib, ssl, json).
Environment Variables:
export OBSIDIAN_API_KEY=your_api_key_here
export OBSIDIAN_HOST=https://127.0.0.1:27124 # Optional, defaults to thisStore these in a .env file for persistence:
# .env or .env.obsidian
export OBSIDIAN_API_KEY=your_api_key_here
export OBSIDIAN_HOST=https://127.0.0.1:27124Then load with: source .env
When to Use This Skill
Use ONLY for these API-specific features:
- Dataview queries - Complex DQL aggregation queries
- Periodic notes - Daily/weekly/monthly note management
- Patch operations - Insert content after specific heading or block reference
- JSONLogic queries - Advanced metadata filtering
Do NOT use for:
- Search - use
obsidianskill (7x faster with ripgrep) - Read/Write files - use
obsidianskill (50x faster, direct filesystem) - List files - use
obsidianskill - Append content - use
obsidianskill - Delete files - use
obsidianskill
Default to the obsidian skill for all standard vault operations.
Vault Structure Awareness
- Main vault: Root directory contains all notes
- Slipbox: Located at
_Slipbox/within the vault - All paths are relative to vault root
- Directories use trailing slashes:
_Slipbox/,Projects/
Helper Scripts
All operations are performed through Python helper scripts that interact with the Obsidian REST API:
scripts/obsidian_api.py- Core API wrapper (don't call directly)scripts/search_vault.py- Search notes by content or metadatascripts/read_note.py- Read one or more note filesscripts/write_note.py- Create or update notesscripts/append_note.py- Append content to existing notesscripts/patch_note.py- Insert content relative to headings/blocksscripts/list_files.py- List files in vault or directoryscripts/delete_note.py- Delete notes (use with caution)scripts/periodic_notes.py- Get daily/weekly/monthly notesscripts/recent_notes.py- Find recently modified notes
Common Operations
Search the Vault
Search all notes (including slipbox):
python ~/.claude/skills/obsidian/scripts/search_vault.py "search term" --context 100Search only in slipbox:
python ~/.claude/skills/obsidian/scripts/search_vault.py "search term" --path "_Slipbox/"Read Notes
Read a single note:
python ~/.claude/skills/obsidian/scripts/read_note.py "Note Title.md"Read multiple notes:
python ~/.claude/skills/obsidian/scripts/read_note.py "Note 1.md" "Note 2.md" "Note 3.md"Read from slipbox:
python ~/.claude/skills/obsidian/scripts/read_note.py "_Slipbox/concept.md"Create or Update Notes
Create a new note:
python ~/.claude/skills/obsidian/scripts/write_note.py "New Note.md" --content "# New Note\n\nContent here"Create in slipbox:
python ~/.claude/skills/obsidian/scripts/write_note.py "_Slipbox/new-concept.md" --content "# Concept\n\nDetails..."Append to Notes
Add content to end of note:
python ~/.claude/skills/obsidian/scripts/append_note.py "Daily Note.md" --content "\n## New Section\n\nAdded content"Insert Content at Specific Location
Insert after a heading:
python ~/.claude/skills/obsidian/scripts/patch_note.py "Note.md" \
--content "New content" \
--heading "Section Title"Insert after a block reference:
python ~/.claude/skills/obsidian/scripts/patch_note.py "Note.md" \
--content "New content" \
--block "block-id"List Files
List all files in vault:
python ~/.claude/skills/obsidian/scripts/list_files.pyList files in slipbox:
python ~/.claude/skills/obsidian/scripts/list_files.py --path "_Slipbox/"List specific directory:
python ~/.claude/skills/obsidian/scripts/list_files.py --path "Projects/Active/"Periodic Notes
Get today's daily note:
python ~/.claude/skills/obsidian/scripts/periodic_notes.py dailyGet this week's weekly note:
python ~/.claude/skills/obsidian/scripts/periodic_notes.py weeklyGet recent daily notes:
python ~/.claude/skills/obsidian/scripts/recent_notes.py daily --limit 7Delete Notes
Delete a note (prompts for confirmation):
python ~/.claude/skills/obsidian/scripts/delete_note.py "Old Note.md"Force delete without confirmation:
python ~/.claude/skills/obsidian/scripts/delete_note.py "Old Note.md" --forceSlipbox-Specific Workflows
The skill is aware that _Slipbox/ is special and contains your Zettelkasten/slip-box notes.
Search slipbox for concepts:
python ~/.claude/skills/obsidian/scripts/search_vault.py "emergence" --path "_Slipbox/" --context 200Create new slipbox note:
python ~/.claude/skills/obsidian/scripts/write_note.py "_Slipbox/202501131045-emergence-in-systems.md" \
--content "# Emergence in Systems\n\nEmergence occurs when...\n\n## References\n- [[complex-systems]]\n- [[self-organization]]"List all slipbox notes:
python ~/.claude/skills/obsidian/scripts/list_files.py --path "_Slipbox/"Integration with Other Skills
This skill works well with:
- slipbox-integration - Links slipbox notes into narrative projects
- narrative-inventory - Can read/write inventories to vault
- narrative-maps - Can store spatial maps in vault
- project-indexer - Can maintain project indexes in vault
Best Practices
- Always check environment first - Use
env-managerskill if API key is not set - Use relative paths - All paths are relative to vault root
- Include file extensions - Always use
.mdfor markdown files - Respect slipbox structure - Slipbox notes are in
_Slipbox/ - Search before creating - Check if note exists before creating new ones
- Use descriptive titles - Especially for slipbox notes (e.g.,
202501131045-concept-name.md) - Preserve links - Maintain
[[wikilinks]]when modifying notes - Handle errors gracefully - API may fail if Obsidian is closed
Error Handling
Common issues:
- Connection refused: Obsidian is not running or REST API plugin is disabled
- 401 Unauthorized: OBSIDIAN_API_KEY is incorrect or not set
- 404 Not Found: File path doesn't exist in vault
- SSL errors: Set
OBSIDIAN_VERIFY_SSL=falseif using self-signed cert
API Endpoints Reference
For transparency, here are the underlying REST API endpoints used:
| Operation | Endpoint | Method |
| List vault files | /vault/ | GET |
| List directory | /vault/{path}/ | GET |
| Read file | /vault/{filepath} | GET |
| Create/Update | /vault/{filepath} | POST |
| Patch content | /vault/{filepath} | PATCH |
| Delete file | /vault/{filepath} | DELETE |
| Simple search | /search/simple/ | POST |
| Advanced search | /search/ | POST |
| Get periodic note | /periodic/{period}/ | GET |
| Recent periodic | /periodic/{period}/recent | GET |
All requests require Authorization: Bearer {API_KEY} header.
Security Notes
- API key grants full vault access - treat as sensitive credential
- Store in environment variables, not in code
- Default server uses self-signed SSL certificate
- API only accessible on localhost by default
- No authentication beyond API key
Troubleshooting
- Skill not working: Check if REST API plugin is enabled in Obsidian
- Can't find notes: Verify paths are relative to vault root, not filesystem
- SSL errors: Add
--no-verify-sslflag to scripts if needed - Empty results: Obsidian may need to finish indexing vault
- Changes not visible: Obsidian auto-reloads, but may need manual refresh
Advanced Usage
Complex Searches with JSONLogic
The API supports JSONLogic queries for advanced filtering:
# Example: Find notes modified in last 7 days with tag #important
query = {
"and": [
{">=": [{"var": "mtime"}, 1704672000]},
{"in": ["#important", {"var": "tags"}]}
]
}See scripts source code for implementation details.
Batch Operations
Read multiple files at once:
python ~/.claude/skills/obsidian/scripts/read_note.py \
"Note1.md" "Note2.md" "Note3.md" \
--format jsonWorking with Templates
Store templates in vault and copy when creating notes:
# Read template
template=$(python ~/.claude/skills/obsidian/scripts/read_note.py "Templates/Note Template.md")
# Create note from template
python ~/.claude/skills/obsidian/scripts/write_note.py "New Note.md" --content "$template"Script Output Formats
Most scripts support --format flag:
text(default) - Human-readable outputjson- Machine-readable JSON for scriptingmarkdown- Formatted markdown
Example:
python ~/.claude/skills/obsidian/scripts/search_vault.py "term" --format json | jqDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

