Skip to content

Cloudflare Integration

Overview

StarkOne integrates with Cloudflare's API to manage DNS records, cache, and security modes directly from the panel - without logging into the Cloudflare dashboard.

Configuration

Set global Cloudflare credentials in Settings → Cloudflare:

PATCH /api/settings
{
  "cloudflare_api_key": "your-api-key",
  "cloudflare_email": "[email protected]"
}

Or use a per-website Cloudflare API token.

Per-Website Cloudflare

All endpoints are under /api/webapps/:id/cloudflare and require websites_administration.

Connect / Disconnect

# Get Cloudflare status for a website
GET /api/webapps/:id/cloudflare/status

# Connect (link website to Cloudflare zone)
POST /api/webapps/:id/cloudflare/connect
{ "zone_id": "abc123" }

# Disconnect
DELETE /api/webapps/:id/cloudflare/connect

DNS Records

# List records
GET /api/webapps/:id/cloudflare/dns

# Create record
POST /api/webapps/:id/cloudflare/dns
{
  "type": "A",
  "name": "www",
  "content": "1.2.3.4",
  "proxied": true,
  "ttl": 1
}

# Update record
PATCH /api/webapps/:id/cloudflare/dns/:record_id
{ "content": "5.6.7.8" }

# Delete record
DELETE /api/webapps/:id/cloudflare/dns/:record_id

Cache

# Purge cache for all files
POST /api/webapps/:id/cloudflare/cache/purge

# Set cache mode
POST /api/webapps/:id/cloudflare/cache/mode
{ "mode": "aggressive" }   # standard | aggressive | bypass

Attack Mode (Under Attack Mode)

POST /api/webapps/:id/cloudflare/attack-mode
{ "enabled": true }

Firewall Integration

Allow only Cloudflare IPs via CSF:

POST /api/firewall/cloudflare
{ "enabled": true }

This fetches the current Cloudflare IP ranges and adds them to CSF's allow list, then restricts HTTP/HTTPS access to those IPs only.