cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Undelete a File via the API

How to Undelete a File via the API

Richard T. S.
New member | Level 2

I tried to  do a restore ... that did not seem to work.

Is undelete only available via the Web interface ?

22 Replies 22

Richard T. S.
New member | Level 2

I can confirm that it has been fixed ...

Sún B.
New member | Level 1

Hi everyone,

I was searching for a way to use Dropbox API to restore my files and Google brought me here.

First of all, a bit about my situation:

My computer got a virus that rename all of my files (idk if its recognized as rename or delete on Dropbox) and they are all synced to Dropbox. I want to download all my original files using Dropbox API.

As i can see on web interface, I can download them individually but I got like thousand files so I couldn't do it.

My problem:

I used Python API wrapper to work with Dropbox API. I first fetched all of my files and tried to get all of their revisions but the original files are not included in revision list.

Then I tried to list all of my files including deleted files and I can see my original files listed. I tried to download them using download endpoint but it returned `File not found` error. Has anyone bumped into something similar? How can I solve this issue?

My code snippet:

dbx = dropbox.Dropbox('token is intentionally hidden')
print dbx.users_get_current_account()
for entry in dbx.files_list_folder('', recursive = False, include_deleted = True).entries:
  if (isinstance(entry, dropbox.files.FileMetadata) or isinstance(entry, dropbox.files.DeletedMetadata)):
    if not entry.name.endswith('cerber2'):
      print "name: ", entry.name, "| path: ", entry.path_lower 
      print repr(entry)
      meta = dbx.files_restore(entry.path_lower)
      print repr(meta)
      try:
        meta, resp = dbx.files_download(entry.path_lower)
      except dropbox.exceptions.ApiError as e:
        print e.user_message_text
      print "-" * 80

Greg-DB
Dropbox Staff

[Cross-linking for reference: https://stackoverflow.com/questions/38912264/restore-deleted-files-using-dropbox-api ]

Hi Sún, it looks like you posted this on StackOverflow too, so I'll help over there, so that we don't spam the other people on this thread.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Sún B. New member | Level 1
  • User avatar
    Richard T. S. New member | Level 2
What do Dropbox user levels mean?