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

# Cloudflare setup

## Part 1: Cloudflare Data Ingestion

Set up a Cloudflare app so ConfigView can pull your Cloudflare data into the dashboard.

***

### Step 1: Create an API Token

1. Open the API Tokens page directly: **[https://dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens)**
   (in the dashboard this is the user menu in the top-right → **My Profile → API Tokens**).

2. Click the blue **Create Token** button.

3. Scroll to the bottom of the template list to **Create Custom Token** and click **Get started**.

4. Give the token a **Token name** you'll recognize, e.g. `ConfigView`.

5. Under **Permissions**, add one row per item below. Each row is three dropdowns —
   **Group**, then **Permission**, then **Access level**. Click **+ Add more** to add another row.

   | Group   | Permission                                            | Access |
   | ------- | ----------------------------------------------------- | ------ |
   | Account | Account Settings                                      | Read   |
   | Account | Access: Organizations, Identity Providers, and Groups | Read   |
   | Account | Workers Scripts                                       | Read   |
   | Account | API Tokens                                            | Read   |
   | Account | Billing                                               | Read   |
   | Account | Registrar                                             | Read   |
   | Zone    | Zone                                                  | Read   |

6. Under **Account Resources**, choose **Include → your account**. Under **Zone Resources**, choose **Include → All zones from an account → your account**.

7. Click **Continue to summary**, then **Create Token**.

8. **Copy the token value now** — Cloudflare shows it only once. If you lose it you'll have to roll it (see below).

#### Editing an existing token

If a `ConfigView` token already exists but some scripts fail their health check, it most likely has too few permissions. You **cannot view** an existing token's secret value, but you **can** change its permissions:

1. Go to **[https://dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens)**.
2. Find the token in the list, click the **⋯** (or **Edit**) action on its row.
3. Add any missing rows from the permissions table above, then **Continue to summary → Save**.
4. Saving permission changes does **not** change the token value, so you do **not** need to update the secret in ConfigView.
5. If you don't have the original token value (e.g. it was never saved), use **Roll** to generate a new value, then update `CLOUDFLARE_API_TOKEN` in ConfigView (Step 2).

#### Find your Account ID

Open **[https://dash.cloudflare.com](https://dash.cloudflare.com)**, select your account, and copy the **Account ID** from the right-hand sidebar (also visible in the address bar: `dash.cloudflare.com/<account_id>`).

***

### Step 2: Add the Token to ConfigView

1. Go to your ConfigView dashboard: `https://{companyname}.configview.com/admin/secret/`
2. Click **Add Secret**
3. Create the following secrets:
   * `CLOUDFLARE_API_TOKEN`: The API token you just created
   * `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare Account ID
4. Click **Save**

***

### Step 3: Enable the Cloudflare App in ConfigView

1. Go to: `https://{companyname}.configview.com/admin/cron/`
2. You should see **Cloudflare** in the list of available apps
3. Select the scripts you want to run.
4. Click **Save**

***

### Step 4: Verify

1. Go to: `https://{companyname}.configview.com/admin/status/`
2. Run the **Cloudflare** health check.
3. All checks should pass.

If a check fails, verify that your secrets are saved correctly and the token has the required permissions.

***

### Available Scripts

| Script        | Table                      | Description                                                          |
| ------------- | -------------------------- | -------------------------------------------------------------------- |
| Domains       | `cloudflare_domains`       | Zones / domains, plan, status, and activation dates                  |
| Members       | `cloudflare_members`       | Account members, their status, roles, and 2FA                        |
| Workers       | `cloudflare_workers`       | Worker scripts with size, usage model, and deploy metadata           |
| API Tokens    | `cloudflare_api_tokens`    | Account-owned API tokens, status, and last-used dates                |
| Roles         | `cloudflare_roles`         | Account roles and their permission scopes                            |
| Subscriptions | `cloudflare_subscriptions` | Products, licenses, and billing (rate plan, price, frequency, state) |

> **Note:** Cloudflare exposes products, licenses, and billing through a single
> **subscriptions** endpoint — each subscription's `rate_plan` is the product/license
> tier and the `price`, `currency`, `frequency`, and `state` fields describe the billing.

***

### Data Tables

Once the scripts run, the corresponding Cloudflare tables will be created in your database. All tables include a `run_at` column for historical tracking and a `raw` JSON column with the full Cloudflare object.
