R2

Storage integration

# Cloudflare R2 + Transloadit

Move files between Cloudflare R2 and Transloadit with the dedicated R2 import and store Robots, while keeping S3 credentials in Template Credentials.

Executable recipe

## Build the integration

This Template imports an image from R2, optimizes it, and writes the result back under processed/.

1. Create an R2 bucket and a bucket-scoped Object Read & Write API token.
2. Save the R2 S3 values as Template Credentials named my\_r2\_credentials.
3. Paste the Instructions into a Template and start an Assembly from that Template.

### Template Instructions

```
{
  "steps": {
    "imported": {
      "robot": "/cloudflare/import",
      "credentials": "my_r2_credentials",
      "path": "incoming/photo.jpg"
    },
    "optimized": {
      "robot": "/image/optimize",
      "use": "imported"
    },
    "exported": {
      "robot": "/cloudflare/store",
      "use": "optimized",
      "credentials": "my_r2_credentials",
      "path": "processed/${file.url_name}"
    }
  }
}
```

## Authentication

* Create an R2 API token with Object Read & Write access and scope it to the bucket used by the workflow.
* Save the bucket, S3 endpoint, Access Key ID, and Secret Access Key as Transloadit Template Credentials.
* Use the endpoint shown by Cloudflare, including the jurisdiction-specific hostname when the bucket uses a jurisdiction.

## Limitations and operational notes

* R2 bucket access and public delivery are separate concerns. Configure a custom domain or public bucket in Cloudflare when results must be public.
* Non-recursive directory imports only read direct descendants. Set recursive explicitly for deeper prefixes and plan pagination for large buckets.
* Cloudflare shows an R2 Secret Access Key only when the token is created, so store it securely before leaving that screen.

## Related Robots

* [/cloudflare/import](/docs/robots/cloudflare-import.md)\
  Import from Cloudflare R2
* [/image/optimize](/docs/robots/image-optimize.md)\
  Optimize images
* [/cloudflare/store](/docs/robots/cloudflare-store.md)\
  Store in Cloudflare R2

## Documentation

* [Transloadit Cloudflare import documentation](/docs/robots/cloudflare-import.md)
* [Transloadit Cloudflare store documentation](/docs/robots/cloudflare-store.md)
* [Cloudflare R2 S3 API documentation⁠](https://developers.cloudflare.com/r2/get-started/s3/)
  [Create a Template](/c/templates/new/)

More integrations

## Continue building your stack

S3

### [Amazon S3](/integrations/amazon-s3.md)

Import from and export to Amazon S3 with dedicated Robots.

SB

### [Supabase](/integrations/supabase.md)

Connect Supabase Storage through its S3-compatible endpoint.

TG

### [Tigris](/integrations/tigris.md)

Import and export Tigris objects with first-class Robots.
