Compose an object

The compose operation creates a new object whose contents are the concatenationof a given sequence of up to 32 source objects. The sourceobjects must all reside in the same bucket and use the samestorage class.The source objects are unaffected by the compose operation, and the resultingcomposite object does not change if its source objects are replaced or deleted.

Composite objects may be built from source objects that are themselves compositeobjects.

For more information, seeComposite Objects.

Query string parameters

ParameterDescriptionRequired
compose Issues acompose request. Requires a ComposeRequest XML document in the request body.No

Seesigned URL query string parameters for information on the parametersyou include when creating and usingsigned URLs.

Request headers

In addition tocommon request headers, thefollowing can be used.

HeaderDescriptionRequired
Content-EncodingThe compression algorithm that was used to compress the composite object.No
Content-DispositionA header that specifies presentational information about how the object data is to be transmitted.No
x-goog-aclThe predefined ACL that you want to apply to the composite object.No
x-goog-custom-timeA user-specified date and time.No
x-goog-encryption-kms-key-nameThecustomer-managed encryption key to use to encrypt the composed object.No
x-goog-meta-An extension header that can be used to storecustom metadata.No
x-goog-object-lock-mode

Mode of the object'sretention configuration.GOVERNANCE corresponds to unlocked mode, andCOMPLIANCE corresponds to locked mode.

If this header is specified,x-goog-object-lock-retain-until-date must also be specified.

No
x-goog-object-lock-retain-until-date

A date and time represented inRFC 3339 UTC format that determines the time until which the object is retained as immutable.

If this header is specified,x-goog-object-lock-mode must also be specified.

No

To compose objects encrypted by a customer-supplied encryption key, use theheaders listed on the Encryption page in your request.

Request body elements

The following request body elements are applicable only if you use thecompose query string parameter to issue acompose request.

ElementDescription
ComposeRequestContainer for a compose request.
ComponentContainer for a compose request component argument.
NameObject name for a compose request component.
GenerationGeneration number for a compose request component.
IfGenerationMatchExpected current generation number for a compose request component. The request will fail if the component object has a different generation.

Request syntax

PUT /OBJECT_NAME?compose HTTP/1.1Host:BUCKET_NAME.storage.googleapis.comDate:DATEContent-Length:REQUEST_BODY_LENGTHAuthorization:AUTHENTICATION_STRING<ComposeRequest>  <Component>    <Name>component-obj-1</Name>  </Component>  <Component>    <Name>component-obj-2</Name>    <Generation>1361471441094000</Generation>  </Component>  <Component>    <Name>component-obj-3</Name>    <IfGenerationMatch>1361471441094000</IfGenerationMatch>  </Component></ComposeRequest>

Response headers

The request can return a variety of response headers depending on the request headers you use.

Response body elements

The response does not include an XML document in the response body.

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.