Contents

Bulk Delete Keys in `Cloudflare KV`

Bulk Delete Keys in Cloudflare KV

Get the List of keys

Run this first

1
pnpm wrangler kv:key list --namespace-id=${namespaceID} > PURGE.json`

This gives you the complete list of keys; if you need a condition, just add: --prefix="prefix"

Bulk Delete

1
cat purge.json | jq -r '.[].name' | xargs -I {} pnpm wrangler kv:key delete --namespace-id=${namespaceID} {}