Manage Workers KV namespaces.
kv namespaces create
Creates a Workers KV namespace in the specified account with the given title. Returns 400 if the account already owns a namespace with that title; an existing namespace must be explicitly deleted before it can be replaced. An optional jurisdiction restricts where data is durably stored and can only be set at creation time.
cf kv namespaces create [options]--jurisdiction"eu" | "fedramp" | "us"Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.
--namespace-mode"instant"The mode of the Workers KV namespace. Specify
instantwhen creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently,instantis the only supported explicit value.--titlestringrequiredHuman-readable string name for a Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--bodystringRaw JSON request body (bypasses individual flags)
To restrict where a namespace durably stores data, specify --jurisdiction when creating it. Refer to Data location for supported jurisdictions.
To create a Workers KV Instant namespace with cf, pass --namespace-mode instant. This example creates a namespace named APP_CONFIG for small, infrequently updated configuration:
cf kv namespaces create --title APP_CONFIG --namespace-mode instantkv namespaces list
Lists Workers KV namespaces owned by the specified account. Use page and per_page to select a page of results, and order and direction to control sorting.
cf kv namespaces list [options]--pagenumberPage number of paginated results.
--per-pagenumberMaximum number of results per page.
--order"id" | "title"Namespace field to sort by (
idortitle).--direction"asc" | "desc"Sort namespaces in ascending (
asc) or descending (desc) order.--dry-runbooleandefault: falseValidate and show what would happen without executing
kv namespaces get
Returns the Workers KV namespace for the specified account and namespace ID.
cf kv namespaces get <namespace-id><NAMESPACE-ID>stringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
kv namespaces update
Changes the title of the specified Workers KV namespace and returns the updated namespace. The namespace ID and stored key-value pairs are unchanged.
cf kv namespaces update <namespace-id> [options]<NAMESPACE-ID>stringrequiredID of the Workers KV namespace.
--titlestringrequiredHuman-readable string name for a Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--bodystringRaw JSON request body (bypasses individual flags)
kv namespaces delete
Deletes the specified Workers KV namespace and its stored key-value pairs from the account.
cf kv namespaces delete <namespace-id><NAMESPACE-ID>stringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--forcebooleandefault: falseSkip confirmation (useful in scripts and CI)
Manage single and bulk key-value pairs within a Workers KV namespace. Pass --local to target local development state, or pass @<FILE_PATH> to --body to read a JSON file for bulk operations.
kv keys put
Writes a value under the specified key in the Workers KV namespace, creating the key-value pair or replacing its existing value, expiration, and metadata. Send the value as an application/octet-stream request body, or use multipart/form-data with a value part and an optional JSON metadata part. Use URL-encoding for special characters (for example, :, !, %) in the key name when constructing the request URL. If neither expiration nor expiration_ttl is specified, the key-value pair will not expire. If both are set, expiration_ttl takes precedence.
cf kv keys put <key-name> [options]<KEY-NAME>stringrequiredA key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.
--namespace-idstringrequiredID of the Workers KV namespace.
--expirationnumberExpires the key at a certain time, measured in number of seconds since the UNIX epoch.
--expiration-ttlnumberNumber of seconds until the key expires. Must be at least 60. Takes precedence over
expirationwhen both are specified.--dry-runbooleandefault: falseValidate and show what would happen without executing
--bodystringRaw JSON request body (bypasses individual flags)
--filestringPath to a file to upload as the request body
--metadatastringAssociates arbitrary JSON data with a key/value pair.
kv keys list
Lists key names in the specified Workers KV namespace, with expiration times and metadata when present. Use prefix to filter names and cursor to request the next page. Values are not included.
cf kv keys list [options]--namespace-idstringrequiredID of the Workers KV namespace.
--limitnumberMaximum number of keys to return in one response. Pass
result_info.cursorfrom the response ascursorto request the next page.--prefixstringFilters returned keys by a name prefix. Exact matches and any key names that begin with the prefix will be returned.
--cursorstringOpaque pagination token from
result_info.cursorin the previous response. Pass it unchanged to request the next page of keys.--dry-runbooleandefault: falseValidate and show what would happen without executing
kv keys get
Returns the value stored under the specified key in the Workers KV namespace as raw bytes. Use URL-encoding for special characters (for example, :, !, %) in the key name when constructing the request URL. If the key-value pair expires, the expiration response header contains its expiration time in seconds since the UNIX epoch.
cf kv keys get <key-name> [options]<KEY-NAME>stringrequiredA key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.
--namespace-idstringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--textbooleandefault: falseDecode the response body as UTF-8 text instead of writing raw bytes
kv keys delete
Deletes the specified key and its value from the Workers KV namespace. Use URL-encoding for special characters (for example, :, !, %) in the key name when constructing the request URL.
cf kv keys delete <key-name> [options]<KEY-NAME>stringrequiredA key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.
--namespace-idstringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--forcebooleandefault: falseSkip confirmation (useful in scripts and CI)
kv keys bulk-get
Retrieves the text-based values of up to 100 keys from the specified Workers KV namespace. The result maps each requested key to its value. Set type to json to parse JSON values instead of returning strings, and set withMetadata to true to include metadata with each value. Binary values are not supported by this operation.
cf kv keys bulk-get [options]--namespace-idstringrequiredID of the Workers KV namespace.
--keysstringrequiredArray of keys to retrieve (maximum of 100).
--type"text" | "json"default: textReturn values as strings with
text, or parse stored JSON values withjson.--with-metadatabooleandefault: falseWhether to include metadata in the response.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--bodystringRaw JSON request body (bypasses individual flags)
kv keys bulk-put
Writes up to 10,000 key-value pairs to the specified Workers KV namespace from a JSON array, with optional metadata and expiration settings for each pair. Existing values and expirations are overwritten. If neither expiration nor expiration_ttl is specified, the key-value pair will not expire. If both are set, expiration_ttl takes precedence. The entire request must be 100 megabytes or less. The result reports the number of successful writes and any keys that failed and should be retried.
cf kv keys bulk-put [options]--namespace-idstringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--bodystringRaw JSON request body (bypasses individual flags)
kv keys bulk-delete
Deletes up to 10,000 key-value pairs from the specified Workers KV namespace. Send a JSON array of the key names to delete. The result reports the number of successful deletions and any keys that failed and should be retried.
cf kv keys bulk-delete [options]--namespace-idstringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
--forcebooleandefault: falseSkip confirmation (useful in scripts and CI)
--bodystringRaw JSON request body (bypasses individual flags)
Read key metadata without fetching the key's value.
kv metadata get
Returns the JSON metadata associated with the specified key in the Workers KV namespace, without retrieving its value. Use URL-encoding for special characters (for example, :, !, %) in the key name when constructing the request URL.
cf kv metadata get <key-name> [options]<KEY-NAME>stringrequiredA key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.
--namespace-idstringrequiredID of the Workers KV namespace.
--dry-runbooleandefault: falseValidate and show what would happen without executing
Manage Workers KV namespaces.
kv namespace create
Create a new namespace
npx wrangler kv namespace create <NAMESPACE>yarn wrangler kv namespace create <NAMESPACE>pnpm wrangler kv namespace create <NAMESPACE><NAMESPACE>stringrequiredThe name of the new namespace
--previewbooleanInteract with a preview namespace
--jurisdictionstringThe jurisdiction where the new namespace will be created (e.g. "us", "eu", "fedramp")
--experimental-modestringalias: --x-modeThe storage mode for the new namespace. Instant mode offers lower-latency reads and faster global updates [private beta]. Cannot be combined with --jurisdiction.
--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
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
To restrict where a namespace durably stores data, specify --jurisdiction when creating it. Refer to Data location for supported jurisdictions.
To create a Workers KV Instant namespace, pass --experimental-mode instant. This example creates a namespace named APP_CONFIG for small, infrequently updated configuration:
npx wrangler@latest kv namespace create APP_CONFIG --experimental-mode instantyarn wrangler@latest kv namespace create APP_CONFIG --experimental-mode instantpnpm wrangler@latest kv namespace create APP_CONFIG --experimental-mode instantYou can also use the --x-mode instant alias.
kv namespace list
Output a list of all KV namespaces associated with your account id
npx wrangler kv namespace listyarn wrangler kv namespace listpnpm wrangler kv namespace listGlobal flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv namespace delete
Delete a given namespace.
npx wrangler kv namespace delete [NAMESPACE]yarn wrangler kv namespace delete [NAMESPACE]pnpm wrangler kv namespace delete [NAMESPACE][NAMESPACE]stringThe name of the namespace to delete
--bindingstringThe binding name to the namespace to delete from
--namespace-idstringThe id of the namespace to delete
--previewbooleanInteract with a preview namespace
--skip-confirmationbooleanalias: --ydefault: falseSkip confirmation
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv namespace rename
Rename a KV namespace
npx wrangler kv namespace rename [OLD-NAME] --new-name <NEW-NAME>yarn wrangler kv namespace rename [OLD-NAME] --new-name <NEW-NAME>pnpm wrangler kv namespace rename [OLD-NAME] --new-name <NEW-NAME>[OLD-NAME]stringThe current name of the namespace to rename
--namespace-idstringThe id of the namespace to rename
--new-namestringrequiredThe new name for the namespace
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
Manage key-value pairs within a Workers KV namespace.
kv key put
Write a single key/value pair to the given namespace
npx wrangler kv key put <KEY> [VALUE]yarn wrangler kv key put <KEY> [VALUE]pnpm wrangler kv key put <KEY> [VALUE]<KEY>stringrequiredThe 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
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv key list
Output a list of all keys in a given namespace
npx wrangler kv key listyarn wrangler kv key listpnpm wrangler kv key list--bindingstringThe binding name to the namespace to list
--namespace-idstringThe id of the namespace to list
--previewbooleandefault: 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
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv key get
Read a single value by key from the given namespace
npx wrangler kv key get <KEY>yarn wrangler kv key get <KEY>pnpm wrangler kv key get <KEY><KEY>stringrequiredThe key value to get.
--textbooleandefault: 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
--previewbooleandefault: falseInteract with a preview namespace
--localbooleanInteract with local storage
--remotebooleanInteract with remote storage
--persist-tostringDirectory for local persistence
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv key delete
Remove a single key value pair from the given namespace
npx wrangler kv key delete <KEY>yarn wrangler kv key delete <KEY>pnpm wrangler kv key delete <KEY><KEY>stringrequiredThe 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
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
Manage multiple key-value pairs within a Workers KV namespace in batches.
kv bulk get
Gets multiple key-value pairs from a namespace
npx wrangler kv bulk get <FILENAME>yarn wrangler kv bulk get <FILENAME>pnpm wrangler kv bulk get <FILENAME><FILENAME>stringrequiredThe file containing the keys to get
--bindingstringThe binding name to the namespace to get from
--namespace-idstringThe id of the namespace to get from
--previewbooleandefault: falseInteract with a preview namespace
--localbooleanInteract with local storage
--remotebooleanInteract with remote storage
--persist-tostringDirectory for local persistence
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv bulk put
Upload multiple key-value pairs to a namespace
npx wrangler kv bulk put <FILENAME>yarn wrangler kv bulk put <FILENAME>pnpm wrangler kv bulk put <FILENAME><FILENAME>stringrequiredThe 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
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
kv bulk delete
Delete multiple key-value pairs from a namespace
npx wrangler kv bulk delete <FILENAME>yarn wrangler kv bulk delete <FILENAME>pnpm wrangler kv bulk delete <FILENAME><FILENAME>stringrequiredThe file containing the keys to delete
--forcebooleanalias: --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
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --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
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
The following deprecations apply 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 list
wrangler kv key get <KEY>
wrangler kv bulk put <FILENAME>The same commands using the kv:... syntax look as such:
wrangler kv:namespace list
wrangler kv:key get <KEY>
wrangler kv:bulk put <FILENAME>