Filter SharePoint Recycle bin programmatically using SharePoint REST API

Since there is not yet a Microsoft Graph API endpoint to query the recycle bin of a SharePoint Site we can use the SharePoint REST API to filter for items with specifc values (e.g. deletion date).

Most of the properties in the recycle bin can be filtered with the $filter operator.

Filter for a file deleted at a specific date

To filter for files deleted at a specific date we can filter for the property DeletedDate. Numeric comparison operators (lt le gt ge eq ne) can be applied for this date field.

https://YourTenantName.sharepoint.com/sites/YourSiteName/_api/web/RecycleBin?$filter=(DeletedDate ge datetime'2023-10-18T07:19:21Z')

https://YourTenantName.sharepoint.com/sites/YourSiteName/_api/web/RecycleBin?$filter=(DeletedDate lt datetime'2023-10-18T07:19:21Z')

Filter for a specific file name

To filter for a specific file name you can filter for the property LeafName

https://YourTenantName.sharepoint.com/sites/YourSiteName/_api/web/RecycleBin?$filter=(LeafName eq 'Book.xlsx')