R2

r2

R2

Buckets

r2.buckets

Methods

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

Creates a new R2 bucket.

Security
API Token

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

Example: Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY

Accepted Permissions (at least one required)

Workers R2 Storage Write

path Parameters
account_id: string
(maxLength: 32)

Account ID

header Parameters
cf-r2-jurisdiction:
Optional
(default: "default")

Creates the bucket in the provided jurisdiction

"default"
"eu"
"fedramp"
Body parameters
name: string
(maxLength: 64, minLength: 3)

Name of the bucket

locationHint: "apac" | "eeur" | "enam" | 3 more...
Optional

Location of the bucket

storageClass: "Standard" | "InfrequentAccess"
Optional
(default: "Standard")

Storage class for newly uploaded objects, unless specified otherwise.

Response fields
errors: Array<>
messages: Array<string>
result:

A single R2 bucket

success: true

Whether the API call was successful

Request example
200Example
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... }

A single R2 bucket

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}

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}

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}

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

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.

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.

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.locks

Methods

Get Bucket Lock Rules -> Envelope<{ rules }>
get/accounts/{account_id}/r2/buckets/{bucket_name}/lock

Get lock rules for a bucket

Put Bucket Lock Rules -> Envelope<unknown>
put/accounts/{account_id}/r2/buckets/{bucket_name}/lock

Set lock rules for a bucket

R2Buckets

Metrics

r2.buckets.metrics

Methods

Get Account Level Metrics -> Envelope<{ infrequentAccess, standard }>
get/accounts/{account_id}/r2/metrics

Get Storage/Object Count Metrics across all buckets in your account. Note that Account-Level Metrics may not immediately reflect the latest data.

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.

Domain types

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

Super Slurper

r2.super_slurper

R2Super Slurper

Connectivity Precheck

r2.super_slurper.connectivity_precheck

Methods

Check Source Connectivity -> Envelope<{ connectivityStatus }>
put/accounts/{account_id}/slurper/source/connectivity-precheck

Check whether tokens are valid against the source bucket

Check Target Connectivity -> Envelope<{ connectivityStatus }>
put/accounts/{account_id}/slurper/target/connectivity-precheck

Check whether tokens are valid against the target bucket

r2.super_slurper.jobs

Methods

Abort A Job -> Envelope<string>
put/accounts/{account_id}/slurper/jobs/{job_id}/abort

Abort a job

Abort All Jobs -> Envelope<string>
put/accounts/{account_id}/slurper/jobs/abortAll

Abort all jobs

Create A Job -> Envelope<{ id }>
post/accounts/{account_id}/slurper/jobs

Create a job

Get Job Details -> Envelope<{ id, createdAt, finishedAt, 4 more... }>
get/accounts/{account_id}/slurper/jobs/{job_id}

Get job details

List Jobs -> SinglePage<{ id, createdAt, finishedAt, 4 more... }>
get/accounts/{account_id}/slurper/jobs

List jobs

Pause A Job -> Envelope<string>
put/accounts/{account_id}/slurper/jobs/{job_id}/pause

Pause a job

Get Job Progress -> Envelope<{ id, createdAt, failedObjects, 4 more... }>
get/accounts/{account_id}/slurper/jobs/{job_id}/progress

Get job progress

Resume A Job -> Envelope<string>
put/accounts/{account_id}/slurper/jobs/{job_id}/resume

Resume a job

r2.super_slurper.jobs.logs

Methods

Get Job Logs -> SinglePage<{ createdAt, job, logType, 2 more... }>
get/accounts/{account_id}/slurper/jobs/{job_id}/logs

Get job logs

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... }