alias |
---|
Using Obsidian URI |
Obsidian supports a custom URI protocol obsidian://
which can be used to trigger various actions within the app. This is commonly used on macOS and mobile apps for automation and cross-app workflows.
If you have Obsidian installed, this link will open the app on your device: Click here
To make sure your operating system redirect obsidian://
URIs to the Obsidian app, there may be additional steps you need to perform.
- On Windows, running the app once should be sufficient. This will register for the
obsidian://
custom protocol handler in the Windows registry. - On macOS, running the app once should be sufficient, however, your app must be installer version 0.8.12 or later.
- On Linux, there's a much more involved process:
- First, ensure you create a
obsidian.desktop
file. See here for details - Ensure that your desktop file specifies the
Exec
field asExec=executable %u
. The%u
is used to pass theobsidian://
URIs to the app. - If you're using the AppImage installer, you may have to unpack it using
Obsidian-x.y.z.AppImage --appimage-extract
. Then make sure theExec
directive points to the unpacked executable.
- First, ensure you create a
Obsidian URIs are typically in this format:
obsidian://action?param1=value¶m2=value
- The
action
is usually the action that you would like to perform.
==Important==
Ensure that your values are properly URI encoded. For example, forward slash characters /
must be encoded as %2F
and space characters must be encoded as %20
.
This is especially important because an improperly encoded "reserved" character may break the interpretation of the URI. See here for details
Description: Opens an Obsidian vault, and possibly open a file within that vault.
Possible parameters:
vault
can be either the vault name, or the vault ID.- The vault name is simply the name of the vault folder.
- The vault ID is the random 16-character code assigned to the vault. This ID is unique per folder on your computer. Example:
ef6ca3e3b524d22f
. There isn't an easy way to find this ID yet, one will be offered at a later date in the vault switcher. Currently it can be found in%appdata%/obsidian/obsidian.json
for Windows. For macOS, replace%appdata%
with~/Library/Application Support/
. For Linux, replace%appdata%
with~/.config/
.
file
can be either a file name, or a path from the vault root to the specified file.- To resolve the target file, Obsidian uses the same link resolution system as a regular
[[wikilink]]
within the vault. - If the file extension is
md
, the extension can be omitted.
- To resolve the target file, Obsidian uses the same link resolution system as a regular
path
an absolute file system path to a file.- Using this parameter will override both
vault
andfile
. - This will cause the app to search for the most specific vault which contains the specified file path.
- Then the rest of the path replaces the
file
parameter.
- Using this parameter will override both
Examples:
-
obsidian://open?vault=my%20vault
This opens the vaultmy vault
. If the vault is already open, focus on the window. -
obsidian://open?vault=ef6ca3e3b524d22f
This opens the vault identified by the IDef6ca3e3b524d22f
. -
obsidian://open?vault=my%20vault&file=my%20note
This opens the notemy note
in the vaultmy vault
, assumingmy note
exists and the file ismy note.md
. -
obsidian://open?vault=my%20vault&file=my%20note.md
This also opens the notemy note
in the vaultmy vault
. -
obsidian://open?vault=my%20vault&file=path%2Fto%2Fmy%20note
This opens the note located atpath/to/my note
in the vaultmy vault
. -
obsidian://open?path=%2Fhome%2Fuser%2Fmy%20vault%2Fpath%2Fto%2Fmy%20note
This will look for any vault that contains the path/home/user/my vault/path/to/my note
. Then, the rest of the path is passed to thefile
parameter. For example, if a vault exists at/home/user/my vault
, then this would be equivalent tofile
parameter set topath/to/my note
. -
obsidian://open?path=D%3A%5CDocuments%5CMy%20vault%5CMy%20note
This will look for any vault that contains the pathD:\Documents\My vault\My note
. Then, the rest of the path is passed to thefile
parameter. For example, if a vault exists atD:\Documents\My vault
, then this would be equivalent tofile
parameter set toMy note
.
Description: Opens [[جستوجو]] in the specified vault, and optionally perform a search query.
Possible parameters:
vault
can be either the vault name, or the vault ID. Same as actionopen
.query
(optional) The search query to perform.
Examples:
-
obsidian://search?vault=my%20vault
This opens the vaultmy vault
, and opens [[جستوجو]]. -
obsidian://search?vault=my%20vault&query=MOC
This opens the vaultmy vault
, opens [[جستوجو]], and performs a search forMOC
.
Description: Creates a new note in the vault, optionally with some content.
Possible parameters:
vault
can be either the vault name, or the vault ID. Same as actionopen
.name
the file name to be created. If this is specified, the file location will be chosen based on your "Default location for new notes" preferences.file
a vault absolute path, including the name. Will overridename
if specified.path
a globally absolute path. Works similar to thepath
option in theopen
action, which will override bothvault
andfile
.content
(optional) the contents of the note.silent
(optional) set this if you don't want to open the new note.append
(optional) append to an existing file if one exists.overwrite
(optional) overwrite an existing file if one exists, but only ifappend
isn't set.x-success
(optional) see [[#x-callback-url]].
Examples:
obsidian://new?vault=my%20vault&name=my%20note
This opens the vaultmy vault
, and creates a new note calledmy note
.obsidian://new?vault=my%20vault&path=path%2Fto%2Fmy%20note
This opens the vaultmy vault
, and creates a new note atpath/to/my note
.
Description: Endpoint for use with Hook. Use: obsidian://hook-get-address
If x-success
is defined, this API will use it as the x-callback-url. Otherwise, it will copy a Markdown link of the current focused note to the clipboard, as an obsidian://open
URL.
Possible parameters:
vault
(optional) can be either the vault name, or the vault ID. If not provided, the current or last focused vault will be used.x-success
(optional) see [[#x-callback-url]].x-error
(optional) see [[#x-callback-url]].
Available since v0.14.3.
Some endpoints will accept the x-callback-url parameters x-success
and x-error
. When it's provided, Obsidian will provide the following to the x-success
callback:
name
the name of the file, without the file extension.url
theobsidian://
URI for this file.file
(desktop only) thefile://
URL for this file.
For example, if we receive
obsidian://.....x-success=myapp://x-callback-url
The response could be
myapp://x-callback-url?name=...&url=obsidian%3A%2F%2Fopen...&file=file%3A%2F%2F...
In addition to the formats above, there are two more "shorthand" formats available to open vaults and files:
obsidian://vault/my vault/my note
is equivalent toobsidian://open?vault=my%20vault&file=my%20note
obsidian:///absolute/path/to/my note
is equivalent toobsidian://open?path=%2Fabsolute%2Fpath%2Fto%2Fmy%20note