Stay organized with collectionsSave and categorize content based on your preferences.
Initiates a long-running operation to bulk restore multiplesoft-deleted objectsin a bucket. Soft-deleted objects that
meet the criteria defined in the request body parameters are restored to the bucket.
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:
ThecreateTimeof the new object is set to the time at which the soft-deleted
object was restored.
ThesoftDeleteTimeandhardDeleteTimevalues are cleared.
A new generation is assigned and the metageneration is reset to 1.
If the soft-deleted object was in a bucket that had Autoclass enabled, the new object is
restored to Standard storage.
The restored object inherits the bucket's default object ACL, unlesscopySourceAclistrue.
If a live object using the same name already exists in the bucket and becomes overwritten,
the live object becomes a noncurrent object ifObject Versioningis enabled on the bucket. If
Object Versioning is not enabled, the live object becomes soft deleted.
The specified bucket must have a soft delete policy. Otherwise, the request fails with a400 Bad Requesterror with the reasonSoftDeletePolicyRequired.
Required permissions
The authenticated user must have the following IAM permissions to use this
method:
storage.buckets.restore
storage.objects.restore
storage.objects.create
storage.objects.setIamPolicy(only required ifcopySourceAclistrueand the relevant bucket hasuniform
bucket-level accessdisabled)
Request
HTTP request
POST https://storage.googleapis.com/storage/v1/b/bucket/o/bulkRestore
To see an example of how to include query parameters in a request, see theJSON API Overviewpage.
Parameters
Parameter name
Value
Description
Path parameters
bucket
string
Name of the bucket in which objects will be restored.
Request body
In the request body, supply a data structure with the following properties:
Property name
Value
Description
Notes
allowOverwrite
boolean
Iffalse(default), the bulk restore operation will not overwrite
live objects that have the same name as the soft-deleted objects to be restored. This means
that some soft-deleted objects might not get restored.
Iftrue, live objects
that have the same name as the soft-deleted objects will be overwritten. IfObject Versioningis enabled on the bucket, the live objects will become noncurrent when overwritten. If
Object Versioning is not enabled, the live object will become soft-deleted when
overwritten. Noncurrent objects that have the same name as the soft-deleted objects to be
restored do not get overwritten.
writable
matchGlob
string
Restores only the soft-deleted objects that match the specified glob. If this parameter
is not specified, all soft-deleted objects that match the specified time range are
restored. For more information about glob syntax, see thematch glob documentation.
writable
softDeletedAfterTime
string
Restores only the soft-deleted objects that were soft deleted after the specified
time.
writable
softDeletedBeforeTime
string
Restores only the soft-deleted objects that were soft deleted before the specified
time.
writable
copySourceAcl
boolean
Applicable only for buckets that don't haveuniform bucket-level accessenabled. Iftrue, copies the soft-deleted object's ACL and applies it to the
restored object. Iffalseor not specified, the restored object inherits
the bucket's default object ACL.
writable
Response
If successful, this method returns an instance ofoperationin the response body:
{
"name": "string",
"metadata": {object(BulkRestoreObjectsMetadata)},
"done": "boolean",
// Union field result can be only one of the following:
"error": {object(Status)},
"response": {}
// End of list of possible types for union field result
}
succeededCountis the number of successfully restored objects.
skippedCountis the number of objects skipped as a result of the specifiedsoftDeletedAfterTime,softDeletedBeforeTime, andmatchGlobsparameters. If multiple generations of an object match the criteria, only the latest
generation is restored and the rest are skipped.
failedCountis the number of objects that failed to be restored. Objects
can fail to be restored if, for example, a live object with the same name cannot be rewritten.
done
boolean
Iffalse, indicates that the operation is still in progress, and neithererrornorresponseis set. Iftrue, the operation is completed and eithererrororresponseis set.
error
object
Indicates that the operation is considered to be successful, unless it failed to
start because of invalid parameters, or because of an access denied error. For information
about status and error codes returned by this API, see thereference page.
response
object
Empty. Detailed error information can be obtained fromCloud Audit Logs.
Try it!
Use the APIs Explorer below to call this method on live data and see the response.
[[["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-09-04 UTC."],[],[],null,["# Objects: bulkRestore\n\nInitiates a long-running operation to bulk restore multiple\n[soft-deleted objects](/storage/docs/soft-delete) in a bucket. Soft-deleted objects that\nmeet the criteria defined in the request body parameters are restored to the bucket.\n\nWhen a soft-deleted object is restored, a new copy of that object is created in the same bucket\nand inherits the same metadata as the soft-deleted object. The inherited metadata is the metadata\nthat existed when the original object became soft deleted, with the following exceptions:\n\n- The `createTime` of the new object is set to the time at which the soft-deleted object was restored.\n- The `softDeleteTime` and `hardDeleteTime` values are cleared.\n- A new generation is assigned and the metageneration is reset to 1.\n- If the soft-deleted object was in a bucket that had Autoclass enabled, the new object is restored to Standard storage.\n- The restored object inherits the bucket's default object ACL, unless `copySourceAcl` is `true`.\n\n\u003cbr /\u003e\n\nIf a live object using the same name already exists in the bucket and becomes overwritten,\nthe live object becomes a noncurrent object if\n[Object Versioning](/storage/docs/object-versioning) is enabled on the bucket. If\nObject Versioning is not enabled, the live object becomes soft deleted.\n\nThe specified bucket must have a soft delete policy. Otherwise, the request fails with a\n`400 Bad Request` error with the reason `SoftDeletePolicyRequired`.\n\nRequired permissions\n--------------------\n\nThe authenticated user must have the following IAM permissions to use this\nmethod:\n\n- `storage.buckets.restore`\n- `storage.objects.restore`\n- `storage.objects.create`\n- `storage.objects.setIamPolicy` (only required if `copySourceAcl` is `true` and the relevant bucket has [uniform\n bucket-level access](/storage/docs/uniform-bucket-level-access) disabled)\n\n\u003cbr /\u003e\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://storage.googleapis.com/storage/v1/b/bucket/o/bulkRestore\n```\n\nIn addition to [standard query parameters](/storage/docs/json_api/v1/parameters#query),\nthe following query parameters apply to this method.\n\nTo see an example of how to include query parameters in a request, see the\n[JSON API Overview](/storage/docs/json_api#query_parameters) page.\n\n### Parameters\n\n### Request body\n\nIn the request body, supply a data structure with the following properties:\n\nResponse\n--------\n\nIf successful, this method returns an instance of\n[operation](https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto)\nin the response body: \n\n```\n{\n \"name\": \"string\",\n \"metadata\": { object (BulkRestoreObjectsMetadata)},\n \"done\": \"boolean\",\n // Union field result can be only one of the following:\n \"error\": { object (Status)},\n \"response\": {}\n // End of list of possible types for union field result\n}\n```\n\nTry it!\n-------\n\nUse the APIs Explorer below to call this method on live data and see the response."]]