Graphon API

S3 · Objects

CopyObject

PUT/{bucket}/{key}with the x-amz-copy-source header

Copies an object to another key.

Storage copies the bytes on its side, with no download. The source can be in another bucket of the same workspace. The copy keeps the metadata and tags of the source unless you replace them.

View as Markdown
Role
Editor or higher
Support
Partial
  • The source needs the Viewer role and must be in the same workspace. A copy across storage providers returns 501.
  • The key needs the Viewer role on the source and the Editor role on the target.
  • Storage does not check the x-amz-copy-source-if-* conditions.

Path parameters

bucketstringrequired

The bucket name.

keystringrequired

The object key. Keep each / as it is. Percent-encode the other reserved characters.

Headers

x-amz-copy-sourcestringrequired

The source, as {bucket}/{key}, URL-encoded. Add ?versionId= to copy one version.

Whether to keep the metadata of the source or to use the headers of this request.

Default: "COPY"

COPY
Keep the metadata of the source.
REPLACE
Use Content-Type, the stored headers, and x-amz-meta-* from this request.

Whether to keep the tags of the source.

Default: "COPY"

COPY
Keep the tags of the source.
REPLACE
Use the tags in x-amz-tagging.
Content-Typestringoptional

The media type of the copy. Used with REPLACE.

Cache-Controlstringoptional

Stored with the object and returned on reads. Used with REPLACE.

Content-Dispositionstringoptional

Stored with the object and returned on reads. Used with REPLACE.

Content-Encodingstringoptional

Stored with the object and returned on reads. Used with REPLACE.

Content-Languagestringoptional

Stored with the object and returned on reads. Used with REPLACE.

x-amz-meta-*stringoptional

User metadata. Used with REPLACE.

x-amz-storage-classstringoptional

Recorded with the object and shown in listings. Used with REPLACE.

x-amz-taggingstringoptional

Tags for the object, as a URL query. For example, team=support&tier=gold. Used with a tagging directive of REPLACE.

The workspace ID that must own the bucket. Another owner returns 403 AccessDenied.

Responses

200OK

Storage wrote the copy.

application/xml

CopyObjectResultobjectrequired

The root element.

When the copy was written.

ETagstring

The entity tag of the copy.

Errors

Select an error in the response example to see its XML body. Any request can also get the common errors, such as SignatureDoesNotMatch.

400InvalidRequest

The x-amz-copy-source value is not {bucket}/{key}.

What to do: Send the source as {bucket}/{key}, URL-encoded.

404NoSuchKey

The source has no object at this key or version.

What to do: Check the key and the versionId.

404NoSuchBucket

The source bucket or the target bucket does not exist.

What to do: Check the bucket name. ListBuckets shows the buckets of the workspace.

403AccessDenied

The key cannot read the source or write the target, or the source is in another workspace.

What to do: Use a key of the workspace that owns the bucket, with the role above.

501NotImplemented

The source bucket uses another storage provider.

What to do: Copy between buckets of the same provider, or download and upload the object.

405MethodNotAllowed

The versionId names a delete marker, which has no bytes.

What to do: Use the versionId of a version that holds data. ListObjectVersions shows each one.

503SlowDown

The bucket has too many writes in progress. The response has Retry-After: 1.

What to do: Wait for the Retry-After time, then send the request again. SDKs retry by themselves.

Was this page helpful?