Skip to content
Start here

Buckets

List Buckets
client.R2.Buckets.List(ctx, params) (*BucketListResponse, error)
GET/accounts/{account_id}/r2/buckets
Get Bucket
client.R2.Buckets.Get(ctx, bucketName, params) (*Bucket, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}
Create Bucket
client.R2.Buckets.New(ctx, params) (*Bucket, error)
POST/accounts/{account_id}/r2/buckets
Patch Bucket
client.R2.Buckets.Edit(ctx, bucketName, params) (*Bucket, error)
PATCH/accounts/{account_id}/r2/buckets/{bucket_name}
Delete Bucket
client.R2.Buckets.Delete(ctx, bucketName, params) (*BucketDeleteResponse, error)
DELETE/accounts/{account_id}/r2/buckets/{bucket_name}
ModelsExpand Collapse
type Bucket struct{…}

A single R2 bucket.

CreationDate stringoptional

Creation timestamp.

Jurisdiction BucketJurisdictionoptional

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

One of the following:
const BucketJurisdictionDefault BucketJurisdiction = "default"
const BucketJurisdictionEu BucketJurisdiction = "eu"
const BucketJurisdictionFedramp BucketJurisdiction = "fedramp"
Location BucketLocationoptional

Location of the bucket.

One of the following:
const BucketLocationApac BucketLocation = "apac"
const BucketLocationEeur BucketLocation = "eeur"
const BucketLocationEnam BucketLocation = "enam"
const BucketLocationWeur BucketLocation = "weur"
const BucketLocationWnam BucketLocation = "wnam"
const BucketLocationOc BucketLocation = "oc"
Name stringoptional

Name of the bucket.

maxLength64
minLength3
StorageClass BucketStorageClassoptional

Storage class for newly uploaded objects, unless specified otherwise.

One of the following:
const BucketStorageClassStandard BucketStorageClass = "Standard"
const BucketStorageClassInfrequentAccess BucketStorageClass = "InfrequentAccess"

BucketsLifecycle

Get Object Lifecycle Rules
client.R2.Buckets.Lifecycle.Get(ctx, bucketName, params) (*BucketLifecycleGetResponse, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle
Put Object Lifecycle Rules
client.R2.Buckets.Lifecycle.Update(ctx, bucketName, params) (*BucketLifecycleUpdateResponse, error)
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle

BucketsCORS

Get Bucket CORS Policy
client.R2.Buckets.CORS.Get(ctx, bucketName, params) (*BucketCORSGetResponse, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/cors
Put Bucket CORS Policy
client.R2.Buckets.CORS.Update(ctx, bucketName, params) (*BucketCORSUpdateResponse, error)
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/cors
Delete Bucket CORS Policy
client.R2.Buckets.CORS.Delete(ctx, bucketName, params) (*BucketCORSDeleteResponse, error)
DELETE/accounts/{account_id}/r2/buckets/{bucket_name}/cors

BucketsDomains

BucketsDomainsCustom

List Custom Domains of Bucket
client.R2.Buckets.Domains.Custom.List(ctx, bucketName, params) (*BucketDomainCustomListResponse, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom
Get Custom Domain Settings
client.R2.Buckets.Domains.Custom.Get(ctx, bucketName, domain, params) (*BucketDomainCustomGetResponse, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain}
Attach Custom Domain To Bucket
client.R2.Buckets.Domains.Custom.New(ctx, bucketName, params) (*BucketDomainCustomNewResponse, error)
POST/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom
Configure Custom Domain Settings
client.R2.Buckets.Domains.Custom.Update(ctx, bucketName, domain, params) (*BucketDomainCustomUpdateResponse, error)
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain}
Remove Custom Domain From Bucket
client.R2.Buckets.Domains.Custom.Delete(ctx, bucketName, domain, params) (*BucketDomainCustomDeleteResponse, error)
DELETE/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain}

BucketsDomainsManaged

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
Update r2.dev Domain of Bucket
client.R2.Buckets.Domains.Managed.Update(ctx, bucketName, params) (*BucketDomainManagedUpdateResponse, error)
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/domains/managed

BucketsEvent Notifications

List Event Notification Rules
client.R2.Buckets.EventNotifications.List(ctx, bucketName, params) (*BucketEventNotificationListResponse, error)
GET/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration
Get Event Notification Rule
client.R2.Buckets.EventNotifications.Get(ctx, bucketName, queueID, params) (*BucketEventNotificationGetResponse, error)
GET/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}
Create Event Notification Rule
client.R2.Buckets.EventNotifications.Update(ctx, bucketName, queueID, params) (*BucketEventNotificationUpdateResponse, error)
PUT/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}
Delete Event Notification Rules
client.R2.Buckets.EventNotifications.Delete(ctx, bucketName, queueID, params) (*BucketEventNotificationDeleteResponse, error)
DELETE/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}

BucketsLocks

Get Bucket Lock Rules
client.R2.Buckets.Locks.Get(ctx, bucketName, params) (*BucketLockGetResponse, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/lock
Put Bucket Lock Rules
client.R2.Buckets.Locks.Update(ctx, bucketName, params) (*BucketLockUpdateResponse, error)
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/lock

BucketsMetrics

Get Account-Level Metrics
client.R2.Buckets.Metrics.List(ctx, query) (*BucketMetricListResponse, error)
GET/accounts/{account_id}/r2/metrics

BucketsSippy

Get Sippy Configuration
client.R2.Buckets.Sippy.Get(ctx, bucketName, params) (*Sippy, error)
GET/accounts/{account_id}/r2/buckets/{bucket_name}/sippy
Enable Sippy
client.R2.Buckets.Sippy.Update(ctx, bucketName, params) (*Sippy, error)
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/sippy
Disable Sippy
client.R2.Buckets.Sippy.Delete(ctx, bucketName, params) (*BucketSippyDeleteResponse, error)
DELETE/accounts/{account_id}/r2/buckets/{bucket_name}/sippy
ModelsExpand Collapse
type Provider string
type Sippy struct{…}
Destination SippyDestinationoptional

Details about the configured destination bucket.

AccessKeyID stringoptional

ID of the Cloudflare API token used when writing objects to this bucket.

Account stringoptional
Bucket stringoptional

Name of the bucket on the provider.

Provider Provideroptional
Enabled booloptional

State of Sippy for this bucket.

Source SippySourceoptional

Details about the configured source bucket.

Bucket stringoptional

Name of the bucket on the provider (AWS, GCS only).

BucketURL stringoptional

S3-compatible URL (Generic S3-compatible providers only).

Provider SippySourceProvideroptional
One of the following:
const SippySourceProviderAws SippySourceProvider = "aws"
const SippySourceProviderGcs SippySourceProvider = "gcs"
const SippySourceProviderS3 SippySourceProvider = "s3"
Region stringoptional

Region where the bucket resides (AWS only).