---
title: "Cloudflare CLI vs Wrangler and the REST API in 2026"
description: "Cloudflare CLI (Wrangler) manages Workers, Pages, KV, R2 and D1. For DNS and cache operations, you'll need the REST API alongside it."
url: https://www.activepieces.com/blog/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2026
updated: 2026-12-06
---

> Every page on www.activepieces.com is available as markdown: add `.md` to the URL, or send `Accept: text/markdown`. Site index: https://www.activepieces.com/llms.txt

# Cloudflare CLI vs Wrangler and the REST API in 2026

By Gustavo Peixoto · December 6, 2026 · 14 min read · Filed under [Automation tutorials](https://www.activepieces.com/blog/category/automation-tutorials)

**Summary**

Wrangler is Cloudflare's CLI, handling Workers and storage while the REST API manages DNS and zone tasks.

- Wrangler downloads 50,992,990 weekly on npm, against Vercel's 5,526,446.
- Wrangler v4 had 169 releases while v3 had 114 and v2 had 21.
- Free Cloudflare zone runs Workers; Business at $200 monthly adds zero Workers quota.

The Cloudflare CLI is Wrangler, an npm package that manages Workers, Pages, KV, R2 and D1. **DNS records, zone settings and cache purge live in the REST API, so you need both surfaces.** That split is easy to script around, whether you call the API from a shell script or from a workflow tool like [Activepieces](https://www.activepieces.com).

![Two toolboxes on a workbench: one holds five small parts for Workers, Pages, KV, R2 and D1; the other holds DNS records…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/bf76835b-e563-49c7-ab3a-8c8fb8ce296c/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2-0933dcce.webp)

The Cloudflare CLI refers to the set of command-line tools used to manage a Cloudflare account, chiefly Wrangler for Workers and the developer platform, alongside the REST API, authenticated with scoped API tokens, for zone-level tasks such as DNS and cache purge.

There's a reason Wrangler's the default. It pulls [50,992,990 downloads a week on npm](https://www.npmjs.com/package/wrangler), against 5,526,446 for Vercel's CLI, 5,177,365 for Firebase tools and 437,632 for the Netlify CLI.

That's roughly nine times Vercel, so the answers you find in issues and Q&A threads are overwhelmingly Wrangler answers.

**Before you trust a snippet, check your version**. A tutorial written for v3 may use flags that v4 changed. [Keelbench](https://keelbench.com/pkg/npm/wrangler/) counts 21 releases for v2, 114 for v3 and 169 for v4, so Wrangler moves fast.

## Cloudflare CLI is Wrangler, and what it covers

Decide before you write the script which surface owns each resource; the table shows it. Anything marked "no" for Wrangler needs a scoped API token and a REST call.

| Resource | Managed by Wrangler | Managed by REST API | Example command or endpoint |
|---|---|---|---|
| Workers | Yes | Yes | `wrangler deploy` |
| Pages | Yes | Yes | `wrangler pages deploy` |
| KV | Yes | Yes | `wrangler kv namespace list` |
| R2 | Yes | Yes | `wrangler r2 bucket list` |
| D1 | Yes | Yes | `wrangler d1 list` |
| DNS records | No | Yes | `GET /zones/{zone_id}/dns_records` |
| Zone settings | No | Yes | `GET /zones/{zone_id}/settings` |
| Cache purge | No | Yes | `POST /zones/{zone_id}/purge_cache` |

On macOS, Linux and Windows the command's the same, because Wrangler's a Node package: `npm install -D wrangler` inside a project. Installing per project pins the version, so a teammate's machine and your CI run the same release.

![A laptop beside a project folder with a package box inside it; a teammate's laptop and a CI server each hold an identical…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/38a493c0-6d6b-4917-b40b-39105e82624e/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2-d754c443.webp)

Use `npx wrangler` to run it. Windows needs Node installed first.

Run `npx wrangler --version`. A version number starting with 4 means you're on the current major line. A 3 or 2 means older docs and flags may not match, so upgrade before debugging anything else.

![Wrangler releases by major version line](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/90f73a11-6792-4ff1-a6f7-e4c1e19cbb3c/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2-72411ed4.svg "Source: Keelbench")

## Cloudflare sign-in with OAuth and API tokens

Use `wrangler login` on your laptop and a scoped API token in CI; skip the legacy Global API Key unless something old forces it.

| Method | How created | Scope | Laptop fit | CI fit |
|---|---|---|---|---|
| `wrangler login` (OAuth) | Browser consent flow run from the terminal | Permissions granted at consent, tied to your user | Good, nothing to copy or store | Poor, it needs a browser |
| Scoped API token | Created in the dashboard with chosen permissions and resources | Only what you select, on the accounts or zones you pick | Fine, but you must store it | Good, set as an environment variable |
| Legacy Global API Key | Viewed in the dashboard profile | Everything your user can do | Works, but over-privileged | Works, but a leak's a full account leak |

### Wrangler login for a laptop

Run `wrangler login`, approve the consent screen in the browser, and Wrangler stores the credential locally. You never paste a secret, so there's nothing to leak into shell history.

### Creating a scoped API token for CI

Create the token in the dashboard and limit it to the one account or zone. Grant only the permissions the job needs (a Workers deploy job doesn't need DNS edit rights). Then export it:

![One API token card on a desk, tied by string to one account folder and one zone folder, beside a column of permission…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/4fa39526-4f4f-4151-b338-590448b35402/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2-a6956572.webp)

```
export CLOUDFLARE_API_TOKEN=<your token>
export CLOUDFLARE_ACCOUNT_ID=<your account id>
```

When the token can see more than one account, setting `CLOUDFLARE_ACCOUNT_ID` matters, because otherwise Wrangler can't tell which one to deploy to and a non-interactive run fails instead of prompting. Store both as CI secrets, not in the repository.

Run `wrangler whoami` before debugging anything else. It shows which account Wrangler's acting as and how it logged in.

If an environment token is set, expect it to take precedence over the OAuth login, which explains many "works on my machine" mismatches.

## Wrangler commands developers use most, with examples

Once you know which credential is winning, the daily Wrangler work's a short loop: create, run locally, set secrets, deploy, tail, delete, plus subcommands for KV, R2 and D1.

1. `npm create cloudflare@latest my-worker` scaffolds a project (`wrangler init`'s the older entry point).
2. `wrangler dev` runs it locally so you can hit it before anything's public.
3. `wrangler secret put API_KEY` stores a secret, prompting for the value.
4. `wrangler deploy` publishes it to your account.
5. `wrangler tail` streams live logs from the deployed Worker.
6. `wrangler delete` removes the Worker when you're done.

Skip step 3 and you ship a Worker that returns `undefined` for its own API key, so set secrets before the first deploy.

### Wrangler secrets, KV, R2 and D1 commands

For values that must never sit in your repo, use `wrangler secret put`. Storage has its own subcommands: `wrangler kv namespace create`, `wrangler r2 bucket create` and `wrangler d1 create`.

Each creates a resource that does nothing for your code until you bind it in config. For D1, `wrangler d1 execute` runs SQL against the database.

### The wrangler config file and environment variables

In your project's `wrangler.toml` (or `wrangler.jsonc`) sit the Worker name, entry point, compatibility date and bindings. A binding's the name your code uses to reach a KV namespace, R2 bucket or D1 database.

If creating a resource worked but `env.MY_KV` is undefined at runtime, this file lacks the binding.

Put plain variables under `vars`. For local-only secrets, use a `.dev.vars` file, which `wrangler dev` reads and which stays out of git. Use `--env` to deploy a named environment such as staging.

![New variable dialog in Activepieces showing name and value fields for storing an API key securely.](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/2ed45337-9239-4a0c-b46a-e23f1f5cc9a1/how-to-automate-a-telegram-bot-with-ai-in-2026-s-ce519bf2.webp)

### Reading live logs with wrangler tail

Once the Worker's deployed, `wrangler tail` attaches to it and prints each request and any `console.log` output as it happens. Add `--status error` to show only failing requests, which cuts the noise when you're chasing one bad route.

When you reach cleanup, `wrangler delete` removes the Worker, but any KV, R2 or D1 resources you created stay until you delete them separately.

## Cloudflare pricing and rate limits, checked December 2026

Domain plans are one ladder; Workers usage's a separate meter.

On its [plans page](https://www.cloudflare.com/plans/), [Cloudflare](https://www.cloudflare.com/plans/) lists Free at $0 per month, Pro at $20 per month and Business at $200 per month on annual billing, which means users can get started at zero cost. Those prices cover a domain (a zone).

![What Cloudflare self-serve plans cost per month](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/4d9718a7-acaf-462f-aafc-be7016dd118b/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2-7ee90222.svg "Source: Cloudflare")

**A $0 Free zone can still run Workers**, and a $200 Business zone gets **no extra Workers quota from that fee**, so there's no Workers-quota premium for paying $200.

### Workers Free versus Workers Paid

Here's what each tier gives you and what happens when you hit the ceiling. Cells marked "unconfirmed" are figures I couldn't verify against Cloudflare's docs for this article. Check them before you plan capacity around them.

| | Requests quota | CPU time per invocation | Price per unit | Behavior at limit |
|---|---|---|---|---|
| Workers Free | Unconfirmed | Unconfirmed | $0 | Unconfirmed |
| Workers Paid | Unconfirmed | Unconfirmed | Unconfirmed | Unconfirmed |
| Cloudflare API global rate limit | Unconfirmed | Not applicable | Not applicable | HTTP 429 |

The one cell I'll commit to's the last: the REST API answers an over-limit call with a 429, not a silent drop.

I have no confirmed per-unit prices for KV, R2 or D1 here, so I won't quote any. Cloudflare meters each separately from Workers requests, so a cleanup that removes the Worker but leaves a bucket or database keeps accruing storage charges.

List your resources with Wrangler after every teardown and delete what's left.

### API rate limits and the 429 response

When the API refuses you, the status line is:

```
HTTP/1.1 429 Too Many Requests
```

That means you're over the global limit for your token or account, so avoid retrying in a tight loop. Back off, spread calls out, and batch where an endpoint allows it.

## Common Wrangler and API errors and fixes

When a deploy or request fails, it's **usually one of five errors**, the 429 among them, and each has a short, specific fix.

- A token missing a scope, or an account ID that belongs to a different account, returns an authentication error. Recreate the token with the permission the call needs and set `CLOUDFLARE_ACCOUNT_ID` to the right account.
- A 429 means you're sending too fast. Retry with exponential backoff and a little jitter.
- A Worker over its script size or CPU limit fails at deploy or at runtime. Trim dependencies or move heavy work elsewhere.
- A name in your config that differs from the name in your code leaves a binding undefined. Make them match exactly.
- An old Node version breaks Wrangler before it does anything. Upgrade Node.

### Wrangler deployment and limit errors and fixes

Remove unused packages, and check that your bundle isn't pulling in a whole library for one function.

For binding errors, compare the binding name in `wrangler.toml` or `wrangler.jsonc` against the name your code reads from `env`; a typo gives you `undefined`, not a helpful message. If Wrangler won't start, run `node --version` and upgrade.

![Wrangler dwarfs rival CLIs in npm downloads](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/8a08e756-c0f7-4a8f-a75d-b9cc1fd3ba1c/cloudflare-cli-vs-wrangler-and-the-rest-api-in-2-1609b9b6.svg "Source: npm")

```bash
curl -s https://api.cloudflare.com/client/v4/user/tokens/verify \
 -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
```

If the response has `"success": true` and a status of `active`, the token's valid, so any later failure's about scope or account ID. Account-owned tokens are verified at an account-level path instead.

## Run Cloudflare commands in CI and scheduled jobs

Run `wrangler deploy` in CI with its own scoped API token stored as a repository secret. Recurring work belongs in a Cron Trigger declared in your Wrangler config.

### Deploy from GitHub Actions

1. Store `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` as repository secrets. Wrangler reads both from the environment, so the job never runs an interactive login.
2. Check out the code.
3. Install dependencies.
4. Run `wrangler deploy`, passing the two secrets as environment variables on that step.
5. Add a Cron Trigger in the config if the Worker should also run on a schedule.

Create the token for deploys only, with Workers edit permission and nothing else.

### Scheduled work with Cron Triggers

You don't need a server or a CI schedule just to run a nightly job, because a Cron Trigger fires a Worker on a schedule.

Add a `crons` list under `[triggers]` in `wrangler.toml`, export a `scheduled` handler in the Worker, and the next `wrangler deploy` registers the schedule.

The handler's a separate entry point from `fetch`. A Worker with only a `fetch` handler deploys cleanly and then does nothing when the schedule fires.

### Run Cloudflare API jobs without code

Some jobs aren't Worker code at all: purging the cache after a release, or posting a deploy alert to Slack. An Activepieces flow can run these, and the Cloudflare token it needs doesn't have to sit in our database.

Aim the flow at the zone's `purge_cache` endpoint and add a further step for the alert. Credentials live in central connections.

Give that flow its own token limited to cache purge on the one zone. The flow then can't touch your Workers, and the deploy token can't purge your cache.

## What Activepieces does about this

The mistake this article keeps returning to is reaching for Wrangler when the job belongs to the REST API, and then holding a token that is too broad for either. Activepieces covers the second half of that split.

> The mistake this article keeps returning to is reaching for Wrangler when the job belongs to the REST API, and then holding a token that is too broad for either.

It is where you put the REST-shaped jobs, such as cache purges after a release or a deploy alert, so they stop living as ad hoc `curl` calls in a CI script.

The core is MIT-licensed and ships 751 integrations, which means most common third-party platforms are likely already integrated. If a Cloudflare action you need isn't among them, you can generate one with AI and add it privately to your own instance.

Either way the flow calls the same endpoints this article lists, such as `POST /zones/{zone_id}/purge_cache`, with the same token you would have used from the terminal.

Scoping stays in your hands. Create a token limited to cache purge on one zone, store it as a connection, and the flow can do that one thing.

On a self-hosted instance or the enterprise cloud tier, where secret managers are supported, you can route connection secrets to your own secret manager, so the token never sits in our database. MoneyGram, Moneypenny, Alan and FundingSocieties run Activepieces in production.

![A workflow canvas showing an Instance Stopped trigger connected to a Revoke Token HTTP request step, with the right panel…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/6562aaca-2f20-4c5f-929c-5a24b3c9a908/linkedin-api-access-limits-and-errors-in-2026-sc-d387a7d6.webp)

**Keep Wrangler for what it owns**: `wrangler deploy`, `wrangler tail`, bindings and Cron Triggers. Use a flow for the zone-level work Wrangler can't touch, and give each side its own token.

A failed deploy then points at the deploy token, and a failed purge points at the purge token.

## Frequently asked questions

Once the surface and token are chosen, these are the questions that come up. Each answer follows from the same split: Wrangler for Workers, the REST API for the rest.

### Is there a separate Cloudflare CLI besides Wrangler?

No separate general-purpose command line is covered here: Wrangler's the CLI Cloudflare documents for Workers and the developer platform. Anything outside that, such as DNS, firewall rules or cache purges, goes through the REST API with a scoped token.

If a tutorial tells you to run a `cloudflare` command for zone settings, check it against Cloudflare's docs before you paste it into a terminal.

### Is the Cloudflare CLI free to use?

Installing and running Wrangler costs nothing. What you pay for's the platform behind the commands. Workers has a free plan with usage limits, and paid plans lift those limits.

So the failure you'll hit first is a plan limit on a deploy or a feature, not a licence check in the tool. Read the limits for the product you are deploying to before you build a pipeline around it.

### Can Wrangler manage DNS records?

Not as a general record editor. Wrangler has no command for creating, listing or deleting arbitrary DNS records in a zone. It does touch DNS indirectly: routes and custom domains declared in your Worker's config attach the Worker to a hostname.

For everything else, call the DNS endpoints of the REST API with a token that has only DNS edit permission on that one zone. A leaked token then can change records on that zone and nothing more.

### How do I update Wrangler to the latest version?

Update it the way you installed it. For a project-local install, run `npm install --save-dev wrangler@latest`, then confirm with `npx wrangler --version`.

What worked as "latest" last quarter may have changed flags or defaults, because Wrangler releases often and major versions arrive regularly.

Pin the version in your project and bump it deliberately. Read the release notes on a major bump before CI picks it up, because an unpinned install will take the new major without asking.

## Related reading

- [Figma API: How to Use the REST API (2026 Guide)](https://www.activepieces.com/blog/figma-api-how-to-use-the-rest-api-2026-guide)
- [Confluence API: Cloud REST v2 vs v1 (2026 Guide)](https://www.activepieces.com/blog/confluence-api-cloud-rest-v2-vs-v1-2026-guide)
- [BigCommerce API: REST and GraphQL Overview (2026)](https://www.activepieces.com/blog/bigcommerce-api-rest-and-graphql-overview-2026)

## References

- [Keelbench](https://keelbench.com/pkg/npm/wrangler/)
- [Cloudflare](https://www.cloudflare.com/plans/)
- [npm](https://www.npmjs.com/package/wrangler)
