Skip to content
Start here

Update r2.dev Domain of Bucket

r2.buckets.domains.managed.update(strbucket_name, ManagedUpdateParams**kwargs) -> ManagedUpdateResponse
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
ParametersExpand Collapse
account_id: str

Account ID.

maxLength32
bucket_name: str

Name of the bucket.

maxLength64
minLength3
enabled: bool

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

jurisdiction: Optional[Literal["default", "eu", "fedramp"]]

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

One of the following:
"default"
"eu"
"fedramp"
ReturnsExpand Collapse
class ManagedUpdateResponse:
bucket_id: str

Bucket ID.

maxLength32
domain: str

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

enabled: bool

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

Update r2.dev Domain of Bucket

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
managed = client.r2.buckets.domains.managed.update(
    bucket_name="example-bucket",
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
    enabled=True,
)
print(managed.bucket_id)
{
  "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
}