---
title: Cloudflare R2
description: Archive SAP documents to Cloudflare R2 with zero egress fees. S3-compatible API with native authentication support.
type: r2
use_cases:
  - Zero-egress document storage
  - Cost-optimized SAP document archival
  - S3-compatible storage without AWS dependency
config_fields:
  - name: bucket
    type: string
    required: true
    desc: "R2 bucket name"
  - name: account_id
    type: string
    required: true
    desc: "Cloudflare account ID"
  - name: prefix
    type: string
    required: false
    desc: "Path prefix for stored objects"
credential_fields:
  - name: access_key
    type: string
    required: true
    desc: "R2 API access key ID"
  - name: secret_key
    type: string
    required: true
    desc: "R2 API secret access key"
---

Archive SAP documents to Cloudflare R2. R2 provides S3-compatible object storage with zero egress fees, making it an excellent choice for SAP document archival where documents are frequently downloaded, shared, or accessed by downstream systems.

## Setup

1. Log in to the [Cloudflare Dashboard](https://dash.cloudflare.com/)
2. Note your **Account ID** from the right sidebar on the account overview page
3. Navigate to **R2 Object Storage** in the left sidebar and click **Create bucket**
4. Name your bucket (e.g. `sap-documents`) and optionally set a location hint
5. Go to **R2 Object Storage > Manage R2 API Tokens** and click **Create API token**
6. Set the permissions to **Object Read & Write** and scope it to your bucket
7. Copy the **Access Key ID** and **Secret Access Key** (the secret is only shown once)
8. In FileRelay, add a **Cloudflare R2** destination with the Account ID, bucket name, Access Key, and Secret Key

> **REPLACE:** Screenshot of the Cloudflare R2 connector configuration form in FileRelay

## How It Works

FileRelay connects to R2 using the S3-compatible API. The endpoint is automatically constructed from your account ID:

```
https://{account_id}.r2.cloudflarestorage.com
```

Documents are uploaded as objects with the configured prefix and automatic subfolders. R2 handles the storage with automatic data placement close to where requests originate.

## Path Structure

Documents are stored with the following key pattern:

```
{prefix}/{subfolder}/{doc_id}.{ext}
```

- **prefix** — configured base path (e.g. `sap-documents/`)
- **subfolder** — automatic subfolder based on routing rules
- **doc_id** — the SAP document ID
- **ext** — file extension based on MIME type

Example: `sap-documents/2026-04/4500012345.pdf`

## API Token Permissions

When creating the R2 API token, assign the following:

| Permission | Scope | Purpose |
|-----------|-------|---------|
| Object Read & Write | Specific bucket | Upload and verify objects |

> For least-privilege access, scope the token to the specific bucket used by FileRelay rather than granting access to all buckets.

## Cost Comparison

R2's zero-egress pricing model provides significant savings when documents are accessed frequently:

| Feature | Cloudflare R2 | Amazon S3 (Standard) |
|---------|--------------|---------------------|
| Egress fees | $0 | $0.09/GB |
| Storage | $0.015/GB/month | $0.023/GB/month |
| Class A ops (writes) | $4.50/million | $5.00/million |
| Class B ops (reads) | $0.36/million | $0.40/million |
| S3 API compatibility | Yes | Native |

R2 is particularly cost-effective when downstream systems (reporting tools, portals, partner access) frequently retrieve archived SAP documents.

## Tips

- **Bucket location hints** — R2 automatically places data close to where it is accessed. You can optionally set a location hint (e.g. `enam` for Eastern North America, `weur` for Western Europe) when creating the bucket to influence initial placement.
- **Custom domains** — Attach a custom domain to your R2 bucket for branded or public access to stored documents. Configure this under the bucket's **Settings > Custom Domains**.
- **Lifecycle rules** — R2 supports object lifecycle rules for automatic deletion after a retention period. Configure these in the bucket settings.
- **S3 tool compatibility** — Since R2 uses the S3-compatible API, you can access your stored documents with any S3 client (AWS CLI, Cyberduck, rclone) by pointing it to the R2 endpoint.
- **Migration from S3** — If migrating from Amazon S3, the same prefix and folder structure is maintained. Only the credentials and endpoint change in your FileRelay destination configuration.
- **No minimum storage duration** — Unlike S3 Glacier or Infrequent Access tiers, R2 has no minimum storage duration charges. You can delete objects at any time without penalty.
- **Multipart uploads** — R2 supports multipart uploads with no minimum part size requirement (unlike S3's 5MB minimum), simplifying large file handling.
