# Get Your Cloudflare Global API Key

The current API key in your `.env` file is not authenticating correctly. Follow these steps:

## Option 1: Get Global API Key (Current Method)

1. Go to: https://dash.cloudflare.com/profile/api-tokens
2. Scroll down to **API Keys** section
3. Click **View** next to **Global API Key**
4. Enter your Cloudflare password
5. Copy the **Global API Key** (40 characters, alphanumeric)
6. Update `.env`:
   ```
   CLOUDFLARE_API_KEY="your-global-api-key-here"
   CLOUDFLARE_EMAIL="theoracle@defi-oracle.io"
   ```

## Option 2: Create API Token (Recommended - More Secure)

1. Go to: https://dash.cloudflare.com/profile/api-tokens
2. Click **Create Token**
3. Click **Edit zone DNS** template OR create **Custom token** with:
   - **Permissions:**
     - **Zone** → **DNS** → **Edit**
     - **Account** → **Cloudflare Tunnel** → **Edit**
   - **Zone Resources:** Include → Specific zone → `d-bis.org`
   - **Account Resources:** Include → Specific account → Your account
4. Click **Continue to summary** → **Create Token**
5. **Copy the token immediately** (you won't see it again!)
6. Update `.env`:
   ```
   CLOUDFLARE_API_TOKEN="your-api-token-here"
   # Comment out or remove CLOUDFLARE_API_KEY and CLOUDFLARE_EMAIL
   ```

## Verify Your API Key

After updating, test with:
```bash
./scripts/test-cloudflare-api.sh
```

You should see: `✓ API Key works! Email: theoracle@defi-oracle.io`

