Open-source project
obsidianmd/obsidian-api avatar
obsidianmd/obsidian-api

obsidian-api is a type-definitions package with an empty main field and two pinned CodeMirror peers

Type definitions for the latest Obsidian API.

2,359 stars276 forksUnknownMIT

At a glance

What is it?
obsidianmd/obsidian-api holds the TypeScript declarations for Obsidian's plugin API, not a web service. This article walks through what the package contains, how a plugin is laid out around it, and what a reader searching for an API key will not find.
Who is it for?
Install obsidian-api if you write Obsidian plugins in TypeScript and want editor completion for App, Vault, Workspace and MetadataCache. Do not install it expecting an HTTP endpoint, an API key or a Python client, because the package contains declaration files and nothing that runs.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 7 days ago.
What is it written in?
GitHub does not report a main language for this repository.

Answers come from the project's GitHub data, last synced on November 26, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • obsidianmd/obsidian-api2,359 ★ · +20
Star history
Repository2026-10-182026-11-26
obsidianmd/obsidian-api2.3k2.4k

20 Stars in the last 39 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The package ships declaration files and its main field is an empty string

obsidian-api is a types package. The repository root holds `obsidian.d.ts`, `canvas.d.ts` and `publish.d.ts`, plus a CHANGELOG.md, a LICENSE.md and the README. There is no source directory and no build script. The description in package.json says it plainly: type definitions for the latest Obsidian API.

Two fields in package.json make the shape clear. `"main": ""` is empty, so there is no JavaScript entry point to import. `"types": "obsidian.d.ts"` points TypeScript at the main declaration file. The package name is `obsidian`, and the version is 1.14.4.

The practical result: installing it gives your editor and compiler knowledge of the plugin API, and at runtime nothing comes from this package. The actual `obsidian` module is supplied by the Obsidian app itself, which is why the plugin entry file in the README tells you to import it with `require('obsidian')` and why bundling it into your plugin is not the step that matters.

There is no API key, because nothing in this repository is a service

A lot of people search for an Obsidian API key, token, REST API or Python client. None of those appear in this repository. The README sends you to two places: the Plugin API documentation at docs.obsidian.md, and the template repository obsidianmd/obsidian-sample-plugin for an example of how to build a plugin.

That tells you what the API is. It is an in-process interface that your plugin code calls from inside the running app, through the `App` object it receives. There is no network listener described, no authentication scheme and no rate limit in anything the repository contains.

The license is MIT, so the type definitions are free to use in the sense that matters for this repository. Whether Obsidian itself is free or paid is not something this repository states, so settle that on the product side, not here.

Issues with the API, and requests for new APIs, go to the developers section of the Obsidian forum at forum.obsidian.md, not to GitHub issues.

manifest.json carries seven required fields and two optional links

A plugin is described by a `manifest.json`. The README lists its keys:

- `id`, the ID of your plugin. - `name`, the display name. - `author`, the author's name. - `version`, the version of your plugin. - `minAppVersion`, the minimum required Obsidian version. - `description`, the long description. - `isDesktopOnly`, whether your plugin uses NodeJS or Electron APIs. - `authorUrl` (optional), a URL to your own website. - `fundingUrl` (optional), a link for users to donate.

Two of these decide who can run your plugin. `minAppVersion` ties the plugin to a floor on the Obsidian version, which is how you stay honest when you call an API added in a recent release. `isDesktopOnly` is the one to get right: if the plugin requires `fs` or `electron`, the flag has to say so, since those modules are not available on every platform the app runs on.

The README gives no validation step and no sample manifest. The sample plugin repository is the place to copy a working file from.

main.js must be one bundled file with a default class that extends Plugin

The entry point is `main.js`, and the README sets four rules for it. Import the Obsidian API with `require('obsidian')`. Import Node or Electron APIs with `require('fs')` or `require('electron')`. Export a default class that extends `Plugin`. Bundle every external dependency into this single file, using Rollup, Webpack or another JavaScript bundler.

The last rule is the one that bites. Obsidian loads `main.js` and does not install packages for you, so a dependency left external simply fails to resolve at load time. The `obsidian` module is the exception, because the app provides it.

This also explains the `dependencies` block in the type package. `@types/codemirror` is pinned at 5.60.8 and `moment` at 2.31.0. Those are there so the declaration files can reference CodeMirror 5 and moment types, and your TypeScript project inherits them. The README does not say that moment is available at runtime, so do not assume it from the pin.

App owns Vault, Workspace and MetadataCache, and Plugin hangs seven hooks off them

The README names the major modules. `App` is the global object that owns everything else, reachable as `this.app` inside a plugin. Through it you get `Vault`, which handles files and folders; `Workspace`, which handles the panes on screen; and `MetadataCache`, which holds cached metadata for each markdown file, including headings, links, embeds, tags and blocks.

Inheriting `Plugin` adds a set of registration methods:

- `this.addRibbonIcon` for a ribbon icon. - `this.addStatusBarItem` for an element in the bottom status bar. - `this.addCommand` for a global command, optionally with a default hotkey. - `this.addSettingTab` for a settings tab. - `this.registerView` for a new kind of view. - `this.loadData` and `this.saveData` for plugin data.

The split matters when you decide where code lives. File reads go through Vault. Anything about links or tags in notes goes through MetadataCache, and reading from the cache avoids parsing the file yourself. Pane layout belongs to Workspace. The README lists these methods but does not show any signature, so the real argument lists are in `obsidian.d.ts`.

Three registration helpers detach your handlers when the plugin unloads

Cleanup is handled by three methods on `Plugin`. For events from interfaces such as `App` and `Workspace`, use `this.registerEvent`, which detaches the handler automatically when the plugin unloads:

code
this.registerEvent(app.on('event-name', callback));

For DOM events on elements that outlive the plugin, such as `window` or `document`, use `this.registerDomEvent`:

code
this.registerDomEvent(element, 'click', callback);

For timers, use `this.registerInterval`:

code
this.registerInterval(setInterval(callback, 1000));

The failure these prevent is a plugin that is disabled in settings but keeps running. A raw `window.addEventListener` or a bare `setInterval` is not cleaned up by the plugin lifecycle, so its callback fires after unload and holds references to your plugin object. Each helper wraps one of those cases, and the README asks for them by name with the word please.

CodeMirror state and view are pinned as peers, and the repository has no tagged releases

package.json lists two peer dependencies: `@codemirror/state` at 6.7.6 and `@codemirror/view` at 6.43.13. Both are exact versions, with no range. If your plugin installs a different version of either package, your editor extensions and the types from this package can disagree about the same class, and TypeScript reports errors that look unrelated to your own code. Matching the pinned versions is the simplest fix.

There are no GitHub releases for this repository. The version number lives in package.json, currently 1.14.4, and the CHANGELOG.md file at the root is where changes are recorded. The last push to the default branch, `master`, was on 2026-10-05, and the repository is not archived.

The package keyword list holds one entry, `obsdmd`. The repository homepage is docs.obsidian.md, while package.json points its own homepage field at obsidian.md. Neither is a place to download a client library, because there is none.

Editorial conclusion

Install obsidian-api if you write Obsidian plugins in TypeScript and want editor completion for App, Vault, Workspace and MetadataCache. Do not install it expecting an HTTP endpoint, an API key or a Python client, because the package contains declaration files and nothing that runs. Before you start, open the pinned @codemirror/state and @codemirror/view versions in package.json and match them in your own plugin so the editor types agree.

Frequently asked questions

What is the Obsidian API?

In this repository it is the set of TypeScript type definitions for the Obsidian plugin API. Plugins reach the app through objects such as App, Vault, Workspace and MetadataCache.

How do I use the Obsidian API?

Write a plugin whose main.js exports a default class extending Plugin, and import the API with require('obsidian'). The README points to the obsidian-sample-plugin template and the docs at docs.obsidian.md.

Is there an Obsidian API?

Yes. obsidian-api publishes its type definitions, with obsidian.d.ts as the main declaration file. Requests for new APIs go to the developers section of the Obsidian forum.

Where is the Obsidian API key?

The obsidian-api repository does not mention a key or token. It contains declaration files for in-app plugins, and its package.json has an empty main field.

Official sources

  1. Issues
  2. License: MIT
  3. obsidianmd/obsidian-api on GitHub
  4. Project website
  5. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/obsidianmd-obsidian-api.svg)](https://hysenlabs.com/projects/obsidianmd-obsidian-api)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/obsidianmd-obsidian-api.svg)](https://hysenlabs.com/projects/obsidianmd-obsidian-api)

Was this useful?