Commands (3)·续2

Usage
wrangler kv:key put --binding=MY_KV "key" "value"
✨  Success
wrangler kv:key put --binding=MY_KV --preview "key" "value"
✨  Success
wrangler kv:key put --binding=MY_KV "key" "value" --ttl=10000
✨  Success
wrangler kv:key put --binding=MY_KV "key" value.txt --path
✨  Success

list

Output a list of all keys in a given namespace.

wrangler kv:key list --binding= [--namespace-id=] [--prefix] [--env]
  • --binding required (if no --namespace-id)
  • The name of the namespace to list.
  • --namespace-id required (if no --binding)
  • The ID of the namespace to list.
  • --env $ENVIRONMENT_NAME optional
  • If defined, the changes will only apply to the specified environment. Refer to Environments for more information.
  • --prefix optional
  • A prefix to filter listed keys.
Usage

This example passes the Wrangler command through the jq command:

wrangler kv:key list --binding=MY_KV --prefix="public" | jq "."
[
  {
    "name": "public_key"
  },
  {
    "name": "public_key_with_expiration",
    "expiration": "2019-09-10T23:18:58Z"
  }
]

get

Read a single value by key from the given namespace.

wrangler kv:key get --binding= [--env=] [--preview] [--namespace-id=] "$KEY"
  • $KEY required
  • The key value to get.
  • --binding required (if no --namespace-id)
  • The name of the namespace to get from.
  • --namespace-id required (if no --binding)
  • The ID of the namespace to get from.
  • --env $ENVIRONMENT_NAME optional
  • If defined, the operation will only apply to the specified environment. Refer to Environments for more information.
  • --preview optional
  • Interact with a preview namespace instead of production. Pass this to use your Wrangler file’s kv_namespaces.preview_id instead of kv_namespaces.id
Usage
wrangler kv:key get --binding=MY_KV "key"
value

delete

Removes a single key value pair from the given namespace.

wrangler kv:key delete --binding= [--env=] [--preview] [--namespace-id=] "$KEY"
  • $KEY required
  • The key value to delete.
  • --binding required (if no --namespace-id)
  • The name of the namespace to delete from.
  • --namespace-id required (if no --binding)
  • The id of the namespace to delete from.
  • --env optional
  • Perform on a specific environment specified as $ENVIRONMENT_NAME.
  • --preview optional
  • Interact with a preview namespace instead of production. Pass this to use your Wrangler configuration file's kv_namespaces.preview_id instead of kv_namespaces.id
Usage
wrangler kv:key delete --binding=MY_KV "key"
Are you sure you want to delete key "key"? [y/n]
yes
🌀  Deleting key "key"
✨  Success

kv:bulk

put

Write a file full of key-value pairs to the given namespace.

wrangler kv:bulk put --binding= [--env=] [--preview] [--namespace-id=] $FILENAME
  • $FILENAME required
  • The file to write to the namespace
  • --binding required (if no --namespace-id)
  • The name of the namespace to put to.
  • --namespace-id required (if no --binding)
  • The id of the namespace to put to.
  • --env $ENVIRONMENT_NAME optional
  • If defined, the changes will only apply to the specified environment. Refer to Environments for more information.
  • --preview optional
  • Interact with a preview namespace instead of production. Pass this to use your Wrangler file’s kv_namespaces.preview_id instead of kv_namespaces.id

This command takes a JSON file as an argument with a list of key-value pairs to upload. An example of JSON input:

[
    {
        "key": "test_key",
        "value": "test_value",
        "expiration_ttl": 3600
    }
]

In order to save JSON data, cast value to a string:

[
    {
        "key": "test_key",
        "value": "{\"name\": \"test_value\"}",
        "expiration_ttl": 3600
    }
]

The schema below is the full schema for key-value entries uploaded via the bulk API:

  • key string required
  • The key’s name. The name may be 512 bytes maximum. All printable, non-whitespace characters are valid.
  • value string required
  • The UTF-8 encoded string to be stored, up to 25 MB in length.
  • expiration int optional
  • The time, measured in number of seconds since the UNIX epoch, at which the key should expire.
  • expiration_ttl int optional
  • The number of seconds the document should exist before expiring. Must be at least 60 seconds.
  • base64 bool optional
  • When true, the server will decode the value as base64 before storing it. This is useful for writing values that would otherwise be invalid JSON strings, such as images. Defaults to false.

If both expiration and expiration_ttl are specified for a given key, the API will prefer expiration_ttl.

Usage
wrangler kv:bulk put --binding=MY_KV allthethingsupload.json
🌀  uploading 1 key value pairs
✨  Success

delete

Delete all specified keys within a given namespace.

wrangler kv:bulk delete --binding= [--env=] [--preview] [--namespace-id=] $FILENAME
  • $FILENAME required
  • The file with key-value pairs to delete.
  • --binding required (if no --namespace-id)
  • The name of the namespace to delete from.
  • --namespace-id required (if no --binding)
  • The ID of the namespace to delete from.
  • --env $ENVIRONMENT_NAME optional
  • If defined, the changes will only apply to the specified environment. Refer to Environments for more information.
  • --preview optional
  • Interact with a preview namespace instead of production. Pass this to use your Wrangler file’s kv_namespaces.preview_id instead of kv_namespaces.id

This command takes a JSON file as an argument with a list of key-value pairs to delete. An example of JSON input:

[
    {
        "key": "test_key",
        "value": ""
    }
]
  • key string required
  • The key’s name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid.
  • value string required
  • This field must be specified for deserialization purposes, but is unused because the provided keys are being deleted, not written.
Usage
wrangler kv:bulk delete --binding=MY_KV allthethingsdelete.json
Are you sure you want to delete all keys in allthethingsdelete.json? [y/n]
y
🌀  deleting 1 key value pairs
✨  Success

Environment variables

Wrangler supports any Wrangler configuration file keys passed in as environment variables. This works by passing in CF_ + any uppercased TOML key. For example:

CF_NAME=my-worker CF_ACCOUNT_ID=1234 wrangler dev


--help

wrangler --help
👷 ✨  wrangler 1.12.3
The Wrangler Team <wrangler@cloudflare.com>

USAGE:
    wrangler [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    kv:namespace    🗂️  Interact with your Workers KV Namespaces
    kv:key          🔑  Individually manage Workers KV key-value pairs
    kv:bulk         💪  Interact with multiple Workers KV key-value pairs at once
    route           ➡️  List or delete worker routes.
    secret          🤫  Generate a secret that can be referenced in the worker script
    generate        👯  Generate a new worker project
    init            📥  Create a wrangler.toml for an existing project
    build           🦀  Build your worker
    preview         🔬  Preview your code temporarily on cloudflareworkers.com
    dev             👂  Start a local server for developing your worker
    publish         🆙  Publish your worker to the orange cloud
    config          🕵️  Authenticate Wrangler with a Cloudflare API Token or Global API Key
    subdomain       👷  Configure your workers.dev subdomain
    whoami          🕵️  Retrieve your user info and test your auth config
    tail            🦚  Aggregate logs from production worker
    login           🔓  Authorize Wrangler with your Cloudflare username and password
    logout          ⚙️  Remove authorization from Wrangler.
    help            Prints this message or the help of the given subcommand(s)

Was this helpful?

YesNo

On this page

Commands (3)·续2 - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers/wrangler/commands/#page","headline":"Commands","description":"Reference for all Wrangler v1 CLI commands, including generate, publish, and preview. Now deprecated.","url":"https://developers.cloudflare.com/workers/wrangler/commands/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/wrangler/migration/v1-to-v2/wrangler-legacy/commands/og.png?v=68af3b0427de7635","dateModified":"2026-04-23","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Learn how to configure your Cloudflare Worker using Wrangler v1. This guide covers top-level and environment-specific settings, key types, and deployment options. title: Configuration image: https://developers.cloudflare.com/workers/wrangler/migration/v1-to-v2/wrangler-legacy/configuration/og.png?v=757cd9bbad5852dd


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers/llms.txt
Use this file to discover all available pages before exploring further.