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

# Cloudflare R2

> Access files from Cloudflare R2 buckets

## How it works

The R2 connector pulls in all documents from the specified Cloudflare R2 bucket.
It supports various file formats including PDF, DOC, DOCX, TXT, and more.

Documents are updated every **1** day.

## Setting up

### Authorization

<Steps>
  <Step title="Open R2 dashboard">
    Log into your Cloudflare dashboard. Navigate to "R2" in the sidebar and click on "Manage R2 API Tokens".

    <img className="rounded-image" src="https://mintcdn.com/danswer/aj13v1mzLf028SWE/assets/admins/connectors/blob/r2/manageapi.png?fit=max&auto=format&n=aj13v1mzLf028SWE&q=85&s=c42394473e0b46a0365761eb5c4aba3d" alt="Manage API" width="962" height="1428" data-path="assets/admins/connectors/blob/r2/manageapi.png" />
  </Step>

  <Step title="Create API token">
    Click "Create API token".

    <img className="rounded-image" src="https://mintcdn.com/danswer/aj13v1mzLf028SWE/assets/admins/connectors/blob/r2/newtoken.png?fit=max&auto=format&n=aj13v1mzLf028SWE&q=85&s=09ccf5ec0c50574e6f69e08dad0f02b3" alt="Create API token" width="3188" height="542" data-path="assets/admins/connectors/blob/r2/newtoken.png" />
  </Step>

  <Step title="Set permissions">
    Give your token a name (e.g., "OnyxR2Connector") and select the appropriate permissions (Object Read only).

    <img className="rounded-image" src="https://mintcdn.com/danswer/aj13v1mzLf028SWE/assets/admins/connectors/blob/r2/readonly.png?fit=max&auto=format&n=aj13v1mzLf028SWE&q=85&s=9b40effdaf6305e6bd2e31b1bb4691c2" alt="Read only" width="2650" height="1304" data-path="assets/admins/connectors/blob/r2/readonly.png" />
  </Step>

  <Step title="Copy keys and Account ID">
    Click "Create API Token". On the next screen, copy your Access Key ID and Secret Access Key immediately. Then,
    to find your Account ID, go to the Overview page; the Account ID is listed in the URL as the final substring.

    <img className="rounded-image" src="https://mintcdn.com/danswer/aj13v1mzLf028SWE/assets/admins/connectors/blob/r2/id.png?fit=max&auto=format&n=aj13v1mzLf028SWE&q=85&s=3b4552e00fb02f8157915d468f2bcade" alt="R2 credentials" width="2648" height="240" data-path="assets/admins/connectors/blob/r2/id.png" />
  </Step>
</Steps>

### Indexing

<Steps>
  <Step title="Open R2 connector">
    Navigate to the Admin Panel and select the **R2** Connector.
  </Step>

  <Step title="Enter credentials">
    In **Step 1**, provide your R2 credentials (Access Key ID, Secret Access Key, and Account ID).

    <img className="rounded-image" src="https://mintcdn.com/danswer/aj13v1mzLf028SWE/assets/admins/connectors/blob/r2/Onyx1.png?fit=max&auto=format&n=aj13v1mzLf028SWE&q=85&s=8b0f9c7ccaf2eb8231999f889b8bcfcc" alt="R2 credentials input" width="3438" height="1596" data-path="assets/admins/connectors/blob/r2/Onyx1.png" />
  </Step>

  <Step title="Save credentials">
    Click "Update" to save your credentials.
  </Step>

  <Step title="Select bucket">
    In **Step 2**, specify which R2 bucket you want to make searchable.

    <img className="rounded-image" src="https://mintcdn.com/danswer/aj13v1mzLf028SWE/assets/admins/connectors/blob/r2/Onyx2.png?fit=max&auto=format&n=aj13v1mzLf028SWE&q=85&s=576e7dc02258cf27299b630ecabbb913" alt="R2 bucket selection" width="3450" height="1650" data-path="assets/admins/connectors/blob/r2/Onyx2.png" />
  </Step>

  <Step title="Start indexing">
    Click "Connect" to begin indexing.
  </Step>
</Steps>

## Understanding R2 Structure

Cloudflare R2 organizes data into buckets, similar to Amazon S3.
Each bucket can contain an unlimited number of objects (files). You can think of a bucket as a root directory,
and the objects as files within that directory.

For more information on R2 structure, visit the [Cloudflare R2 documentation](https://developers.cloudflare.com/r2/).
