> ## Documentation Index
> Fetch the complete documentation index at: https://savemate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Up Cloudflare R2

> Connect Cloudflare R2 to SaveMate for cost-effective cloud storage.

Cloudflare R2 is an S3-compatible object storage service with zero egress fees. It uses API key authentication similar to AWS S3.

## Prerequisites

* A SaveMate account with a [Professional plan](/docs/billing/plans)
* A Cloudflare account with R2 enabled
* An R2 bucket and API token

## Step 1: Create an R2 bucket

1. Sign in to the [Cloudflare Dashboard](https://dash.cloudflare.com/)
2. Navigate to **R2 Object Storage** in the sidebar
3. Click **Create bucket**
4. Enter a bucket name (e.g., `savemate-videos`)
5. Choose a location hint closest to you
6. Click **Create bucket**

## Step 2: Create an R2 API token

1. In the Cloudflare Dashboard, go to **R2 Object Storage**
2. Click **Manage R2 API Tokens**
3. Click **Create API token**
4. Configure the token:
   * **Token name**: `SaveMate Uploader`
   * **Permissions**: Object Read & Write
   * **Specify bucket(s)**: Select your SaveMate bucket only
5. Click **Create API Token**
6. Copy the **Access Key ID** and **Secret Access Key**

<Warning>The Secret Access Key is only shown once. Save it before closing.</Warning>

## Step 3: Get your R2 endpoint

Your R2 S3-compatible endpoint follows this format:

```
https://<ACCOUNT_ID>.r2.cloudflarestorage.com
```

Find your Account ID on the R2 overview page in the Cloudflare Dashboard.

## Step 4: Connect in SaveMate

<Steps>
  <Step title="Open Cloud Sync">
    Navigate to [savemate.io/cloud-sync](https://savemate.io/cloud-sync) and sign in.
  </Step>

  <Step title="Click Connect on Cloudflare R2">
    Find the Cloudflare R2 card and click **Connect**.
  </Step>

  <Step title="Enter your credentials">
    Fill in the connection form:

    * **Access Key ID** — Your R2 API token access key
    * **Secret Access Key** — Your R2 API token secret key
    * **Bucket name** — Your R2 bucket name
    * **Endpoint** — Your R2 S3-compatible endpoint URL
  </Step>

  <Step title="Test and save">
    SaveMate validates the credentials. If successful, the connection is saved.
  </Step>
</Steps>

## How uploads work

R2 uses the same **multipart upload** protocol as S3:

* Files over 100MB are split into parts and uploaded in parallel
* Parts are 10MB each (minimum 5MB)
* Uploads can be paused and resumed
* Supports files up to 50TB
* Files under 100MB use a single direct upload

## Why choose R2?

| Feature                | AWS S3              | Cloudflare R2          |
| ---------------------- | ------------------- | ---------------------- |
| Storage cost           | \~\$0.023/GB/month  | \~\$0.015/GB/month     |
| Egress (download) fees | \$0.09/GB           | **Free**               |
| S3 API compatible      | Native              | Yes                    |
| Best for               | AWS ecosystem users | Cost-sensitive storage |

R2's zero egress fees make it especially cost-effective if you plan to access your uploaded files frequently.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection test fails">
    Double-check that your endpoint URL follows the format `https://<ACCOUNT_ID>.r2.cloudflarestorage.com` and that you selected the correct bucket when creating the API token.
  </Accordion>

  <Accordion title="Permission denied">
    Ensure your R2 API token has **Object Read & Write** permissions and is scoped to the correct bucket.
  </Accordion>

  <Accordion title="Slow uploads">
    R2 performance depends on the location hint you chose when creating the bucket. If uploads are consistently slow, consider creating a new bucket with a location hint closer to your physical location.
  </Accordion>
</AccordionGroup>
