Wrangler KV commands
Manage Workers KV namespaces.
npx wrangler kv namespace create [NAMESPACE]
pnpm wrangler kv namespace create [NAMESPACE]
yarn wrangler kv namespace create [NAMESPACE]
-
[NAMESPACE]
string requiredThe name of the new namespace
-
--preview
booleanInteract with a preview namespace
npx wrangler kv namespace list
pnpm wrangler kv namespace list
yarn wrangler kv namespace list
npx wrangler kv namespace delete
pnpm wrangler kv namespace delete
yarn wrangler kv namespace delete
-
--binding
stringThe binding name to the namespace to delete from
-
--namespace-id
stringThe id of the namespace to delete
-
--preview
booleanInteract with a preview namespace
npx wrangler kv namespace rename [OLD-NAME]
pnpm wrangler kv namespace rename [OLD-NAME]
yarn wrangler kv namespace rename [OLD-NAME]
-
[OLD-NAME]
stringThe current name (title) of the namespace to rename
-
--namespace-id
stringThe id of the namespace to rename
-
--new-name
string requiredThe new name for the namespace
Manage key-value pairs within a Workers KV namespace.
npx wrangler kv key put [KEY] [VALUE]
pnpm wrangler kv key put [KEY] [VALUE]
yarn wrangler kv key put [KEY] [VALUE]
-
[KEY]
string requiredThe key to write to
-
[VALUE]
stringThe value to write
-
--binding
stringThe binding name to the namespace to write to
-
--namespace-id
stringThe id of the namespace to write to
-
--preview
booleanInteract with a preview namespace
-
--ttl
numberTime for which the entries should be visible
-
--expiration
numberTime since the UNIX epoch after which the entry expires
-
--metadata
stringArbitrary JSON that is associated with a key
-
--path
stringRead value from the file at a given path
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
npx wrangler kv key list
pnpm wrangler kv key list
yarn wrangler kv key list
-
--binding
stringThe binding name to the namespace to list
-
--namespace-id
stringThe id of the namespace to list
-
--preview
boolean default: falseInteract with a preview namespace
-
--prefix
stringA prefix to filter listed keys
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
npx wrangler kv key get [KEY]
pnpm wrangler kv key get [KEY]
yarn wrangler kv key get [KEY]
-
[KEY]
string requiredThe key value to get.
-
--binding
stringThe binding name to the namespace to get from
-
--namespace-id
stringThe id of the namespace to get from
-
--preview
boolean default: falseInteract with a preview namespace
-
--text
boolean default: falseDecode the returned value as a utf8 string
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
npx wrangler kv key delete [KEY]
pnpm wrangler kv key delete [KEY]
yarn wrangler kv key delete [KEY]
-
[KEY]
string requiredThe key value to delete.
-
--binding
stringThe binding name to the namespace to delete from
-
--namespace-id
stringThe id of the namespace to delete from
-
--preview
booleanInteract with a preview namespace
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
Manage multiple key-value pairs within a Workers KV namespace in batches.
npx wrangler kv bulk get [FILENAME]
pnpm wrangler kv bulk get [FILENAME]
yarn wrangler kv bulk get [FILENAME]
-
[FILENAME]
string requiredThe file containing the keys to get
-
--binding
stringThe binding name to the namespace to get from
-
--namespace-id
stringThe id of the namespace to get from
-
--preview
booleanInteract with a preview namespace
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
npx wrangler kv bulk put [FILENAME]
pnpm wrangler kv bulk put [FILENAME]
yarn wrangler kv bulk put [FILENAME]
-
[FILENAME]
string requiredThe file containing the key/value pairs to write
-
--binding
stringThe binding name to the namespace to write to
-
--namespace-id
stringThe id of the namespace to write to
-
--preview
booleanInteract with a preview namespace
-
--ttl
numberTime for which the entries should be visible
-
--expiration
numberTime since the UNIX epoch after which the entry expires
-
--metadata
stringArbitrary JSON that is associated with a key
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
npx wrangler kv bulk delete [FILENAME]
pnpm wrangler kv bulk delete [FILENAME]
yarn wrangler kv bulk delete [FILENAME]
-
[FILENAME]
string requiredThe file containing the keys to delete
-
--binding
stringThe binding name to the namespace to delete from
-
--namespace-id
stringThe id of the namespace to delete from
-
--preview
booleanInteract with a preview namespace
-
--force
boolean alias: --fDo not ask for confirmation before deleting
-
--local
booleanInteract with local storage
-
--remote
booleanInteract with remote storage
-
--persist-to
stringDirectory for local persistence
The following global flags work on every command:
--help
boolean- Show help.
--config
string (not supported by Pages)- Path to your Wrangler configuration file.
--cwd
string- Run as if Wrangler was started in the specified directory instead of the current working directory.
Below are deprecations to Wrangler commands for Workers KV.
Since version 3.60.0, Wrangler supports the kv ...
syntax. If you are using versions below 3.60.0, the command follows the kv:...
syntax.
The kv:...
syntax is deprecated in versions 3.60.0 and beyond and will be removed in a future major version.
For example, commands using the kv ...
syntax look as such:
wrangler kv namespace listwrangler kv key get <KEY>wrangler kv bulk put <FILENAME>
The same commands using the kv:...
syntax look as such:
wrangler kv:namespace listwrangler kv:key get <KEY>wrangler kv:bulk put <FILENAME>
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark