How to set up a free Cloudflare R2 bucket for TagSet

Time
About 10 minutes
Cost
Free up to 10 GB and 1 million uploads a month
You end up with
A private bucket and keys that only work for that bucket

Cloudflare R2 is the easiest place to start: the free tier covers thousands of photos, and downloading your dataset for training costs nothing. You'll create a bucket, create keys that only work for that bucket, and paste them into TagSet.

What the free tier covers

Free each monthWhat it means for TagSet
10 GB storageRoughly 20,000 photos at about 0.5 MB each (TagSet's default: 2048 px, JPEG quality 85)
1 million Class A operationsEach upload is one. So is each tap on Test Connection.
10 million Class B operationsReading files, for example when you download your dataset
Egress (downloads) always freePulling the whole dataset to your computer or a GPU server costs nothing

The free tier only applies to the Standard storage class, which is the default. Details: R2 pricing.

Set it up

  1. Create a bucket

    In the Cloudflare dashboard, open R2 Object Storage and select Create bucket. Name it, for example tagset-dataset (lowercase letters, numbers and hyphens). Leave Location on Automatic and the default storage class on Standard, then select Create bucket.

  2. Start an API token

    Go back to R2 Object Storage → Overview. Under Account Details, select Manage next to API Tokens, then Create Account API token. An account token keeps working even if your Cloudflare user is later removed from the account; a user token doesn't.

    Only a Super Administrator of the Cloudflare account can create account tokens. If you don't see the button on a shared account, ask an admin, or use Create User API token instead.

  3. Limit the token to your bucket

    Name the token, for example TagSet iPhone. Under Permissions choose Object Read & Write. Under Specify bucket(s) choose Apply to specific buckets only and pick your bucket. Leave the TTL on Forever and select Create Account API Token.

    R2 has no upload-only permission. Object Read & Write is the smallest one that lets TagSet upload, and limited to one bucket it can't reach anything else in your account.

  4. Copy the keys and the endpoint

    The next page shows an Access Key ID and a Secret Access Key. Copy both now: you can't see the secret again after leaving this page. If you lose it, delete the token and create a new one. TagSet doesn't need the Token value shown above them.

    Under Use jurisdiction-specific endpoints for S3 clients, copy the Default endpoint. It looks like https://<ACCOUNT_ID>.r2.cloudflarestorage.com. For an EU bucket, copy the European Union (EU) one instead: https://<ACCOUNT_ID>.eu.r2.cloudflarestorage.com.

  5. Enter everything in TagSet

    In TagSet, open Settings → Cloud Storage and fill in:

    TagSet fieldWhat to enterExample
    Endpoint URLThe endpoint from step 4, without a bucket name at the endhttps://3f2a…9c.r2.cloudflarestorage.com
    Bucket NameYour bucket's name from step 1tagset-dataset
    Access Key IDAccess Key ID from step 432 characters
    Secret Access KeySecret Access Key from step 464 characters
    Region (under Advanced)auto, the default. You can leave it empty.auto
    Key Prefix (optional)A folder to put all uploads in, or nothingdataset/
  6. Test it and take your first photo

    Tap Test Connection. Connection successful! means TagSet could reach and list your bucket. Tap Save, take a photo and pick a label. With auto-upload on (the default), it shows up a few seconds later in the bucket's Objects tab in the Cloudflare dashboard, filed under its label:

    <label>/<timestamp>_<id>.jpg
    cat/2026-10-31T14-05-09_3f9a1c2e.jpg

    Folder names are your labels in lowercase, with spaces turned into underscores. Accents and special characters are dropped, so “Käse” is filed under kse/. The timestamp is in UTC. With a key prefix, it comes first: dataset/cat/….

Troubleshooting

When something's wrong, TagSet shows Connection failed: followed by the error, which includes the HTTP status code.

You seeLikely causeFix
Status code 403 A key is wrong or incomplete, the token was deleted or isn't allowed to use this bucket, or the endpoint includes the bucket name End the endpoint at .r2.cloudflarestorage.com. Copy both keys again. Check that the token lists this bucket. If the secret is lost, create a new token.
Status code 404 Bucket name typo, or an EU bucket used with the default endpoint (or the other way round) Check the bucket name. EU-jurisdiction buckets only work with the .eu. endpoint.
Status code 400 Region is set to an AWS region such as eu-central-1 Set Region to auto.
Connection error or host lookup failed Typo in the endpoint Copy the endpoint again from the token page.
Must start with https:// The endpoint is missing its scheme Add https:// in front.

How safe are these keys?

  • One bucket only. The token can't see or change your other buckets, your domains or anything else in your Cloudflare account. Inside the bucket it can read, write and delete, because R2 has no upload-only permission. TagSet itself only ever lists the bucket and uploads.
  • They stay on your iPhone. TagSet keeps them in the iOS Keychain. There's no TagSet server, so they only ever go to Cloudflare.
  • Revoke them anytime. Delete the token under R2 Object Storage → Manage API Tokens. Uploads stop right away; photos already in the bucket stay.

Next: get your dataset onto your computer

Downloading from R2 is free. With rclone, set up R2 once, then copy the bucket into a local folder. You can reuse the same keys, or create a second token with Object Read only for your computer.

rclone config create r2 s3 provider=Cloudflare \
  access_key_id=YOUR_ACCESS_KEY_ID \
  secret_access_key=YOUR_SECRET_ACCESS_KEY \
  endpoint=https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com

rclone copy r2:YOUR-BUCKET ./dataset --progress

For an EU bucket, use the .eu. endpoint here too. To keep the secret out of your shell history, run rclone config instead and answer its questions.

If you used a key prefix, copy that folder instead, for example r2:YOUR-BUCKET/dataset. You get one folder per label, which most ML tooling reads directly:

from torchvision.datasets import ImageFolder

ds = ImageFolder("dataset/")
print(ds.classes)  # one class per label folder

Prefer Amazon S3? See the Amazon S3 guide.