{"id":44011199,"url":"https://github.com/coollabsio/cloudflare-cli","last_synced_at":"2026-02-07T14:36:02.858Z","repository":{"id":329098590,"uuid":"1118068433","full_name":"coollabsio/cloudflare-cli","owner":"coollabsio","description":"Unofficial (experimental) CLI for Cloudflare","archived":false,"fork":false,"pushed_at":"2025-12-17T20:22:38.000Z","size":8949,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-22T02:39:38.985Z","etag":null,"topics":["api","cli","cloudflare"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coollabsio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"coollabsio","github":"coollabsio"}},"created_at":"2025-12-17T08:08:15.000Z","updated_at":"2026-01-19T20:10:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/coollabsio/cloudflare-cli","commit_stats":null,"previous_names":["coollabsio/cloudflare-cli"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/coollabsio/cloudflare-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coollabsio%2Fcloudflare-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coollabsio%2Fcloudflare-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coollabsio%2Fcloudflare-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coollabsio%2Fcloudflare-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coollabsio","download_url":"https://codeload.github.com/coollabsio/cloudflare-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coollabsio%2Fcloudflare-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29197022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cli","cloudflare"],"created_at":"2026-02-07T14:36:01.889Z","updated_at":"2026-02-07T14:36:02.846Z","avatar_url":"https://github.com/coollabsio.png","language":"Go","funding_links":["https://opencollective.com/coollabsio","https://github.com/sponsors/coollabsio"],"categories":[],"sub_categories":[],"readme":"# Cloudflare DNS CLI\n\nA command-line tool for managing Cloudflare DNS records, built with Go using the Cobra framework.\n\n## Installation\n\n### Quick Install (recommended)\n\n```bash\n# Global install (requires sudo)\ncurl -fsSL https://raw.githubusercontent.com/coollabsio/cloudflare-cli/main/scripts/install.sh | bash\n\n# User install (no sudo required)\ncurl -fsSL https://raw.githubusercontent.com/coollabsio/cloudflare-cli/main/scripts/install.sh | bash -s -- --user\n```\n\n### Using `go install`\n\n```bash\ngo install github.com/coollabsio/cloudflare-cli@latest\n```\n\nThis will install the `cf` binary in your `$GOPATH/bin` directory (usually `~/go/bin`). Make sure this directory is in your `$PATH`.\n\n### Build from source\n\n```bash\ngit clone https://github.com/coollabsio/cloudflare-cli.git\ncd cloudflare-cli\ngo build -o cf .\n```\n\n## Getting Started\n\n### 1. Get your Cloudflare API Token\n\nCreate an API token in the [Cloudflare Dashboard](https://dash.cloudflare.com/profile/api-tokens) with the following permissions:\n- **Zone:Read** - For listing zones and zone details\n- **DNS:Read** - For listing/viewing DNS records\n- **DNS:Edit** - For creating/updating/deleting records\n\n### 2. Configure Authentication\n\n#### Option A: Save token to config file (recommended)\n\n```bash\ncf auth save \u003cyour-api-token\u003e\n```\n\nThis saves the token to `~/.cloudflare/config.yaml`.\n\n#### Option B: Use environment variables\n\n```bash\nexport CLOUDFLARE_API_TOKEN=your-api-token\n# or\nexport CF_API_TOKEN=your-api-token\n```\n\n#### Option C: Use API Key + Email (legacy)\n\n```bash\nexport CLOUDFLARE_API_KEY=your-api-key\nexport CLOUDFLARE_API_EMAIL=your-email\n```\n\n### 3. Verify authentication\n\n```bash\ncf auth verify\n```\n\n## Currently Supported Commands\n\n### Authentication\n- `cf auth verify` - Verify API credentials\n- `cf auth save \u003ctoken\u003e` - Save API token to config file\n\n### Configuration\n- `cf config set \u003ckey\u003e \u003cvalue\u003e` - Set a config value\n- `cf config get \u003ckey\u003e` - Get a config value\n- `cf config list` - List all config values\n\nAvailable config keys:\n- `output_format` - Default output format (`table` or `json`)\n\n### Zone Management\n- `cf zones list` - List all zones\n- `cf zones get \u003czone-name-or-id\u003e` - Get zone details\n\n### DNS Record Management\n- `cf dns list \u003czone\u003e` - List DNS records\n  - `--type, -t` - Filter by record type (A, AAAA, CNAME, TXT, MX, etc.)\n  - `--name, -n` - Filter by record name\n  - `--search, -s` - Search in name, content, and comment (case-insensitive)\n- `cf dns get \u003czone\u003e \u003crecord-id\u003e` - Get DNS record details\n- `cf dns create \u003czone\u003e` - Create a DNS record\n  - `--type, -t` - Record type (required)\n  - `--name, -n` - Record name (required)\n  - `--content, -c` - Record content (required)\n  - `--ttl` - TTL in seconds (1 = auto, default: 1)\n  - `--proxied` - Proxy through Cloudflare (true|false)\n  - `--priority` - Record priority (for MX, SRV)\n  - `--comment` - Comment for the record\n- `cf dns update \u003czone\u003e \u003crecord-id\u003e` - Update a DNS record\n  - Only specify fields you want to change\n  - `--type, -t` - New record type\n  - `--name, -n` - New record name\n  - `--content, -c` - New record content\n  - `--ttl` - TTL in seconds\n  - `--proxied` - Set proxy status (true|false)\n  - `--priority` - Record priority\n  - `--comment` - Comment for the record (use empty string to clear)\n- `cf dns delete \u003czone\u003e \u003crecord-id\u003e` - Delete a DNS record\n- `cf dns find \u003czone\u003e` - Find DNS records by name and/or type\n  - `--type, -t` - Record type to find\n  - `--name, -n` - Record name to find\n\n## Global Flags\n\nAll commands support these global flags:\n\n- `--config` - Config file path (default: `~/.cloudflare/config.yaml`)\n- `--output, -o` - Output format: `table` (default) or `json`\n\n## Examples\n\n### Zone Operations\n\n```bash\n# List all zones\ncf zones list\n\n# Get zone details\ncf zones get example.com\n\n# Get zone by ID (useful for zone-specific tokens)\ncf zones get 023e105f4ecef8ad9ca31a8372d0c353\n```\n\n### DNS Record Operations\n\n```bash\n# List all DNS records for a zone\ncf dns list example.com\n\n# List only A records\ncf dns list example.com --type A\n\n# List records matching a name\ncf dns list example.com --name www\n\n# Search records by name, content, or comment\ncf dns list example.com --search \"production\"\n\n# Create an A record\ncf dns create example.com --name www --type A --content 192.0.2.1\n\n# Create a proxied CNAME record\ncf dns create example.com --name blog --type CNAME --content example.com --proxied\n\n# Create an MX record with priority\ncf dns create example.com --name mail --type MX --content mail.example.com --priority 10\n\n# Create a record with a comment\ncf dns create example.com --name api --type A --content 192.0.2.10 --comment \"Production API server\"\n\n# Update only the content of a record\ncf dns update example.com abc123def456 --content 192.0.2.2\n\n# Enable proxying on an existing record\ncf dns update example.com abc123def456 --proxied\n\n# Disable proxying\ncf dns update example.com abc123def456 --proxied=false\n\n# Update the comment on a record\ncf dns update example.com abc123def456 --comment \"Updated comment\"\n\n# Clear the comment on a record\ncf dns update example.com abc123def456 --comment \"\"\n\n# Delete a record\ncf dns delete example.com abc123def456\n\n# Find record ID by name and type\ncf dns find example.com --name www --type A\n```\n\n### JSON Output\n\n```bash\n# Get JSON output for scripting\ncf dns list example.com --output json\n\n# Set JSON as default output format\ncf config set output_format json\n```\n\n## Permission Quirk (Important!)\n\nIf you create an API token scoped to specific zones (not \"All zones\"), you **cannot** list zones or look up zone IDs by name. The API returns a permission error.\n\n**Workarounds:**\n\n1. Use the zone ID directly instead of the zone name:\n   ```bash\n   cf dns list 023e105f4ecef8ad9ca31a8372d0c353\n   ```\n\n2. Grant your token \"All zones\" read permission for zone listing\n\nThe CLI accepts both zone names and zone IDs for all commands.\n\n## Configuration File\n\nThe config file is stored at `~/.cloudflare/config.yaml`:\n\n```yaml\napi_token: your-api-token-here\noutput_format: table\n```\n\nEnvironment variables take precedence over config file values.\n\n## Development\n\n```bash\n# Build\ngo build -o cf .\n\n# Run tests\ngo test ./...\n\n# Run with coverage\ngo test -cover ./...\n\n# Install locally\ngo install .\n```\n\n## Architecture\n\n```\ncf/\n├── main.go                 # Entry point\n├── cmd/\n│   ├── root.go            # CLI setup, global flags\n│   ├── auth.go            # auth verify/save commands\n│   ├── config.go          # config set/get/list commands\n│   ├── zones.go           # zones list/get commands\n│   └── dns.go             # dns list/get/create/update/delete/find commands\n├── internal/\n│   ├── client/\n│   │   └── client.go      # Cloudflare API client wrapper\n│   ├── config/\n│   │   └── config.go      # Configuration management\n│   └── output/\n│       └── output.go      # Table/JSON output formatting\n├── go.mod\n└── go.sum\n```\n\n## Dependencies\n\n- [cloudflare-go](https://github.com/cloudflare/cloudflare-go) - Official Cloudflare Go library\n- [cobra](https://github.com/spf13/cobra) - CLI framework\n- [yaml.v3](https://gopkg.in/yaml.v3) - YAML configuration\n\n## Roadmap\n\nThis CLI currently focuses on DNS management, but additional Cloudflare API features are planned:\n\n- **DNS** - Record management (current)\n- **Zones** - Zone settings, purge cache, development mode\n- **SSL/TLS** - Certificate management, SSL settings\n- **Firewall** - WAF rules, IP access rules, rate limiting\n- **Page Rules** - URL-based settings\n- **Workers** - Deploy and manage Workers scripts\n- **R2** - Object storage management\n- **D1** - Database management\n- **KV** - Key-Value storage\n- **Pages** - Cloudflare Pages deployments\n- **Load Balancing** - Pool and monitor management\n- **Access** - Zero Trust access policies\n\nContributions welcome!\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoollabsio%2Fcloudflare-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoollabsio%2Fcloudflare-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoollabsio%2Fcloudflare-cli/lists"}