Objects

The Objects resource represents an object within Cloud Storage. Objects are pieces of data that you have uploaded to Cloud Storage. For more information, seeObject Name Requirements.

Every object in Cloud Storage resides in abucket. The object is owned by its original uploader, who will always retainOWNER permission on it.

In addition to theacl property, objects containobjectAccessControls, for use in fine-grained manipulation of an existing object's access controls.

To try out the methods for this resource, seeMethods.

Resource representations

{"kind":"storage#object","id":string,"selfLink":string,"mediaLink":string,"name":string,"bucket":string,"generation":"long","metageneration":"long","contentType":string,"storageClass":string,"size":"unsigned long","softDeleteTime":"datetime","restoreToken":string,"hardDeleteTime":"datetime","md5Hash":string,"contentEncoding":string,"contentDisposition":string,"contentLanguage":string,"cacheControl":string,"crc32c":string,"componentCount":integer,"etag":string,"kmsKeyName":string,"temporaryHold":boolean,"eventBasedHold":boolean,"retentionExpirationTime":"datetime","retention":{"retainUntilTime":"datetime","mode":string}"timeCreated":"datetime","timeFinalized":"datetime","updated":"datetime","timeDeleted":"datetime","timeStorageClassUpdated":"datetime","customTime":"datetime","metadata":{(key):string},"acl":[objectAccessControlsResource],"owner":{"entity":string,"entityId":string},"customerEncryption":{"encryptionAlgorithm":string,"keySha256":string}"contexts":{"custom":{(key):{"value":string,"createTime":"datetime","updateTime":"datetime"}}}}
Property nameValueDescriptionNotes
acl[]list

Access controls on the object, containing one or moreobjectAccessControls Resources. Only requests that use the"projection=full" query parameter return this field in the response.

IfiamConfiguration.uniformBucketLevelAccess.enabled is set totrue, this field does not apply, and requests that specify it fail.

writable
bucketstringThe name of the bucket containing this object.
cacheControlstringCache-Control directive for the object data. If omitted, and the object is accessible to all anonymous users, the default is"public, max-age=3600".writable
componentCountintegerReturned forcomposite objects only. Number of non-composite objects in the composite object.componentCount includes non-composite objects that were part of any composite objects used tocompose the current object.
contentDispositionstringContent-Disposition of the object data.writable
contentEncodingstringContent-Encoding of the object data.writable
contentLanguagestringContent-Language of the object data.writable
contentTypestringContent-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream.writable
contextsobjectContexts attached to an object, in key-value pairs. For more information about object contexts, seeObject contexts overview. writable
contexts.customobjectUser-provided object contexts. writable
contexts.custom.(key)objectAn individual object context. Context keys and their corresponding values must start with an alphanumeric character. They can contain any Unicode characters except single quotes ('), double quotes ("), backslashes (\), and forward slashes (/). Additionally, duplicate keys are prohibited. writable
contexts.custom.(key).valuestringThe value associated with this context. This field holds the primary information for the given context key. writable
contexts.custom.(key).createTimedateTimeThe time when context was first added to thestorage#object inRFC 3339 format.
contexts.custom.(key).updateTimedateTimeThe time when context was last updated inRFC 3339 format.
crc32cstringCRC32c checksum, as described inRFC 4960, Appendix B; encoded usingbase64 in big-endian byte order. For more information about using the CRC32c checksum, seeData validation.writable
customerEncryptionobjectMetadata of customer-supplied encryption key, if the object is encrypted by such a key.
customerEncryption.encryptionAlgorithmstringThe encryption algorithm.
customerEncryption.keySha256stringSHA256 hash value of the encryption key; encoded usingbase64.
customTimedatetime1A user-specified timestamp for the object inRFC 3339 format. Once set on an object,customTime cannot be removed and cannot be set to an earlier datetime. For more information, seecustom time metadata.writable
etagstringHTTP 1.1Entity tag for the object.
eventBasedHoldbooleanWhether or not the object is subject to anevent-based hold.writable
generationlong1The content generation of this object. Used forobject versioning andsoft delete.
idstringThe ID of the object, including the bucket name, object name, and generation number.
kindstringThe kind of resource being described. For objects, this is always"storage#object".
kmsKeyNamestringCloud KMS key used to encrypt this object, if the object is encrypted by such a key.
md5HashstringMD5 hash of the data, encoded usingbase64. This field is not present forcomposite objects. For more information about using the MD5 hash, seeData validation.writable
mediaLinkstringA URL for downloading the object's data. You should generally use one of the otherJSON API endpoints instead.
metadataobjectUser-provided metadata, in key-value pairs.writable
metadata.(key)stringAn individual metadata entry.writable
metagenerationlong1The version of the metadata for this object at this generation. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object.
namestringThe name of the object. Required if not specified by URL parameter.writable
ownerobject

The owner of the object. This is always the uploader of the object. Only requests that use the"projection=full" query parameter return this field in the response.

IfiamConfiguration.uniformBucketLevelAccess.enabled is set totrue, this field does not apply.

owner.entitystringThe entity, in the form"user-emailAddress".
owner.entityIdstringThe ID for the entity.
restoreTokenstringApplicable in buckets withhierarchical namespace enabled. TherestoreToken is a universally unique identifier (UUID) associated with eachsoft-deleted object and can be used in requests to restore a soft-deleted object or retrieve its metadata.

TherestoreToken is only required when thename andgeneration values of an objectdo not uniquely identify it. Otherwise, including arestoreToken is optional.

retentionobjectThe object'sretention configuration, which defines the earliest datetime that the object can be deleted or replaced.writable
retention.modestringThe mode of the retention configuration, which can be eitherUnlocked orLocked. If set toLocked,retention.mode cannot be changed, the retention configuration cannot be removed, andretention.retainUntilTime cannot be reduced.writable
retention.retainUntilTimedatetime1The earliest time that the object can be deleted or replaced, inRFC 3339 format. This property has a maximum value of 3,155,760,000 seconds (100 years) from the current date and time.writable
retentionExpirationTimedatetime1The earliest time that the object can be deleted, which depends on anyretention configuration set for the object and anyretention policy set for the bucket that contains the object. The value forretentionExpirationTime is given inRFC 3339 format.
selfLinkstringA URL for this object. You should generally use one of the otherJSON API endpoints instead.
sizeunsigned long1Content-Length of the data in bytes.
softDeleteTimedatetimeThe time at which the object wassoft deleted. Only available for objects in buckets with a soft delete policy.
hardDeleteTimedatetimeThe time at which a soft-deleted object is permanently deleted and can no longer be restored. The value is the sum of thesoftDeleteTime value and thesoftDeletePolicy.retentionDurationSeconds value of the bucket. Only available for objects in buckets with a soft delete policy. Note that thehardDeleteTime value is permanent once set and does not change in response tosoftDeletePolicy.retentionDurationSeconds changes.
storageClassstringStorage class of the object. To change an object's storage class, useobjects rewrite.writable
temporaryHoldbooleanWhether or not the object is subject to atemporary hold.writable
timeCreateddatetime1The creation time of the object inRFC 3339 format.
timeFinalizeddatetime1The finalization time of the object inRFC 3339 format.
timeDeleteddatetime1The deletion time of the object inRFC 3339 format. Returned if and only if this version of the object is no longer a live version, but remains in the bucket as anoncurrent version.
timeStorageClassUpdateddatetime1The time at which the object's storage class was last changed. When the object is initially created, it is set totimeCreated.
updateddatetime1Themodification time of the object metadata inRFC 3339 format. Set initially to object creation time and then updated whenever any metadata of the object changes. This includes changes made by a requester, such as modifying custom metadata, as well as changes made by Cloud Storage on behalf of a requester, such as changing the storage class based on an Object Lifecycle Configuration.
1 This property is a string formatted as the specified value type.

Methods

Available methods for Objects resources are as follows:

bulkRestore
Asynchronously restores the soft-deleted objects in a bucket.
compose
Concatenates a list of existing objects into a new object in the same bucket.
copy
Copies a source object to a destination object. Optionally overrides metadata.
delete
Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if thegeneration parameter is used.
get
Retrieves an object or its metadata.
insert
Stores a new object and metadata. For more information about writing data to Cloud Storage, seeUploads and downloads.
list
Retrieves a list of objects matching the criteria.
move
Moves an object within a bucket withhierarchical namespace enabled.
patch
Updates a data blob's associated metadata. This method supportspatch semantics.
restore
Restores a soft-deleted object.
rewrite
Rewrites a source object to a destination object. Optionally overrides metadata.
update
Updates an object's metadata.
watchAll
Watch for changes on all objects in a bucket.

For information about status and error codes returned by these APIs, see thereference page.

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

Last updated 2025-12-17 UTC.