Skip to content
Start here

Update r2.dev Domain of Bucket

PUT/accounts/{account_id}/r2/buckets/{bucket_name}/domains/managed

Updates state of public access over the bucket’s R2-managed (r2.dev) domain.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Path ParametersExpand Collapse
account_id: string

Account ID.

maxLength32
bucket_name: string

Name of the bucket.

maxLength64
minLength3
Header ParametersExpand Collapse
"cf-r2-jurisdiction": optional "default" or "eu" or "fedramp"

Jurisdiction where objects in this bucket are guaranteed to be stored.

One of the following:
"default"
"eu"
"fedramp"
Body ParametersJSONExpand Collapse
enabled: boolean

Whether to enable public bucket access at the r2.dev domain.

ReturnsExpand Collapse
errors: array of ResponseInfo { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: array of string
result: object { bucketId, domain, enabled }
bucketId: string

Bucket ID.

maxLength32
domain: string

Domain name of the bucket’s r2.dev domain.

enabled: boolean

Whether this bucket is publicly accessible at the r2.dev domain.

success: true

Whether the API call was successful.

Update r2.dev Domain of Bucket

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/r2/buckets/$BUCKET_NAME/domains/managed \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "enabled": true
        }'
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "bucketId": "0113a9e4549cf9b1ff1bf56e04da0cef",
    "domain": "pub-0113a9e4549cf9b1ff1bf56e04da0cef.r2.dev",
    "enabled": true
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "bucketId": "0113a9e4549cf9b1ff1bf56e04da0cef",
    "domain": "pub-0113a9e4549cf9b1ff1bf56e04da0cef.r2.dev",
    "enabled": true
  },
  "success": true
}