Stay organized with collectionsSave and categorize content based on your preferences.
Updates a data blob's associated metadata. This method supportspatchsemantics.
Required permissions
The authenticated user must have thestorage.objects.updateIAM
permission to use this method. If the request body includes theretentionproperty,
the authenticated user must also have thestorage.objects.setRetentionIAM permission, and if the request includes the query parameteroverrideUnlockedRetention, the authenticated user must also have thestorage.objects.overrideUnlockedRetentionIAM permission.
To update object access control lists (ACLs), which only apply to objects stored in buckets withuniform bucket-level accessdisabled, the
authenticated user must also have thestorage.objects.setIamPolicypermission. To
return ACLs as part of the response, the authenticated user must also have thestorage.objects.getIamPolicypermission.
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 the object resides.
object
string
Name of the object. For information about how to URL encode object names to be path safe,
seeEncoding URI path parts.
Optional query parameters
generation
long
If present, selects a specific revision of this object (as opposed to the latest version,
the default).
ifGenerationMatch
long
Makes the operation conditional on whether the object's current generation matches the
given value. Setting to 0 makes the operation succeed only if there are no live versions
of the object.
ifGenerationNotMatch
long
Makes the operation conditional on whether the object's current generation does not match
the given value. If no live object exists, the precondition fails. Setting to 0 makes the
operation succeed only if there is a live version of the object.
ifMetagenerationMatch
long
Makes the operation conditional on whether the object's current metageneration matches
the given value.
ifMetagenerationNotMatch
long
Makes the operation conditional on whether the object's current metageneration does not
match the given value.
overrideUnlockedRetention
boolean
Applicable for object's that have an unlockedretention configuration: Required to be set totrueif the operation includes aretentionproperty that changes
themodetoLocked, reduces theretainUntilTime,
or removes the retention configuration from the object.
predefinedAcl
string
Apply a predefined set of access controls to this object.
IfiamConfiguration.uniformBucketLevelAccess.enabledis set totrue, requests that include this parameter fail with a400 Bad Requestresponse.
projection
string
Set of properties to return. Defaults tonoAcl.
NOTE: Currently only
works if you override the default and specifyfull.
Acceptable values are:
full: Include all properties.
noAcl: Omit theowner,aclproperty.
Optional extension headers
X-Goog-Encryption-Algorithm
string
The encryption algorithm to use, which must beAES256. Use this header if the
object is encrypted with acustomer-supplied
encryption keyand you want the object's content hashes returned in the response.
X-Goog-Encryption-Key
string
AnRFC 4648Base64-encoded string of your AES-256 encryption key. Use this header if the object is
encrypted with acustomer-supplied
encryption keyand you want the object's content hashes returned in the response.
X-Goog-Encryption-Key-Sha256
string
AnRFC 4648Base64-encoded string of the SHA256 hash of your encryption key. Use this header if the
object is encrypted with acustomer-supplied
encryption keyand you want the object's content hashes returned in the response.
Request body
In the request body, supply the relevant portions of anobject resource, according to the rules
of patch semantics.
Response
If successful, this method returns anobject resourcein the response body.
For information about status and error codes returned by this API, see thereference page.
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: patch\n\nUpdates a data blob's associated metadata. This method supports\n[patch](/storage/docs/json_api#patch) semantics.\n\nRequired permissions\n--------------------\n\nThe authenticated user must have the `storage.objects.update` IAM\npermission to use this method. If the request body includes the `retention` property,\nthe authenticated user must also have the `storage.objects.setRetention`\nIAM permission, and if the request includes the query parameter\n`overrideUnlockedRetention`, the authenticated user must also have the\n`storage.objects.overrideUnlockedRetention` IAM permission.\n\nTo update object access control lists (ACLs), which only apply to objects stored in buckets with\n[uniform bucket-level access](/storage/docs/uniform-bucket-level-access) disabled, the\nauthenticated user must also have the `storage.objects.setIamPolicy` permission. To\nreturn ACLs as part of the response, the authenticated user must also have the\n`storage.objects.getIamPolicy` permission.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPATCH https://storage.googleapis.com/storage/v1/b/bucket/o/object\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 the relevant portions of an\n[object resource](/storage/docs/json_api/v1/objects#resource), according to the rules\nof patch semantics.\n\nResponse\n--------\n\nIf successful, this method returns an\n[object resource](/storage/docs/json_api/v1/objects#resource) in the response body.\n\nFor information about status and error codes returned by this API, see the\n[reference page](/storage/docs/json_api/v1/status-codes).\n\nTry it!\n-------\n\nUse the APIs Explorer below to call this method on live data and see the response."]]