Skip to main content

PutObjectAcl

Sets the access control list (ACL) permissions for an object that already exists in a bucket.

Description​

The PutObjectAcl operation uses the acl subresource to set the access control list (ACL) permissions for an existing object in a bucket. You must have WRITE_ACP permission to change an object's ACL.

Permissions​

You need the following permissions to use this operation:

  • s3:PutObjectAcl on the object
  • s3:PutObject on the object if you're also the object owner

Request​

Request Headers​

NameDescriptionRequiredType
x-amz-aclPredefined ACL to apply to the object.

Valid values: private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control
Nostring
Content-MD5Base64-encoded 128-bit MD5 digest of the dataYesstring
x-amz-request-payerConfirms that the requester knows that they will be charged for the requestNostring
x-amz-expected-bucket-ownerThe account ID of the expected bucket ownerNostring

Request URI Parameters​

NameDescriptionRequiredType
versionIdVersion ID of the object that you want to set the ACL forNostring

Request Body​

The request accepts the following XML elements:

NameDescriptionRequiredType
AccessControlPolicyContainer for the requestYesXML
OwnerContainer for the bucket owner's ID and display name. See Owner for details.NoContainer
GrantsArray of Grant data types. See Grant for details.NoContainer

Request Syntax​

PUT /ObjectKey?acl&versionId=VersionId HTTP/1.1
Host: BucketName.qstorage.quilibrium.com
x-amz-acl: private
Content-MD5: Base64EncodedMD5
Authorization: authorization string
Date: Date
x-amz-request-payer: requester
x-amz-expected-bucket-owner: OwnerAccountId
<?xml version="1.0" encoding="UTF-8"?> <AccessControlPolicy> <Owner> <ID>OwnerID</ID> <DisplayName>OwnerName</DisplayName> </Owner> <AccessControlList> <Grant> <Grantee> <ID>GranteeID</ID> <DisplayName>GranteeName</DisplayName> </Grantee> <Permission>Permission</Permission> </Grant> </AccessControlList> </AccessControlPolicy>
Values in italics indicate user input and should be replaced with actual values.

Response​

Response Headers​

NameDescriptionRequiredType
x-amz-request-chargedIf present, indicates that the requester was successfully charged for the request

Valid values: requester
NoString

Response Body​

This operation does not return a response body.

Response Errors​

NameDescriptionRequiredType
NoSuchKeyThe specified key does not exist (HTTP Code 404)NoError

Examples​

Set ACL for an Object​

This example sets the ACL on an object to grant full control to the owner.

Example Request

PUT /example-object?acl HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
x-amz-acl: private
Content-MD5: 6aKJsA2R/DqbxeJX7HaXzw==
Date: Wed, 28 Oct 2023 22:32:00 GMT
Authorization: authorization string
<?xml version="1.0" encoding="UTF-8"?> <AccessControlPolicy> <Owner> <ID>123456789abc</ID> <DisplayName>owner-name</DisplayName> </Owner> <AccessControlList> <Grant> <Grantee> <ID>123456789abc</ID> <DisplayName>owner-name</DisplayName> </Grantee> <Permission>FULL_CONTROL</Permission> </Grant> </AccessControlList> </AccessControlPolicy>
Values in italics indicate user input and should be replaced with actual values.

Example Response

HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Wed, 28 Oct 2023 22:32:00 GMT
Values in italics indicate variable response values.

Set ACL Using a Canned ACL​

This example sets a predefined (canned) ACL on an object.

Example Request

PUT /example-object?acl HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
x-amz-acl: public-read
Content-MD5: 6aKJsA2R/DqbxeJX7HaXzw==
Date: Wed, 28 Oct 2023 22:32:00 GMT
Authorization: authorization string
Values in italics indicate user input and should be replaced with actual values.

Example Response

HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Wed, 28 Oct 2023 22:32:00 GMT
Values in italics indicate variable response values.

Try It Out​