Skip to content

Wrangler KV commands

Last updated View as MarkdownAgent setup

kv namespace

Manage Workers KV namespaces.

kv namespace create

Create a new namespace

npx wrangler kv namespace create [NAMESPACE]
  • [NAMESPACE]string required

    The name of the new namespace

  • --previewboolean

    Interact with a preview namespace

  • --use-remoteboolean

    Use a remote binding when adding the newly created resource to your config

  • --update-configboolean

    Automatically update your config file with the newly added resource

  • --bindingstring

    The binding name of this resource in your Worker

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path 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-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

kv namespace list

Output a list of all KV namespaces associated with your account id

npx wrangler kv namespace list

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv namespace delete

    Delete a given namespace.

    npx wrangler kv namespace delete [NAMESPACE]
    • [NAMESPACE]string

      The name of the namespace to delete

    • --bindingstring

      The binding name to the namespace to delete from

    • --namespace-idstring

      The id of the namespace to delete

    • --previewboolean

      Interact with a preview namespace

    • --skip-confirmationboolean alias: --ydefault: false

      Skip confirmation

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv namespace rename

    Rename a KV namespace

    npx wrangler kv namespace rename [OLD-NAME]
    • [OLD-NAME]string

      The current name of the namespace to rename

    • --namespace-idstring

      The id of the namespace to rename

    • --new-namestring required

      The new name for the namespace

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv key

    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]
    • [KEY]string required

      The key to write to

    • [VALUE]string

      The value to write

    • --pathstring

      Read value from the file at a given path

    • --bindingstring

      The binding name to the namespace to write to

    • --namespace-idstring

      The id of the namespace to write to

    • --previewboolean

      Interact with a preview namespace

    • --ttlnumber

      Time for which the entries should be visible

    • --expirationnumber

      Time since the UNIX epoch after which the entry expires

    • --metadatastring

      Arbitrary JSON that is associated with a key

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv key list

    Output a list of all keys in a given namespace

    npx wrangler kv key list
    • --bindingstring

      The binding name to the namespace to list

    • --namespace-idstring

      The id of the namespace to list

    • --previewboolean default: false

      Interact with a preview namespace

    • --prefixstring

      A prefix to filter listed keys

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv key get

    Read a single value by key from the given namespace

    npx wrangler kv key get [KEY]
    • [KEY]string required

      The key value to get.

    • --textboolean default: false

      Decode the returned value as a utf8 string

    • --bindingstring

      The binding name to the namespace to get from

    • --namespace-idstring

      The id of the namespace to get from

    • --previewboolean default: false

      Interact with a preview namespace

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv key delete

    Remove a single key value pair from the given namespace

    npx wrangler kv key delete [KEY]
    • [KEY]string required

      The key value to delete.

    • --bindingstring

      The binding name to the namespace to delete from

    • --namespace-idstring

      The id of the namespace to delete from

    • --previewboolean

      Interact with a preview namespace

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv bulk

    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]
    • [FILENAME]string required

      The file containing the keys to get

    • --bindingstring

      The binding name to the namespace to get from

    • --namespace-idstring

      The id of the namespace to get from

    • --previewboolean default: false

      Interact with a preview namespace

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv bulk put

    Upload multiple key-value pairs to a namespace

    npx wrangler kv bulk put [FILENAME]
    • [FILENAME]string required

      The file containing the key/value pairs to write

    • --bindingstring

      The binding name to the namespace to write to

    • --namespace-idstring

      The id of the namespace to write to

    • --previewboolean

      Interact with a preview namespace

    • --ttlnumber

      Time for which the entries should be visible

    • --expirationnumber

      Time since the UNIX epoch after which the entry expires

    • --metadatastring

      Arbitrary JSON that is associated with a key

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    kv bulk delete

    Delete multiple key-value pairs from a namespace

    npx wrangler kv bulk delete [FILENAME]
    • [FILENAME]string required

      The file containing the keys to delete

    • --forceboolean alias: --f

      Do not ask for confirmation before deleting

    • --bindingstring

      The binding name to the namespace to delete from

    • --namespace-idstring

      The id of the namespace to delete from

    • --previewboolean

      Interact with a preview namespace

    • --localboolean

      Interact with local storage

    • --remoteboolean

      Interact with remote storage

    • --persist-tostring

      Directory for local persistence

    Global flags

    • --vboolean alias: --version

      Show version number

    • --cwdstring

      Run as if Wrangler was started in the specified directory instead of the current working directory

    • --configstring alias: --c

      Path to Wrangler configuration file

    • --envstring alias: --e

      Environment to use for operations, and for selecting .env and .dev.vars files

    • --env-filestring

      Path 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-provisiondefault: true

      Experimental: Enable automatic resource provisioning

    • --experimental-auto-createboolean alias: --x-auto-createdefault: true

      Automatically provision draft bindings with new resources

    • --install-skillsboolean default: false

      Install Cloudflare skills for detected AI coding agents before running the command

    • --profilestring

      Use a specific auth profile

    Deprecations

    Below are deprecations to Wrangler commands for Workers KV.

    kv:... syntax deprecation

    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>

    Was this helpful?