KV
Manage Workers KV using Wrangler.
Manage Workers KV namespaces.
Create a new namespace
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
-
--previewbooleanInteract with a preview namespace
-
--use-remotebooleanUse a remote binding when adding the newly created resource to your config
-
--update-configbooleanAutomatically update your config file with the newly added resource
-
--bindingstringThe binding name of this resource in your Worker
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Output a list of all KV namespaces associated with your account id
npx wrangler kv namespace listpnpm wrangler kv namespace listyarn wrangler kv namespace listGlobal flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Delete a given namespace.
npx wrangler kv namespace deletepnpm wrangler kv namespace deleteyarn wrangler kv namespace delete-
--bindingstringThe binding name to the namespace to delete from
-
--namespace-idstringThe id of the namespace to delete
-
--previewbooleanInteract with a preview namespace
-
--skip-confirmationboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Rename a KV 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-idstringThe id of the namespace to rename
-
--new-namestring requiredThe new name for the namespace
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Manage key-value pairs within a Workers KV namespace.
Write a single key/value pair to the given 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
-
--pathstringRead value from the file at a given path
-
--bindingstringThe binding name to the namespace to write to
-
--namespace-idstringThe id of the namespace to write to
-
--previewbooleanInteract with a preview namespace
-
--ttlnumberTime for which the entries should be visible
-
--expirationnumberTime since the UNIX epoch after which the entry expires
-
--metadatastringArbitrary JSON that is associated with a key
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Output a list of all keys in a given namespace
npx wrangler kv key listpnpm wrangler kv key listyarn wrangler kv key list-
--bindingstringThe binding name to the namespace to list
-
--namespace-idstringThe id of the namespace to list
-
--previewboolean default: falseInteract with a preview namespace
-
--prefixstringA prefix to filter listed keys
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Read a single value by key from the given namespace
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.
-
--textboolean default: falseDecode the returned value as a utf8 string
-
--bindingstringThe binding name to the namespace to get from
-
--namespace-idstringThe id of the namespace to get from
-
--previewboolean default: falseInteract with a preview namespace
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Remove a single key value pair from the given namespace
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.
-
--bindingstringThe binding name to the namespace to delete from
-
--namespace-idstringThe id of the namespace to delete from
-
--previewbooleanInteract with a preview namespace
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Manage multiple key-value pairs within a Workers KV namespace in batches.
Gets multiple key-value pairs from a namespace
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
-
--bindingstringThe binding name to the namespace to get from
-
--namespace-idstringThe id of the namespace to get from
-
--previewboolean default: falseInteract with a preview namespace
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Upload multiple key-value pairs to a namespace
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
-
--bindingstringThe binding name to the namespace to write to
-
--namespace-idstringThe id of the namespace to write to
-
--previewbooleanInteract with a preview namespace
-
--ttlnumberTime for which the entries should be visible
-
--expirationnumberTime since the UNIX epoch after which the entry expires
-
--metadatastringArbitrary JSON that is associated with a key
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Delete multiple key-value pairs from a namespace
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
-
--forceboolean alias: --fDo not ask for confirmation before deleting
-
--bindingstringThe binding name to the namespace to delete from
-
--namespace-idstringThe id of the namespace to delete from
-
--previewbooleanInteract with a preview namespace
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources