Cloudflare’s beta cf CLI gives coding agents a documented workflow for finding Cloudflare operations, inspecting their inputs, previewing writes, and processing JSON results. It is designed for the public Cloudflare API and Workers projects, but its beta status, safeguards, authentication, and project-configuration boundaries matter before you put it in an agent or CI pipeline.
What is Cloudflare’s cf CLI?
Cloudflare describes cf as one command-line interface for its public API and Workers projects. Most of its more than 2,900 commands are generated from public API schemas; that is Cloudflare’s stated count, not an independently audited figure or a measure of performance. The CLI is in beta, so commands and configuration may change. Cloudflare CLI overview
As an Amazon Associate I earn from qualifying purchases.
Its agent-oriented design addresses a practical problem: an API with thousands of operations is difficult to navigate by loading every command’s help at once. Instead, the documented pattern is to search for a task, inspect the likely operation, then preview or execute it. Cloudflare documents these capabilities, but does not publish benchmarks showing that they improve agent accuracy, speed, or safety.
How an agent can find and verify a command
Search by the intended task
Use cf cli search with a natural-language description, such as cf cli search "create D1 database" or cf cli search "create a DNS record". Search runs locally, requires no credentials, and returns up to five matching commands as JSON, with the best match first. Treat the results as candidates to inspect, not as authorization to run a write. Cloudflare’s guide to using cf with coding agents
#1 Best Overall
Inspect the operation and its arguments
Run cf schema <command> for the selected command to see its operation ID, HTTP method and path, parameters, whether it accepts a request body, and any listed body fields. Then check the command’s --help output for its arguments and options. This separates discovering a plausible operation from checking what it will actually request.
Some request-body schemas have incomplete or empty field listings. In those cases, the CLI documentation says to provide the complete body with --body and consult the relevant API reference. Do not infer that an empty field listing means the API accepts an empty body.
Preview writes and handle destructive commands cautiously
Add --dry-run to print a request as JSON without sending it. Dry runs do not require credentials. Review the target resource, account or zone, and request scope before removing the flag and running a write. Cloudflare’s guide to using cf with coding agents
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchDestructive commands need special treatment in automation. Cloudflare warns that a destructive command run non-interactively without --force can print Aborted. and still exit with status 0. A successful process status therefore does not prove deletion happened. Check the output and, when the workflow requires confirmation, verify the resource’s resulting state through an appropriate follow-up operation.
Read the meaning of each --force option before using it. In some commands, force is an API parameter rather than merely a way to bypass an interactive prompt; it can broaden the effect, such as allowing deletion of a Worker referenced by other Workers. Prefer the narrowest operation and scope that accomplishes the task.
Parse output without assuming every command returns a page of data
Command results are written as JSON to standard output; messages and errors go to standard error. When standard output is not a terminal, it contains only the result, which makes it suitable for a parser or a pipeline such as one using jq. Keep diagnostics separate from parsed data rather than treating every printed message as part of the JSON result. Cloudflare’s guide to using cf with coding agents
Account for two important edge cases in scripts:
- List commands return one page. Paging options vary by command, so inspect that command’s help and handle pagination when the task needs a complete result set.
- Some commands that return no data produce no standard output. An empty stream is not necessarily malformed JSON or a failed operation; interpret it alongside the command’s documented behavior and stderr.
Install and authenticate for the right environment
Install the CLI
Cloudflare’s getting-started guide documents global installation using npm, Yarn, pnpm, or Bun. The package exposes both cf and cloudflare command names; use cloudflare if another program already occupies cf on your PATH. Cloudflare specifies Node.js 22.18 or later for loading cloudflare.config.ts; Bun is not supported for loading that configuration file. Cloudflare CLI getting started
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Use OAuth interactively, a scoped token in automation
For an interactive login, run cf auth login and confirm the identity with cf auth whoami. The CLI manages its own credentials and does not reuse a Wrangler login.
For an unattended agent or CI job, Cloudflare documents the CLOUDFLARE_API_TOKEN environment variable. Give the token only the permissions the job needs. Credential selection checks the environment token first, followed by a selected profile, a directory-bound profile, and the default login. Cloudflare says the Global API Key is not supported. If a non-interactive session can access multiple accounts, resolve account selection explicitly or save the intended selection so the command does not depend on an ambiguous default. Cloudflare’s guide to using cf with coding agents Cloudflare CLI getting started
Keep resource commands separate from project migration decisions
Cloudflare says resource-management commands can run alongside an existing Wrangler project. That does not mean every Workers project command is safe to run against a Wrangler-only configuration.
Do not run cf dev, cf build, or cf deploy in a project that has a Wrangler configuration but no cloudflare.config.ts. Cloudflare warns these commands may generate a configuration that ignores wrangler.jsonc or fail. The documented migration path begins with cf migrate --dry-run; review the preview before migrating, then resolve generated TODO(@cloudflare) comments. Cloudflare’s guide to using cf with coding agents
The new Workers configuration format, cloudflare.config.ts, is an open beta TypeScript module that can define Worker, Container, and account settings. Loading it requires Node.js 22.18 or later, and Bun is not supported for this use. Project commands can evaluate the configuration and build the application, so configuration errors can affect command execution. Cloudflare typed configuration documentation
When cf fits an agent workflow—and when to pause
| Question | What cf offers | What to consider |
|---|---|---|
| Need to manage public API resources as well as Workers projects? | A CLI for both the public Cloudflare API and Workers projects. | Its beta status means command and configuration details can change. Cloudflare CLI overview |
| Need an agent to navigate many API operations? | Natural-language task search, command schema inspection, command help, and JSON output. | Search suggests candidates; the operator or agent still needs to check operation, arguments, target, and scope. Agent guide |
| Already using Wrangler configuration? | Resource commands can coexist with a Wrangler project. | Workers project commands require attention to the configuration format; do not run the specified dev/build/deploy commands in a Wrangler-only project without following the documented migration path. Agent guide |
| Automating in CI or a coding agent? | A scoped API token can be supplied through CLOUDFLARE_API_TOKEN. |
Limit permissions, select the intended account, and do not treat exit status alone as proof of a destructive operation’s outcome. Agent guide |
Use cf when task-oriented discovery, schema inspection, and machine-readable output suit the work and you can accommodate its beta behavior. Continue with the existing Wrangler workflow where project configuration or migration risk makes switching project commands inappropriate. The documentation supports this as a fit decision, not a claim that one tool is universally better. Cloudflare CLI overview
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




