Stay organized with collections Save and categorize content based on your preferences.
Restores a soft-deleted object.
When a soft-deleted object is restored, a new copy of that object is created in the same bucket and inherits the same metadata as the soft-deleted object. The inherited metadata is the metadata that existed when the original object became soft deleted, with the following exceptions:
createTime
of the new object is set to the time at which the soft-deleted object was restored.softDeleteTime
and hardDeleteTime
values are cleared.copySourceAcl
is true
.If a live object using the same name already exists in the bucket and becomes overwritten, the live object becomes a noncurrent object if Object Versioning is enabled on the bucket. If Object Versioning is not enabled, the live object becomes soft deleted.
Required permissionsThe authenticated user must have the following IAM permissions to use this method:
storage.objects.restore
storage.objects.create
storage.objects.delete
(only required if overwriting an existing object)storage.objects.getIamPolicy
(only required if projection
is full
and the relevant bucket has uniform bucket-level access disabled)storage.objects.setIamPolicy
(only required if copySourceAcl
is true
and the relevant bucket has uniform bucket-level access disabled)POST https://storage.googleapis.com/storage/v1/b/bucket/o/object/restore
In addition to standard query parameters, the following query parameters apply to this method.
To see an example of how to include query parameters in a request, see the JSON API Overview page.
Parameters Parameter name Value Description Path parametersbucket
string
Name of the bucket in which the new object will be created. Must be the same bucket that contained the soft-deleted object being restored. object
string
Name of the soft-deleted object to restore. For information about how to URL encode object names to be path safe, see Encoding URI path parts. Required query parameters generation
long
Specifies the version of the soft-deleted object to restore. Optional query parameters copySourceAcl
boolean
Applicable only for buckets that don't have uniform bucket-level access enabled. If true
, copies the soft-deleted object's ACL and applies it to the restored object. If false
or not specified, the restored object inherits the bucket's default object ACL. ifGenerationMatch
long
Makes the operation conditional on there being a live version of the object with a generation number that matches the given value. Setting ifGenerationMatch
to 0 makes the operation succeed only if there is no such live object. ifGenerationNotMatch
long
Makes the operation conditional on there being a live version of the object with a generation number that does not match the given value. If no live object exists, the precondition fails. Setting ifGenerationNotMatch
to 0 makes the operation succeed if there is a live version of the object. ifMetagenerationMatch
long
Makes the operation conditional on there being a live version of the object with a metageneration number that matches the given value. ifMetagenerationNotMatch
long
Makes the operation conditional on there being a live version of the object with a metageneration number that does not match the given value. projection
string
Set of properties to return. Defaults to noAcl
.
Acceptable values are:
full
: Include all properties.noAcl
: Omit the owner
, acl
property.restoreToken
string
Applicable in buckets with hierarchical namespace enabled. The restoreToken
is a universally unique identifier (UUID) associated with each soft-deleted object.
When restoring a soft-deleted object, the restoreToken
is only required when the name
and generation
values of the object do not uniquely identify it. Otherwise, including a restoreToken
in the request is optional.
Do not supply a request body with this method.
ResponseIf successful, this method returns an object resource in the response body.
The following errors could occur:
400 Bad Request
error with the reason SoftDeletePolicyRequired
.404 Not Found
error with the reason notFound
.412 Failed Precondition
error with the reason objectNotSoftDeleted
.403 Forbidden
error with the reason retentionPolicyNotMet
.For more information about status and error codes returned by this API, see the reference page.
Try it!Use the APIs Explorer below to call this method on live data and see the response.
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 2025-08-07 UTC.
[[["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 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4