Overview
OneCLI connects AI agents to Cloudflare so they can deploy Workers, manage DNS records, read and write KV namespaces, query D1 databases, deploy Pages sites, and interact with the full Cloudflare API. The gateway injects your API token into requests automatically.Setup
1
Create an API token in Cloudflare
Go to the Cloudflare dashboard and click Create Token.Choose a template or create a custom token with the permissions your agents need. Common templates:
API tokens can be scoped to specific accounts and zones, so you can restrict what your agents can access.
2
Connect in OneCLI
Open the OneCLI dashboard, go to Connections > Cloudflare, and paste your API token.
How it works
- Your API token is encrypted and stored by OneCLI
- When an agent sends a request to
api.cloudflare.com, the gateway intercepts it - The gateway injects the token as an
Authorization: Bearerheader - The request is forwarded to Cloudflare
What agents can do
Use cases
- Coding agents deploying Workers with
wrangler deploythrough the gateway - Agents managing DNS records during infrastructure provisioning
- Reading and writing to KV stores during application workflows
- Running D1 SQL queries for data operations
- Deploying static sites to Cloudflare Pages
Token permissions
Cloudflare API tokens support fine-grained scoping:- Account level: Scope to a single account or all accounts
- Zone level: Scope to a single zone (domain) or all zones
- Permission groups: Combine multiple permissions (e.g., Workers Edit + DNS Read)
Rate limits
Cloudflare enforces a global rate limit of 1,200 requests per 5-minute window per user. This applies across dashboard, API key, and API token usage combined. Use OneCLI rules to rate-limit agent requests if you need to stay well within this budget.Controlling access with rules
Use OneCLI’s rules engine to control what agents can do:- Block write operations to specific API paths (e.g., block
/purge_cachefor read-only agents) - Rate limit API calls to stay within Cloudflare’s limits
- Require manual approval for destructive operations (e.g., deleting Workers or DNS records)