How to recover deleted notes

I recently started using Joplin and decided to trust it with some important notes. Then I accidentally deleted one. How can I recover it?

I have Note History enabled with history kept for 30 days (and I don't have syncing). The Note History page only says how to recover old versions of existing notes.

Is there a way to recover notes that were deleted?

If there's no easy way, I noticed the database has a deleted_items table, so could it could be done with a query?

This is Joplin Desktop 1.0.241 (prod, darwin).

Do you have a backup of your local files? Or of the files on the sync target? If so, you can recover from this. Otherwise the note might still be in the revision table but it's not currently possible to recover it from there.

If the note is particularly important, you should be able to restore it from the next version using the command palette. You'd type Ctrl+Shift+P, then "restoreNoteRevision NOTE_ID".

1 Like

I use Dropbox, and I've been able to recover deleted notes using Dropbox's undelete feature. Once I have them back, no problems.

1 Like

Thanks @laurent. I made a copy of ~/.config/joplin-desktop soon after deleting the note, just in case. I don't have a sync target since I've never used syncing.

I realized I was using an old version of Joplin that didn't have the command palette, so I upgraded to 1.8.5. In that version, Command+Shift+P works but "restoreNoteRevision" doesn't appear as one of the commands. I also don't know how to find the note ID, since the note is deleted.

You will need the next version 2.0.x, which is not released yet. For the note ID, there's no easy way to find it so you'll have to get it for example from the "item_id" field of the "revisions" table. You could look at the revisions and find which ones seem to be related to your note.

Thanks @laurent!

For anyone else who wants to do this, the steps are:

  1. Make a backup of your Joplin data: ~/.config/joplin-desktop.

  2. In a terminal,
    sqlite3 ~/.config/joplin-desktop/database.sqlite

  3. In sqlite3,
    select item_id, body_diff from revisions order by created_time;

  4. Look at the results to find what you want to restore. Copy the item_id.

  5. Download Joplin 2.0.8 from Release v2.0.8 · laurent22/joplin · GitHub (I first tried 2.0.4 and it didn't work).

  6. Open Joplin 2.0.8. This upgrades your Joplin database so the old version can't use it anymore. That's why you need a backup.

  7. Ctrl+Shift+P (or Command+Shift+P), then "restoreNoteRevision NOTE_ID".

  8. Save your restored note somewhere outside Joplin.

  9. Replace ~/.config/joplin-desktop with your backup.

  10. Open the old Joplin and import your saved note.

Once version 2 is released, you can skip 5-6 and 8-10.

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.