All Products
Search
Document Center

Object Storage Service:put-bucket-request-payment

Last Updated:Jun 22, 2026

Enables pay-by-requester for a bucket.

Usage notes

  • By default, an Alibaba Cloud account has the permissions to enable pay-by-requester for a bucket. To perform this operation by using a RAM user or Security Token Service (STS), you must have the oss:PutBucketRequestPayment permission. For more information, see Attach a custom policy to a RAM user.

  • If you enable pay-by-requester for a bucket, anonymous users cannot access the bucket. Requesters must provide authentication information so that OSS can identify them and charge them for request and traffic fees. If a requester uses a RAM user, the Alibaba Cloud account that owns the RAM user is charged for the requests and generated traffic.

  • If you enable pay-by-requester for a bucket, requesters must include the x-oss-request-payer:requester header in POST, GET, or HEAD requests to acknowledge that they will be charged for the requests and downloaded data. Otherwise, the requests cannot be authenticated. The bucket owner does not need to include this header and is charged for request and traffic fees when accessing the bucket.

Command syntax

ossutil api put-bucket-request-payment --bucket value --request-payment-configuration value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket.

--request-payment-configuration

string

The container that stores pay-by-requester configurations.

Note

This command corresponds to the PutBucketRequestPayment API operation. For more information about supported parameters, see PutBucketRequestPayment.

--request-payment-configuration

The --request-payment-configuration option supports both XML and JSON formats. If the value contains the file:// prefix, the configuration is read from a file.

  • XML format:

    <RequestPaymentConfiguration>
      <Payer>string</Payer>
    </RequestPaymentConfiguration>
  • JSON format:

    {
      "Payer": "string"
    }
Note

For more information about supported global command-line options, see Global command-line options.

Examples

Enable pay-by-requester for a bucket named examplebucket.

  • Create a configuration file named request-payment-configuration.xml and add the following code to the configuration file:

    <?xml version="1.0" encoding="UTF-8"?>
    <RequestPaymentConfiguration>
      <Payer>Requester</Payer>
    </RequestPaymentConfiguration>

    Sample command:

    ossutil api put-bucket-request-payment --bucket examplebucket --request-payment-configuration file://request-payment-configuration.xml
  • Create a configuration file named request-payment-configuration.json and add the following code to the configuration file:

    {
      "Payer": "Requester"
    }

    Sample command:

    ossutil api put-bucket-request-payment --bucket examplebucket --request-payment-configuration file://request-payment-configuration.json
  • Configure parameters in the following command in the JSON format:

    ossutil api put-bucket-request-payment --bucket examplebucket --request-payment-configuration "{\"Payer\":\"Requester\"}"