# Cloudflare on boxd

> Cloudflare is a global network designed to make everything you connect to the Internet secure, private, fast, and reliable.

- Page: https://boxd.sh/integrations/cloudflare/
- CLI: `run cloudflare` (20 commands, 20 marked common)
- SDK: `import { cloudflare } from "@boxd/run"`; every parameter and response type is at `@boxd/run/cloudflare`
- Triggers: none
- Connect: `run auth cloudflare` (API key), or https://app.boxd.sh/integrations/detail/cloudflare
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth cloudflare      # once: prints a link to connect your account
run cloudflare           # list its commands
run cloudflare list-zones
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, cloudflare } from "@boxd/run";

every("1 hour", async () => {
  const result = await cloudflare.listZones({});
  console.log(result);
});
```

Run it with `run cloudflare.run.ts`. Cloudflare has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run cloudflare <command> --help` lists the optional ones. "common" marks what `run cloudflare` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `create-dns-record` ·common | `cloudflare.createDnsRecord()` | `--content` `--name` `--type` `--zone-identifier` | 6 | Create a new DNS record within a specific zone |
| `create-list` ·common | `cloudflare.createList()` | `--account-id` `--kind` `--name` | 1 | Create a new empty custom list for use in WAF rules and filters |
| `create-zone` ·common | `cloudflare.createZone()` | `--name` | 3 | Creates a new DNS zone (domain) in Cloudflare |
| `delete-dns-record` ·common | `cloudflare.deleteDnsRecord()` | `--identifier` `--zone-identifier` | 0 | Delete a DNS record within a specific zone |
| `delete-list` ·common | `cloudflare.deleteList()` | `--account-id` `--list-id` | 0 | Delete a WAF list |
| `delete-zone` ·common | `cloudflare.deleteZone()` | `--zone-identifier` | 0 | Delete a zone |
| `get-bot-management-settings` ·common | `cloudflare.getBotManagementSettings()` | `--zone-id` | 0 | Retrieve a zone's Bot Management configuration (Bot Fight Mode / Super Bot Fight Mode / Enterprise Bot Management) |
| `get-lists` ·common | `cloudflare.getLists()` | `--account-id` | 0 | Fetch all WAF lists (no items) for an account |
| `list-account-members` ·common | `cloudflare.listAccountMembers()` | `--account-id` | 5 | Lists all members of a Cloudflare account with their roles, permissions, and status |
| `list-accounts` ·common | `cloudflare.listAccounts()` | — | 4 | List all Cloudflare accounts you have ownership or verified access to |
| `list-dns-records` ·common | `cloudflare.listDnsRecords()` | `--zone-id` | 10 | List and search DNS records in a Cloudflare zone |
| `list-firewall-rules` ·common | `cloudflare.listFirewallRules()` | `--zone-id` | 5 | List firewall rules for a specific DNS zone |
| `list-monitors` ·common | `cloudflare.listMonitors()` | `--account-id` | 4 | List all load-balancer monitors in a Cloudflare account |
| `list-pools` ·common | `cloudflare.listPools()` | `--account-id` | 3 | List all load balancer pools in a Cloudflare account |
| `list-tunnels` ·common | `cloudflare.listTunnels()` | `--account-id` | 4 | List Cloudflare Tunnel (cloudflared) tunnels in an account to discover tunnel IDs, names, and statuses |
| `list-zones` ·common | `cloudflare.listZones()` | — | 8 | Lists, searches, sorts, and filters zones in the authenticated account |
| `update-dns-record` ·common | `cloudflare.updateDnsRecord()` | `--identifier` `--zone-identifier` | 7 | Update an existing DNS record within a specific zone |
| `update-list` ·common | `cloudflare.updateList()` | `--account-id` `--description` `--list-id` | 0 | Update the description of a WAF list (cannot update items) |
| `update-tunnel-configuration` ·common | `cloudflare.updateTunnelConfiguration()` | `--account-id` `--config` `--tunnel-id` | 0 | Update a remotely-managed Cloudflare Tunnel's configuration (ingress rules and routing) |
| `update-zone` ·common | `cloudflare.updateZone()` | `--zone-id` | 3 | Update properties of an existing zone; changes apply immediately to the live zone |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
