How to Get Deleted SharePoint Files from Recycle Bin Using REST or Graph API
Question details
The user needs to programmatically retrieve and manage deleted files from SharePoint document libraries using REST or Graph API endpoints.
- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Automating the retrieval, restoration, or permanent deletion of files from a SharePoint list or document library recycle bin.
- Observed behavior
- The goal is to list current recycle-bin items, track file deletions, and execute restore or delete actions via API calls.
Ensure you have an active access token with the appropriate site collection administrator permissions or API scopes to authenticate your requests against your SharePoint environment.
Manage Deleted Files via SharePoint REST API
The SharePoint REST API provides comprehensive endpoints for listing, restoring, and permanently deleting items in the recycle bin.
For direct and detailed operations on the SharePoint recycle bin, the REST API is currently the most robust method compared to Microsoft Graph.
Send an HTTP GET request to `/_api/web/recyclebin` to retrieve a list of all deleted files and their unique identifiers currently held in the recycle bin.
To recover a file, send an HTTP POST request to `/_api/web/recyclebin('<recyclebinitemid>')/restore()` using the specific ID of the item obtained from the previous list.
To remove an item permanently, send an HTTP POST request to `/_api/web/recyclebin('<recyclebinitemid>')/deleteObject()`.
Track Deletions Using Microsoft Graph API
Microsoft Graph offers limited direct recycle bin management but can effectively track file deletions over time using delta queries.
Looking for a Seamless and Free Document Management Solution?
While SharePoint offers robust API capabilities for enterprise document management, setting up API calls can be complex. If you need a lightweight, cost-effective alternative for team collaboration and document handling, consider WPS Office. It provides robust cloud integration and an intuitive user interface without a steep learning curve.
- 1. Download WPS Office: Visit the official WPS website to download the free installation package.
- 2. Install and Launch: Run the installer and follow the on-screen instructions to complete the setup.
- 3. Access Cloud Features: Sign in with your WPS account to sync files across devices and manage your documents easily.

Frequently Asked Questions
Can I use Microsoft Graph to restore SharePoint recycle bin items?
Currently, Microsoft Graph provides limited support for direct recycle bin operations. It is highly recommended to use the SharePoint REST API's restore endpoint for reliably recovering deleted files.
Do I need special permissions to access the recycle bin via API?
Yes, the account or application executing the API calls must have sufficient permissions, such as Site Collection Administrator privileges or the appropriate OAuth scopes, to view and modify recycle bin items.
How do I find the ID of a deleted item for the REST API?
You can locate the item ID by first sending a GET request to the `/_api/web/recyclebin` endpoint. The JSON response will contain a list of all deleted items along with their unique GUIDs, which you can use for subsequent restore or delete commands.




