Updates the metadata of an object.
Request
HTTP request
PUT https://storage.googleapis.com/storage/v1/b/ bucket /o/ object
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
bucket 
string 
object 
string 
generation 
long 
ifGenerationMatch 
long 
ifGenerationNotMatch 
long 
ifMetagenerationMatch 
long 
ifMetagenerationNotMatch 
long 
overrideUnlockedRetention 
boolean 
true 
if the operation includes a retention 
property that changes
          the mode 
to Locked 
, reduces the retainUntilTime 
,
          or removes the retention configuration from the object.predefinedAcl 
string 
Acceptable values are:
-  authenticatedRead: Object owner getsOWNERaccess, andallAuthenticatedUsersgetREADERaccess.
-  bucketOwnerFullControl: Object owner getsOWNERaccess, and project team owners getOWNERaccess.
-  bucketOwnerRead: Object owner getsOWNERaccess, and project team owners getREADERaccess.
-  private: Object owner getsOWNERaccess.
-  projectPrivate: Object owner getsOWNERaccess, and project team members get access according to their roles.
-  publicRead: Object owner getsOWNERaccess, andallUsersgetREADERaccess.
iamConfiguration.uniformBucketLevelAccess.enabled 
is set to true 
, requests that include this parameter fail with a 400 Bad Request 
response.projection 
string 
full 
.Acceptable values are:
-  full: Include all properties.
-  noAcl: Omit theowner,aclproperty.
X-Goog-Encryption-Algorithm 
string 
AES256 
. Use this header if the
          object is encrypted with a customer-supplied
          encryption key 
and you want the object's content hashes returned in the response.X-Goog-Encryption-Key 
string 
X-Goog-Encryption-Key-Sha256 
string 
Request body
In the request body, supply an object resource with any of the following optional properties:
| Property name | Value | Description | Notes | 
|---|---|---|---|
| acl[] | list | Access controls on the object. If empty, this parameter is ignored. Can contain one or more objectAccessControls Resources . | writable | 
| cacheControl | string | Cache-Control 
directive for the object data. If omitted, and the object is accessible to all anonymous
          users, the default will be "public, max-age=3600". | writable | 
| contentDisposition | string | Content-Disposition of the object data. | writable | 
| contentEncoding | string | Content-Encoding of the object data. | writable | 
| contentLanguage | string | Content-Language of the object data. | writable | 
| contentType | string | Content-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream. | writable | 
| contexts | object | Contexts attached to the object, specified in key-value pairs. For more information about object contexts ( Preview ), see Object context overview . For specific JSON formats and combinations, see Attach or modify contexts to an existing object . | writable | 
| customTime | datetime1 | A user-specified timestamp for the object in RFC 3339 
format. If the
          object has customTimemetadata already set on it, any update request must
          include acustomTimewith an equal or later datetime. | writable | 
| eventBasedHold | boolean | Whether or not the object is subject to an event-based hold . | writable | 
| metadata | object | User-provided metadata, in key/value pairs. | writable | 
| metadata.(key) | string | An individual metadata entry. | writable | 
| retention | object | The object's retention configuration , which defines the earliest datetime that the object can be deleted or replaced. | writable | 
| retention.mode | string | The mode of the retention configuration, which can be either UnlockedorLocked. If set toLocked,retention.modecannot be
          changed, the retention configuration cannot be removed, andretention.retainUntilTimecannot be reduced. | writable | 
| retention.retainUntilTime | datetime1 | The earliest time that the object can be deleted or replaced, in RFC 3339 format. This property has a maximum value of 3,155,760,000 seconds (100 years) from the current date and time. | writable | 
| temporaryHold | boolean | Whether or not the object is subject to a temporary hold . | writable | 
Response
If successful, this method returns an object resource in the response body.
For 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.

