Registry / productivity / obsidian-local-rest-api

obsidian-local-rest-api

JSON →
library2.5.4jsnpmunverified

An Obsidian plugin that provides a secure HTTPS REST API with API key authentication for interacting with notes in an Obsidian vault. Version 2.5.4 is current. It allows reading, creating, updating, deleting notes, listing vault contents, managing periodic notes, and executing Obsidian commands. Unlike custom URI schemes, it provides full HTTP API access suitable for browser extensions and automation scripts. Ships TypeScript type definitions.

npm install obsidian-local-rest-api
INSTALL
IMPORT
SIG · OBSIDIAN-LOCAL-RES
O
obsidian-local-rest-api
productivityjavascriptv2.5.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LocalRestApi
import { LocalRestApi } from 'obsidian-local-rest-api'
const LocalRestApi = require('obsidian-local-rest-api')
Package is ESM-only; CommonJS require will fail.
Note
import type { Note } from 'obsidian-local-rest-api'
import { Note } from 'obsidian-local-rest-api'
Note is a TypeScript type/interface (not a runtime value). Use type import.
Command
import type { Command } from 'obsidian-local-rest-api'
import { Command } from 'obsidian-local-rest-api'
Command is a TypeScript type/interface (not a runtime value). Use type import.
default export
import LocalRestApi from 'obsidian-local-rest-api'
import * as LocalRestApi from 'obsidian-local-rest-api'
Package exports a default class; namespace import will not work as expected in most bundlers.

Shows instantiation of LocalRestApi client with API key and base URL, then fetches notes list.

import LocalRestApi from 'obsidian-local-rest-api'; const api = new LocalRestApi({ apiKey: process.env.OBSIDIAN_API_KEY ?? '', baseUrl: 'https://localhost:27124', }); async function getNotes() { const response = await api.listNotes(); console.log(response.data); } getNotes();
Debug
Known issues
breakingBreaking change: In v2.0.0, the API endpoint paths changed from /vault/ to /api/vault/. Update all URL references.
fix
Update endpoint paths to start with /api/ (e.g., /api/vault/...).
affects: <2.0.0
breakingBreaking change: In v2.0.0, authentication changed from no auth to required API key header X-API-Key.
fix
Include X-API-Key header in all requests. Generate an API key via plugin settings.
affects: <2.0.0
deprecatedDeprecated: The listNotes() method without parameters is deprecated; use listNotes(query) with optional filter object.
fix
Call listNotes({}) or pass a query object with path/folder filters.
affects: >=2.3.0
gotchaGotcha: The API server runs on HTTPS with a self-signed certificate. Node.js and some HTTP clients reject self-signed certs by default.
fix
Use NODE_TLS_REJECT_UNAUTHORIZED=0 in development, or configure your client to accept self-signed certs. Not recommended for production.
affects: >=1.0.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:27124
The Obsidian plugin's local server is not running or plugin is disabled.
fix
Ensure Obsidian is open and the Local REST API plugin is enabled. Check plugin settings for port and enable the server.
400 Bad Request: Invalid api key
The API key provided does not match the one configured in the plugin.
fix
Regenerate or copy the correct API key from Obsidian plugin settings and include it in the X-API-Key header.
TypeError: note.updated is not a function
Using old v1.x client library with v2.x API; response format changed.
fix
Upgrade client library to v2.x or use raw HTTP requests with the new endpoint paths and response structure.
Upgrade
Version history
2.5.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
obsidian-local-rest-api — npm install obsidian-local-rest-api · libregistry