Generate your token, access key and bucket in Cloudflare R2

Ver en Español

Step-by-step guide to configure Cloudflare R2 and retrieve the required connection credentials to upload files from your website.

Step 1: Find Your Account ID

    1. Log in to your Cloudflare Dashboard: dash.cloudflare.com. If you don’t have an account, you must create one.

    2.  When you’re in the Cloudflare dashboard, your account ID is always displayed directly in your browser’s address bar.It has the following structure: [https://dash.cloudflare.com/](https://dash.cloudflare.com/)XXXXXXXXXXXXXXXXXXXXXXXXXX/r2/overviewThe combination of letters and numbers that appears is your account ID.
    3. Copy and paste it into the relevant section of the theme’s dashboard.

Step 2: Create a Storage Bucket

    1. Inside the R2 section, click the Create bucket button.

  1. Enter a name for your storage container in the Bucket Name field (e.g., my-files or uploads).

  2. Click Create bucket.

  3. The name you choose here is exactly what you should enter in the Bucket Name field of your WordPress dashboard.

Step 3: Generate Access Key and Secret Key

  1. Return to the main R2 overview page from the left menu.

  2. Click API Tokens.

  3. Click the Create Account API token button.

  4. Configure the token settings:

    • Token name: Enter a descriptive name (e.g., WordPress Uploader).

    • Permissions: Select Admin Read & Write.

    • Client IP Address Filtering: You can add IPs to limit token usage.

  5. Click the Create Account API token button.

  6. On the confirmation screen, your credentials will be displayed:

    • Access Key ID: Copy and paste it into the theme panel option.

    • Secret Access Key: Copy and paste it into the theme panel option.

Important: Both keys are only displayed once. If you close the window without copying them, you will have to delete the token and create a new one.

Step 4: Enable Public Access for Downloads

By default, files uploaded to R2 are private. To allow users to download files publicly via a URL, enable public access:

  1. Go to R2 and click on your bucket name.

  2. Select the Settings tab.

  3. Scroll down to the Public development URL section, click Allow, type allow in the confirmation box, and confirm.

  4. Copy the public URL assigned by Cloudflare (e.g., [https://pub-xxxxxxxx.r2.dev](https://pub-xxxxxxxx.r2.dev)) and enter it into your public domain setting.

(Optional: In the same Settings section, you can click Connect Domain under Custom Domains to attach a custom subdomain such as downloads.yourdomain.com).