tencent cloud


PUT Bucket encryption

Last updated: 2022-04-08 15:13:50

    Feature Description

    This API is used to set the default encryption configuration for a bucket.

    To call this API, you must have the PutBucketEncryption permission. By default, the bucket owner has permission to use this API and can grant such permission to other users.


    Request sample

    PUT /?encryption HTTP 1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT Date
    Authorization: Auth String

    Request parameters

    This API has no request parameter.

    Request headers

    This API only uses Common Request Headers.

    Request Body

    You can configure the default encryption in the request body using the XML markup language. The configuration mainly includes the encryption item.

    The following request body sets SSE-COS as the default encryption:


    The nodes are described as follows:

    Node Parent Node Description Type Required
    ServerSideEncryptionConfiguration None Default encryption configurations Container Yes
    Rule ServerSideEncryptionConfiguration Default server-side encryption rule Container Yes
    ApplyServerSideEncryptionByDefault Rule Default configuration for server-side encryption Container Yes
    SSEAlgorithm ApplyServerSideEncryptionByDefault Server-side encryption algorithm. Enumerated value: AES256 String Yes


    Response headers

    This API only returns Common Response Headers.

    Response body

    The response body is empty.

    Error Code

    This API returns common error responses and error codes. For more information, please see Error Codes.



    The following example sets SSE-COS as the default encryption for the examplebucket-1250000000 bucket.

    PUT /?encryption HTTP 1.1
    Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
    Date: Mon, 17 Jun 2019 08:37:35 GMT
    Authorization: signatureValue


    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 0
    Date: Mon, 17 Jun 2019 08:37:36 GMT
    Server: tencent-cos
    x-cos-request-id: NWQwNzUxNTBfMzdiMDJhMDlfOWM0Nl85NDFk****

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support