Object upload

To perform a single-request upload with the XML API, you make a PUT request that is scoped with a bucket name and the object's name, and you put the object data into the request body. The uploaded object replaces any existing object with the same name. For tips on uploading to Cloud Storage, see Best Practices. For a quick guide to simple uploads using tools such as the XML API, see Uploading Objects.

The PUT Object request uses several standard HTTP headers. Content-Length specifies the object's size in bytes and is required unless you are using chunked transfer encoding. Optional headers include Content-Type, Content-MD5, and those listed below. Cloud Storage stores these headers as part of the object's metadata, except for Content-MD5, which Cloud Storage uses to check for data integrity. See Editing object metadata for information on changing metadata values for objects.

You also use a PUT Object request when you want to change the storage class of an existing object, because you must rewrite the existing object to do so. The request should contain the x-goog-storage-class request header, as well as the object in the request body.

Query string parameters

This request does not typically include query string parameters.

See signed URL query string parameters for information on the parameters you include when creating and using signed URLs.

Request headers

In addition to common request headers, the following can be used.

Header Description Required
Cache-Control The conditions under which a publicly accessible object should be cached. Cache-Control is also used to determine whether an object can be transformed. No