R2

r2

R2

Buckets

r2.buckets

Methods

Create Bucket -> Envelope<>
post/accounts/{account_id}/r2/buckets

Creates a new R2 bucket.

Delete Bucket -> Envelope<unknown>
delete/accounts/{account_id}/r2/buckets/{bucket_name}

Deletes an existing R2 bucket.

Get Bucket -> Envelope<>
get/accounts/{account_id}/r2/buckets/{bucket_name}

Gets metadata for an existing R2 bucket.

List Buckets -> Envelope<{ buckets }>
get/accounts/{account_id}/r2/buckets

Lists all R2 buckets on your account

Domain types

Bucket = { creation_date, location, name, 1 more... }

r2.buckets.cors

Methods

Delete Bucket CORS Policy -> Envelope<unknown>
delete/accounts/{account_id}/r2/buckets/{bucket_name}/cors

Delete the CORS policy for a bucket

Get Bucket CORS Policy -> Envelope<{ rules }>
get/accounts/{account_id}/r2/buckets/{bucket_name}/cors

Get the CORS policy for a bucket

Put Bucket CORS Policy -> Envelope<unknown>
put/accounts/{account_id}/r2/buckets/{bucket_name}/cors

Set the CORS policy for a bucket

R2Buckets

Domains

r2.buckets.domains

r2.buckets.domains.custom

Methods

Attach Custom Domain To Bucket -> Envelope<{ domain, enabled, minTLS }>
post/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom

Register a new custom domain for an existing R2 bucket.

Remove Custom Domain From Bucket -> Envelope<{ domain }>
delete/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain_name}

Remove custom domain registration from an existing R2 bucket

Get Custom Domain Settings -> Envelope<{ domain, enabled, status, 3 more... }>
get/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain_name}

Get the configuration for a custom domain on an existing R2 bucket.

List Custom Domains Of Bucket -> Envelope<{ domains }>
get/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom

Gets a list of all custom domains registered with an existing R2 bucket.

Configure Custom Domain Settings -> Envelope<{ domain, enabled, minTLS }>
put/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain_name}

Edit the configuration for a custom domain on an existing R2 bucket.

r2.buckets.domains.managed

Methods

Get R2 Dev Domain Of Bucket -> Envelope<{ bucketId, domain, enabled }>
get/accounts/{account_id}/r2/buckets/{bucket_name}/domains/managed

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

Update R2 Dev Domain Of Bucket -> Envelope<{ bucketId, domain, enabled }>
put/accounts/{account_id}/r2/buckets/{bucket_name}/domains/managed

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

R2Buckets

Event Notifications

r2.buckets.event_notifications

r2.buckets.event_notifications.configuration

Methods

List Event Notification Rules -> Envelope<{ bucketName, queues }>
get/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration

List all event notification rules for a bucket.

r2.buckets.event_notifications.configuration.queues

Methods

Delete Event Notification Rules -> Envelope<unknown>
delete/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}

Delete an event notification rule. If no body is provided, all rules for specified queue will be deleted.

Create Event Notification Rule -> Envelope<unknown>
put/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}

Create event notification rule.

R2Buckets

Lifecycle

r2.buckets.lifecycle

Methods

Get Object Lifecycle Rules -> Envelope<{ rules }>
get/accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle

Get object lifecycle rules for a bucket

Put Object Lifecycle Rules -> Envelope<unknown>
put/accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle

Set the object lifecycle rules for a bucket

r2.buckets.sippy

Methods

Disable Sippy -> Envelope<{ enabled }>
delete/accounts/{account_id}/r2/buckets/{bucket_name}/sippy

Disables Sippy on this bucket

Get Sippy Configuration -> Envelope<>
get/accounts/{account_id}/r2/buckets/{bucket_name}/sippy

Gets configuration for Sippy for an existing R2 bucket.

Enable Sippy -> Envelope<>
put/accounts/{account_id}/r2/buckets/{bucket_name}/sippy

Sets configuration for Sippy for an existing R2 bucket.

Security
API Token

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

Example: Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY

Parameters
account_id: string

Account ID

bucket_name: string

Name of the bucket

cf-r2-jurisdiction:
Optional

The bucket jurisdiction

"default"
"eu"
"fedramp"
Response fields
errors: Array<>
messages: Array<string>
result:
success: true

Whether the API call was successful

Request example
200Example

Domain types

Provider = "r2"
Sippy = { destination, enabled, source }
R2

Temporary Credentials

r2.temporary_credentials

Methods

Create Temporary Access Credentials -> Envelope<{ accessKeyId, secretAccessKey, sessionToken }>
post/accounts/{account_id}/r2/temp-access-credentials

Creates temporary access credentials on a bucket that can be optionally scoped to prefixes or objects.

Domain types

TemporaryCredential = { bucket, parentAccessKeyId, permission, 3 more... }