• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Objects
  5. PUT Object - Copy

PUT Object - Copy

You can use this operation to create a copy of an existing object in OBS.

By default, a PUT Object - Copy operation copies object metadata together with the object. If you want to update the metadata, provide new metadata in the PUT Object - Copy request. The object ACL is not copied together with the object and the ACL of a copy object is set to private by default. You can send a PUT Object acl request to modify the object ACL.

The PUT Object - Copy request must contain authentication information and cannot contain a request body.

This operation makes server-side encryption available, but cannot change encrypted objects to non-encrypted ones. If a user performs this operation to change the encrypted objects, the system returns error code 400.

When objects are copied, the storage classes of target objects are consistent with the default storage classes of target buckets.


By default, x-amz-copy-source specifies the latest version of the source object. If the latest version of the source object is a deletion mark, the object is considered to be deleted. You can add versionId to request header x-amz-copy-source to copy an object with the specified version ID.

If a bucket has versioning enabled, the system automatically generates a unique version ID for the requested object in this bucket and returns the version ID in response header x-amz-version-id. If a bucket has versioning suspended, the version ID of the requested object in this bucket is null.

If multi-version is not enabled for a bucket, you can replace source object objecta with target object objectb by replication. If objectb already exists before you perform replication, the new objectb will overwrite the old objectb after you perform replication.

After replication is performed successfully, only new objectb can be downloaded. The old objectb will be deleted. Before using the copy interface, ensure that the target object does not exist or is useless to avoid incorrect data deletion. During the replication, the source object objecta is not changed.

You cannot determine whether a request is executed successfully only using status_code in the header returned by HTTP. If 200 in status_code is returned, the server has received the request and starts to process the request. The body in the response shows whether the replication operation succeeds. The replication operation succeeds only when the body has ETags. Otherwise, the replication operation fails.

OBS Cold Objects

If source objects are OBS cold objects, check the restore status of the objects. You can copy the OBS cold objects only after the objects are restored. If the objects are not restored or are being restored, the copy fails, and error "403 Forbidden" is returned. The fault is described as follows:

ErrorCode: InvalidObjectState

ErrorMessage: Operation is not valid for the source object's storage class