External links via the API?

Is it possible to access external links (i.e., the same as right-clicking on a notebook or note and selecting "Copy external link") via the API? I can't find anything on this in the docs so I suspect it currently isn't, but presumably it would be relatively trivial to implement.


Do you mean create those links using the API? If so, all you need is to get the id of your note and insert it into the template.

The issue is that it needs to work for both notes and notebooks. An external link to a note starts with joplin://x-callback-url/openNote?id= followed by the note id, and a notebook link has openFolder instead of openNote. It's easy enough to automate the creation of the link if there's some way for the automation script or plugin to know whether you're linking to a note or a notebook, but otherwise it's impossible (as far as I can tell). An API solution should resolve that ambiguity, depending on what is selected.

Do I understand you correctly you're looking for a way to create a link having only the id without knowing whether the id refers to a note or a folder or a tag?

I suppose in this case you can just look up the note and if it exists create a note link, same for folder and tag.

I'll try that, thanks. I'm trying to get Hookmark to work with Joplin, which should be straightforward given that "Copy external link" exists.

Is there a way to get the ID of the selected note or notebook via the API? I can only find methods for retrieving a note and its metadata if you already know the ID.

I can't check now but doesn't joplin.workspace | Joplin Plugin API Documentation include the id? There are similar methods for folder and tag.

1 Like

Thanks @roman_r_m , that's what I was looking for.