Complete a multipart upload Stay organized with collections Save and categorize content based on your preferences.
Completes amultipart upload by concatenating the parts into a singleobject.
Cloud Storage can take several minutes to process a request to complete amultipart upload. Once the request completes, the object created from the uploadreplaces any existing object with the same name, and the parts from themultipart upload no longer exist, whether or not they were used to assemble thefinal object.
An object created from a multipart upload has a CRC32c hash, but not an MD5hash, and the object's ETag is not based on an MD5 hash.
Query string parameters
| Parameter | Description | Required |
|---|---|---|
uploadId | Indicates the multipart upload that this request is associated with. | Yes |
Seesigned URL query string parameters for information on the parametersyou include when creating and usingsigned URLs.
Request headers
The following request headers can be used.
| Header | Description | Required |
|---|---|---|
Authorization | The authentication string for the request. | Yes |
Content-Length | The length of the request body without headers (in bytes). | Yes |
Content-Type | The MIME type of the request body. When completing a multipart upload, this value should beapplication/xml. | No |
Date | The date and time of the request. | Yes |
Host | The URI for Cloud Storage. For more information, seeRequest Endpoints. | Yes |
x-goog-user-project | The project to be billed for charges associated with the request. | No |
If you specified a customer-supplied encryption key in the request to initiatethe multipart upload, you must use thesame headers and values in therequest to complete the upload.
Request body elements
The following request body elements are applicable if you use theuploadIdquery string parameter to complete a multipart upload. All request bodyelements are required.
| Element | Description |
|---|---|
CompleteMultipartUpload | Container for the request to complete the multipart upload. |
Part | A container for each part of the multipart upload. |
PartNumber | Number that identifies the part and its order in the overall multipart upload. |
ETag | The entity tag for the part, which was returned when the part was uploaded. |
Response headers
Included in the response headers is anx-goog-hash header that specifiesthe CRC32C base64-encoded checksum of the object.
Response body elements
The following response body elements apply to POST Object requests that use theuploadId query string parameter to complete a multipart upload.
| Element | Description |
|---|---|
CompleteMultipartUploadResult | Container for the response to the request to complete the multipart upload. |
Location | A request endpoint that can be used to access the object created from the upload. |
Bucket | The name of the bucket that contains the object created from the upload. |
Key | The name of the object created from the upload. |
ETag | An entity tag that uniquely identifies the object created from the upload. |
Example
The following sample completes a multipart upload. It creates an object namedparis.jpg from two parts in a bucket namedtravel-maps.
Request
POST /paris.jpg?uploadId=VXBsb2FkIElEIGZvciBlbHZpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA HTTP/2Host: travel-maps.storage.googleapis.comDate: Fri, 2 Apr 2021 18:11:50 GMTContent-Type: application/xmlContent-Length: 232Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg<CompleteMultipartUpload> <Part> <PartNumber>2</PartNumber> <ETag>"7778aef83f66abc1fa1e8477f296d394"</ETag> </Part> <Part> <PartNumber>5</PartNumber> <ETag>"aaaa18db4cc2f85cedef654fccc4a4x8"</ETag> </Part></CompleteMultipartUpload>
Response
HTTP/2 200Content-Type: application/xmlContent-Length: 324Date: Fri, 2 Apr 2021 18:11:53 GMTServer: UploadServerx-goog-hash: crc32c=n03x6A==<?xml version="1.0" encoding="UTF-8"?><CompleteMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Location>http://travel-maps.storage.googleapis.com/paris.jpg</Location> <Bucket>travel-maps</Bucket> <Key>paris.jpg</Key> <ETag>"7fc8f92280ac3c975f300cb64412c16f-9"</ETag></CompleteMultipartUploadResult>
Common error codes
If one of the parts specified in the request has not been uploaded, or if theETag specified in the request does not match the ETag of the uploaded part,you get a400 Bad Request status code and the body of the error responsehasInvalidPart in theCode element.
If the list of parts specified in the request is not in ascending order, youget a400 Bad Request status code and the body of the error response hasInvalidPartOrder in theCode element.
If one of the parts specified in the request is less than 5 MiB and is not thefinal part in the upload, you get a400 Bad Request status code and thebody of the error response hasInvalidArgument in theCode element.
If theuploadId specified in the request is invalid or applies to a multipartupload that has already been completed or aborted, you get a404 Not Foundstatus code and the body of the error response hasNoSuchUpload in theCodeelement.
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 2026-02-19 UTC.