Storage

Delete Objects

Learn about deleting objects

When you delete one or more objects from a bucket, the files are permanently removed and not recoverable. You can delete a single object or multiple objects at once.

Delete objects

To delete one or more objects, use the remove method.


_10
await supabase.storage.from('bucket').remove(['object-key-1', 'object-key-2'])

RLS

To delete an object, the user must have the delete permission on the object. For example:


_10
create policy "User can delete their own objects"
_10
on storage.objects
_10
for delete
_10
TO authenticated
_10
USING (
_10
owner_id = (select auth.uid())
_10
);