Overview
Access the R2 API:Buckets
Manage R2 storage buckets.Create a bucket
Create a new R2 bucket.string
required
Your Cloudflare account ID
string
required
Bucket name (3-63 characters, lowercase, alphanumeric, and hyphens)
string
Data jurisdiction for the bucket (e.g., ‘eu’ for EU data residency)
string
Storage class: ‘Standard’ or ‘InfrequentAccess’
string
The bucket name
string
ISO 8601 timestamp when the bucket was created
string
The bucket’s location/jurisdiction
List buckets
Retrieve all R2 buckets in your account.string
required
Your Cloudflare account ID
string
Filter buckets by jurisdiction
string
Pagination cursor
number
Number of buckets per page (default: 1000, max: 1000)
array
Array of bucket objects
Get a bucket
Retrieve details about a specific bucket.string
required
The bucket name
string
required
Your Cloudflare account ID
Update a bucket
Update bucket configuration.string
required
The bucket name
string
required
Your Cloudflare account ID
string
Storage class: ‘Standard’ or ‘InfrequentAccess’
Delete a bucket
Delete an R2 bucket. The bucket must be empty.string
required
The bucket name to delete
string
required
Your Cloudflare account ID
CORS
Manage Cross-Origin Resource Sharing (CORS) policies.Get CORS configuration
Retrieve the CORS configuration for a bucket.Update CORS configuration
Set CORS rules for a bucket.array
required
Array of CORS rule objects
array
required
Array of allowed origin URLs
array
required
Array of allowed HTTP methods
array
Array of allowed headers (use [’*’] for all headers)
number
Cache duration for preflight requests in seconds
Delete CORS configuration
Remove CORS configuration from a bucket.Lifecycle policies
Manage object lifecycle rules.Get lifecycle configuration
Update lifecycle configuration
Set lifecycle rules to automatically delete or transition objects.array
required
Array of lifecycle rule objects
string
required
Unique identifier for the rule
string
required
Rule status: ‘Enabled’ or ‘Disabled’
string
Object key prefix to match
object
Expiration settings
number
Number of days after which objects expire
Event notifications
Configure event notifications to trigger Workers or send to queues.Get event notifications
Update event notifications
array
required
Array of event notification rules
array
required
Array of S3 event types (e.g., ‘PutObject’, ‘DeleteObject’)
string
Cloudflare Queue ID to send notifications to
string
Object key prefix filter
string
Object key suffix filter
Temporary credentials
Generate temporary S3-compatible credentials for bucket access.Create temporary credentials
string
required
Your Cloudflare account ID
string
required
The bucket name
array
required
Array of permissions: ‘read’, ‘write’, or ‘delete’
number
Time-to-live in seconds (default: 3600, max: 43200)
string
S3-compatible access key ID
string
S3-compatible secret access key
string
Session token for temporary credentials
string
ISO 8601 timestamp when credentials expire