Skip to content
Start here

Get r2.dev Domain of Bucket

client.R2.Buckets.Domains.Managed.List(ctx, bucketName, params) (*BucketDomainManagedListResponse, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/domains/managed

Gets 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
bucketName string

Name of the bucket.

maxLength64
minLength3
params BucketDomainManagedListParams
AccountID param.Field[string]

Path param: Account ID.

maxLength32
Jurisdiction param.Field[BucketDomainManagedListParamsCfR2Jurisdiction]optional

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

const BucketDomainManagedListParamsCfR2JurisdictionDefault BucketDomainManagedListParamsCfR2Jurisdiction = "default"
const BucketDomainManagedListParamsCfR2JurisdictionEu BucketDomainManagedListParamsCfR2Jurisdiction = "eu"
const BucketDomainManagedListParamsCfR2JurisdictionFedramp BucketDomainManagedListParamsCfR2Jurisdiction = "fedramp"
ReturnsExpand Collapse
type BucketDomainManagedListResponse struct{…}
BucketID string

Bucket ID.

maxLength32
Domain string

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

Enabled bool

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

Get r2.dev Domain of Bucket

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/r2"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  manageds, err := client.R2.Buckets.Domains.Managed.List(
    context.TODO(),
    "example-bucket",
    r2.BucketDomainManagedListParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", manageds.BucketID)
}
{
  "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
}