How to get backlinks for a file?

Hi, I would like to develop my own plugin, based on that request :point_down: since I also would love to see something like this implemented.

I noticed it is possible to get links with:

const links =;

So half of the job is done. But is there a way to get backlinks?

I kinda don’t want to iterate over whole vault since there is already a backlinks official plugin, so I assume optimal solution is already made.
Like I could just look at official plugin source code and continue from here, couldn’t I? :eyes:

I noticed there is answer to similar question. Even though it is said here that getBacklinksForFile is not documented officially, I couldn’t find it in Typescript typing definitions.

I also think I could just take both “Backlinks” and “Outgoing links” html content and put it inside one tab, but it’s not that fun.

So to sum up: is there a viable way to find backlinks for the current file? If not, what possible workaround?

It not being documented means that it’s not found in the typings.
You can test the code in the dev tools console to see what it returns.

1 Like

Could you describe what new user experience you’re trying to design. FYI a forward/outgoing links pane was added to Obsidian w/ v0.12.4 as the “Outgoing Links” core plugin.