Objects: compose

Concatenates a list of existing objects into a new object in the same bucket. Try it now.

See Composite objects for a general discussion of object composition.

The authenticated user must have sufficient permission to use this method.

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


HTTP request

POST https://storage.googleapis.com/storage/v1/b/bucket/o/destinationObject/compose

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.


Parameter name Value Description
Path parameters
bucket string Name of the bucket containing the source objects. The destination object is stored in this bucket.
destinationObject string Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI path parts.
Optional query parameters
destinationPredefinedAcl string Apply a predefined set of access controls to the destination object.

Acceptable values are:
  • authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access.
  • bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access.
  • bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access.
  • private: Object owner gets OWNER access.
  • projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles.
  • publicRead: Object owner gets OWNER access, and allUsers get READER access.
If iamConfiguration.uniformBucketLevelAccess.enabled is set to true, requests that include this parameter fail with a 400 Bad Request response.
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.
ifMetagenerationMatch long Makes the operation conditional on whether the object's current metageneration matches the given value.
kmsKeyName string Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request.

Request body

In the request body, supply data with the following structure:

  "kind": "storage#composeRequest",
  "sourceObjects": [
      "name": string,
      "generation": "long",
      "objectPreconditions": {
        "ifGenerationMatch": "long"
  "destination": objects Resource
Property name Value Description Notes
kind string The kind of item this is.
destination nested object Properties of the resulting object. writable
sourceObjects[] list The list of source objects that will be concatenated into a single object. There is a limit of 32 components that can be composed in a single operation.
sourceObjects[].name string The source object's name. All source objects must reside in the same bucket and use the same storage class. writable
sourceObjects[].generation long1 The generation of this object to use as the source. writable
sourceObjects[].objectPreconditions object Conditions that must be met for this operation to execute.
sourceObjects[].objectPreconditions.ifGenerationMatch long1 Only perform the composition if the generation of the source object that would be used matches this value. If this value and a generation are both specified, they must be the same value or the call will fail. writable
1 This property is a string formatted as the specified value type.


If successful, this method returns an object resource in the response body, with the owner and acl properties omitted.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.