[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/storage/docs/soft-delete [Back]  [Original]

Soft delete overview  |  Cloud Storage  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Soft delete overview Stay organized with collections Save and categorize content based on your preferences.

Setup Usage

Soft delete helps protect your Cloud Storage data in case an object or bucket is accidentally or maliciously deleted. The soft delete feature preserves objects and buckets that get deleted or overwritten by retaining them in a soft-deleted state for a specified period of time. During this time, the object or bucket can't be permanently deleted and can be restored.

Soft delete is enabled by default for all buckets that support it, with a default retention duration of 7 days. You can set a different default retention duration by using tags.

This page describes how soft delete works.

Caution: If a bucket primarily contains temporary data, enabling soft delete can result in significantly increased storage costs. To learn how to mitigate soft delete costs for such buckets, see Reduce costs for temporary objects.

Soft delete policies

When soft delete is enabled on a bucket, deleting the bucket or the objects within the bucket results in the resource entering a soft-deleted state instead of being permanently deleted. To enable soft delete on a bucket, you set a soft delete policy that defines how long soft-deleted resources are retained.

Soft delete policies work in the following ways:

To learn how to set and manage soft delete policies on buckets, see Set and manage soft delete policies.

Properties of soft-deleted resources

When a bucket or object is deleted under an active soft delete policy, the resource transitions to a soft-deleted state. You can restore soft-deleted resources during their retention duration.

Soft-deleted resources have the following characteristics:

For instructions on restoring soft-deleted objects or buckets, see Restore soft-deleted objects or Restore soft-deleted buckets.

Object restores

When you restore a soft-deleted object, Cloud Storage creates a new, live copy of that object within the same bucket. The original, soft-deleted version remains in the background until its retention period officially expires. The following list describes core restore behaviors:

Object restore methods

You can restore soft-deleted objects by using one of two execution paths, based on your scale requirements:

Restoring objects with duplicate paths

Although rare, duplicate soft-deleted objects with identical names and generation values can occur in buckets with hierarchical namespace enabled. This conflict can happen if you rename folders that contain objects with duplicate names in buckets with hierarchical namespace enabled. In this scenario, it's rare but possible that two soft-deleted objects might coincidentally share the same generation number.

To understand this scenario, see the following example:

  1. You have an object named cat.png inside a folder named my-folder-A. cat.png is assigned a generation number of 999. You delete cat.png, which becomes soft deleted.

  2. You delete the empty parent folder my-folder-A.

  3. Elsewhere in your storage, you have a folder named my-folder-B. Inside this folder is a different object named cat.png. Purely by coincidence, this cat.png object is also assigned a generation number of 999. You rename my-folder-B to my-folder-A. Because of hierarchical namespace, the object's path changes to my-folder-A/cat.png.

  4. You delete this second cat.png, which becomes soft deleted.

Now, there are two soft-deleted objects named cat.png with the generation number 999.

To restore, list, or access a specific soft-deleted object version among duplicates, you must supply a unique restoreToken parameter in your request. Including the restoreToken parameter is required when restoring, listing, or accessing soft-deleted object versions in buckets with hierarchical namespace enabled. Failing to include the restoreToken parameter when duplicates objects exist results in an error prompting you for the token. Submitting the wrong token, name, or generation number will return an error indicating that the object couldn't be found. For more information on the restoreToken parameter, see the objects.restore method.

Pricing

Soft-deleted objects continue to accrue storage charges until their retention period expires and they're permanently deleted. Objects that get soft deleted before their minimum storage duration ends incur early deletion charges, unless that object was stored in Standard storage.

For detailed information about costs associated with soft delete, see Cloud Storage pricing.

Reduce costs for temporary objects when using soft delete

If a bucket primarily contains short-lived, temporary objects, enabling soft delete on the bucket can result in significantly increased storage costs. To help reduce costs for temporary objects, we recommend the following:

Temporary objects typically have a short lifecycle before they're deleted. Temporary objects might be:

Interactions with other products and features

When soft delete is enabled, it behaves with other products and features in the following ways:

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-17 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-17 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page