ServiceActive

Cloudflare R2

Object storage that lets Workers read and write objects via R2 bindings.

Open source page

Field note

What it does

Bind an R2 bucket to a Worker and read/write objects directly using the Workers API.

Capabilities

Available capabilities

Tags

Tags

Ways to use it

Ways to use it

cli

Not filed / wrangler

rest

Not filed / https://developers.cloudflare.com/r2/api/s3/extensions/

rest

Not filed / Not filed

cli

JavaScript / Not filed

sdk

JavaScript / https://developers.cloudflare.com/r2/api/workers/workers-api-usage/

cli

Not filed / wrangler

cli

Not filed / https://rclone.org/

cli

Not filed / https://aws.amazon.com/cli/

rest

Not filed / https://developers.cloudflare.com/r2/api/s3/api/

rest

Not filed / Not filed

sdk

Not filed / Not filed

Product features

Product features

abort

Aborts an in-progress multipart upload.

Account and user API tokens

Create account-level tokens or user-level tokens inheriting personal permissions.

API credentials

Generate Access Key ID and Secret Access Key for S3 API tools.

Auto-creating buckets on upload

cf-create-bucket-if-missing header implicitly creates the bucket on PutObject or CreateMultipartUpload.

Bucket binding

Bind an R2 bucket to a Worker via the Wrangler r2_buckets configuration.

Bucket methods

head, get, put, delete, list, createMultipartUpload, resumeMultipartUpload on the binding.

Bucket region auto

R2 bucket region is auto; empty value and us-east-1 alias to auto.

Bucket-scoped permissions

Scope Object Read & Write or Object Read tokens to a set of buckets.

Bucket scoped tokens

Create bucket scoped tokens for granular control over who can access your data.

Change object storage class

Use CopyObject with the x-amz-storage-class header to switch STANDARD and STANDARD_IA.

Cloudflare REST API

The api.cloudflare.com REST API used by the Cloudflare Dashboard and Wrangler CLI; supports bucket management and object operations.

complete

Completes a multipart upload from the uploaded parts.

Content-Type restriction

Restrict allowed Content-Type; mismatched uploads fail with 403/SignatureDoesNotMatch.

CORS

Configure CORS to interact with objects in your bucket and configure policies on your bucket.

CORS configuration

Configure bucket CORS rules for browser-based presigned URL use.

Create bucket

Create an R2 bucket via Wrangler or the Cloudflare dashboard.

createMultipartUpload

Creates a multipart upload and returns its key and uploadId.

Custom domains

Presigned URLs can be used with custom domains.

Default bucket storage class

Set a default storage class so uploads are auto-assigned; changeable after creation.

delete

Configurable expiry

Expiry timeout from 1 second to 7 days (604,800 seconds).

get

Retrieves an object from the bucket, writing its HTTP metadata.

Infrequent Access storage

Lower storage cost with retrieval fees and 30-day minimum storage duration.

Jurisdiction-specific endpoints

Buckets created with jurisdictions must use EU, FedRAMP, or US endpoints.

ListBuckets extensions

Supports ListObjectsV2-style search parameters and headers for accounts with over 1,000 buckets.

Location Hints

Optional parameters provided during bucket creation to indicate the primary geographical location for data access.

CopyObject MERGE metadata directive

x-amz-metadata-directive supports MERGE, combining COPY and REPLACE for metadata keys.

Object lifecycle transitions

Use lifecycle rules to transition objects from Standard to Infrequent Access.

Object operations

A bucket can READ, LIST, WRITE, and DELETE objects.

Presigned URLs

Generate temporary URLs for private object access.

Public buckets

Expose the contents of your R2 bucket directly to the Internet.

Put and get objects

Store request bodies with put and retrieve objects with get.

R2 binding for Workers

Workers access an R2 bucket through an R2 binding configured in the Worker.

R2 bucket binding

Bind an R2 bucket to a Worker via Wrangler configuration.

R2Object types

R2Object, R2ObjectBody, and R2MultipartUpload definitions for object metadata and bodies.

Remote bindings

Set "remote": true in the R2 binding to run operations against a real bucket during development.

resumeMultipartUpload

Resumes an existing multipart upload using its key and uploadId.

S3 API compatibility

Implements S3 API bucket- and object-level operations for migration.

S3-compatible API

Use existing S3-compatible SDKs or XML APIs with R2 API tokens.

Standard storage

Default class for frequently accessed data; no minimum duration or retrieval fees.

Storage class

Storage Class option is part of the Workers API reference.

Supported operations

Presigned URLs permit GET, PUT, HEAD, or DELETE on a specific object.

Temporary credentials

Documented temporary credentials for R2 access.

Token creation via API

Create API tokens via the API to generate Access Key ID and Secret Access Key.

Extended metadata using Unicode

Supports Unicode in customMetadata keys and values via RFC 2047 encoding.

Upload and download objects

Upload, download, and list objects using Wrangler, rclone, or AWS CLI.

uploadPart

Uploads a numbered part and returns its part number and etag.

Workers API

An in-Worker API accessed by binding an R2 bucket to a Worker to read, write, and list objects.