Commands
Wrangler offers a number of commands to manage your Cloudflare Workers.
docs- Open this page in your default browser.init- Create a new project from a variety of web frameworks and templates. (Deprecated — usenpm create cloudflare@latestinstead)d1- Interact with D1.vectorize- Interact with Vectorize indexes.hyperdrive- Manage your Hyperdrives.deploy- Deploy your Worker to Cloudflare.dev- Start a local server for developing your Worker.publish- Publish your Worker to Cloudflare.delete- Delete your Worker from Cloudflare.kv namespace- Manage Workers KV namespaces.kv key- Manage key-value pairs within a Workers KV namespace.kv bulk- Manage multiple key-value pairs within a Workers KV namespace in batches.r2 bucket- Manage Workers R2 buckets.r2 object- Manage Workers R2 objects.secret- Manage the secret variables for a Worker.secret:bulk- Manage multiple secret variables for a Worker.tail- Start a session to livestream logs from a deployed Worker.pages- Configure Cloudflare Pages.queues- Configure Workers Queues.login- Authorize Wrangler with your Cloudflare account using OAuth.logout- Remove Wrangler’s authorization for accessing your account.whoami- Retrieve your user information and test your authentication configuration.versions- Retrieve details for recent versions.deployments- Retrieve details for recent deployments.rollback- Rollback to a recent deployment.dispatch-namespace- Interact with a dispatch namespace.mtls-certificate- Manage certificates used for mTLS connections.types- Generate types from bindings and module rules in configuration.
This page provides a reference for Wrangler commands.
wrangler <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]Since Cloudflare recommends installing Wrangler locally in your project(rather than globally), the way to run Wrangler will depend on your specific setup and package manager.
npx wrangler <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]yarn wrangler <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]pnpm wrangler <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]You can add Wrangler commands that you use often as scripts in your project’s package.json file:
{ ... "scripts": { "deploy": "wrangler deploy", "dev": "wrangler dev" } ...}You can then run them using your package manager of choice:
npm run deployyarn run deploypnpm run deploy📚 Open Wrangler's command documentation in your browser
wrangler docs [search..]Positionals
- search [array] [default: []]
Enter search terms (e.g. the wrangler command) you want to know more about
Options
- -y, --yes [boolean]
Takes you to the docs, even if search fails
📥 Initialize a basic Worker
wrangler init [name]Positionals
- name [string]
The name of your worker
Options
- -y, --yes [boolean]
Answer "yes" to any prompts for new projects
- --from-dash [string]
The name of the Worker you wish to download from the Cloudflare dashboard for local development.
Interact with Cloudflare’s D1 service.
Create D1 database
wrangler d1 create <name>Positionals
- name [string] [required]
The name of the new DB
Options
- --location [string]
A hint for the primary location of the new DB. Options:
weur: Western Europe
eeur: Eastern Europe
apac: Asia Pacific
oc: Oceania
wnam: Western North America
enam: Eastern North America
Get information about a D1 database, including the current database size and state
wrangler d1 info <name>Positionals
- name [string] [required]
The name of the DB
Options
- --json [boolean] [default: false]
return output as clean JSON
List D1 databases
wrangler d1 listOptions
- --json [boolean] [default: false]
return output as clean JSON
Delete D1 database
wrangler d1 delete <name>Positionals
- name [string] [required]
The name or binding of the DB
Options
- -y, --skip-confirmation [boolean] [default: false]
Skip confirmation
Execute a command or SQL file
wrangler d1 execute <database>Positionals
- database [string] [required]
The name or binding of the DB
Options
- -y, --yes [boolean]
Answer "yes" to any prompts
- --local [boolean]
Execute commands/files against a local DB for use with wrangler dev
- --remote [boolean]
Execute commands/files against a remote DB for use with wrangler dev
- --file [string]
A .sql file to ingest
- --command [string]
A single SQL statement to execute
- --persist-to [string]
Specify directory to use for local persistence (for --local)
- --json [boolean] [default: false]
Return output as clean JSON
- --preview [boolean] [default: false]
Execute commands/files against a preview D1 DB
Export the contents or schema of your database as a .sql file
wrangler d1 export <name>Positionals
- name [string] [required]
The name or binding of the DB
Options
- --local [boolean]
Export from your local DB you use with wrangler dev
- --remote [boolean]
Export from your live D1
- --no-schema [boolean]
Only output table contents, not the DB schema
- --no-data [boolean]
Only output table schema, not the contents of the DBs themselves
- --table [string]
Specify which tables to include in export
- --output [string] [required]
Which .sql file to output to
Restore a database back to a specific point-in-time
wrangler d1 time-travel restore <database>Positionals
- database [string] [required]
The name or binding of the DB
Options
- --bookmark [string]
Bookmark to use for time travel
- --timestamp [string]
accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for
- --json [boolean] [default: false]
return output as clean JSON
Retrieve information about a database at a specific point-in-time using Time Travel
wrangler d1 time-travel info <database>Positionals
- database [string] [required]
The name or binding of the DB
Options
- --timestamp [string]
accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for
- --json [boolean] [default: false]
return output as clean JSON
Create a new D1 backup
wrangler d1 backup create <name>Positionals
- name [string] [required]
The name or binding of the DB
List your D1 backups
wrangler d1 backup list <name>Positionals
- name [string] [required]
The name or binding of the DB
Restore a DB backup
wrangler d1 backup restore <name> <backup-id>Positionals
- name [string] [required]
The name or binding of the DB
- backup-id [string] [required]
The Backup ID to restore
Download a DB backup
wrangler d1 backup download <name> <backup-id>Positionals
- name [string] [required]
The name or binding of the DB
- backup-id [string] [required]
The Backup ID to download
Options
- --output [string]
The .sqlite3 file to write to (defaults to '
. .sqlite3'
Create a new migration
wrangler d1 migrations create <database> <message>Positionals
- database [string] [required]
The name or binding of the DB
- message [string] [required]
The Migration message
List your D1 migrations
wrangler d1 migrations list <database>Positionals
- database [string] [required]
The name or binding of the DB
Options
- --local [boolean]
Execute commands/files against a local DB for use with wrangler dev
- --remote [boolean]
Execute commands/files against a remote DB for use with wrangler dev --remote
- --preview [boolean] [default: false]
Execute commands/files against a preview D1 DB
- --persist-to [string]
Specify directory to use for local persistence (you must use --local with this flag)
Apply D1 migrations
wrangler d1 migrations apply <database>Positionals
- database [string] [required]
The name or binding of the DB
Options
- --local [boolean]
Execute commands/files against a local DB for use with wrangler dev
- --remote [boolean]
Execute commands/files against a remote DB for use with wrangler dev --remote
- --preview [boolean] [default: false]
Execute commands/files against a preview D1 DB
- --persist-to [string]
Specify directory to use for local persistence (you must use --local with this flag)
- --batch-size [deprecated] [number]
Number of queries to send in a single batch
Manage Hyperdrive database configurations.
Create a new Hyperdrive configuration.
wrangler hyperdrive create <CONFIG_NAME> [OPTIONS]CONFIG_NAMEstring required- The name of the Hyperdrive configuration to create.
--connection-stringstring optional- The database connection string in the form
postgres://user:password@hostname:port/database.
- The database connection string in the form
--hoststring optional- The hostname or IP address Hyperdrive should connect to.
--portnumber optional- The database port to connect to.
--schemestring optional- The scheme used to connect to the origin database, for example, postgresql or postgres.
--databasestring optional- The database (name) to connect to. For example, Postgres or defaultdb.
--userstring optional- The username used to authenticate to the database.
--passwordstring optional- The password used to authenticate to the database.
--access-client-idstring optional- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with
port.
- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with
--access-client-secretstring optional- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with
port.
- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with
--caching-disabledboolean optional- Disables the caching of SQL responses.
--max-agenumber optional- Specifies max duration for which items should persist in the cache, cannot be set when caching is disabled.
--swrnumber optional- Stale While Revalidate - Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled.
Update an existing Hyperdrive configuration.
wrangler hyperdrive update <ID> [OPTIONS]IDstring required- The ID of the Hyperdrive configuration to update.
--namestring optional- The new name of the Hyperdrive configuration.
--origin-hoststring optional- The new database hostname or IP address Hyperdrive should connect to.
--origin-portstring optional- The new database port to connect to.
--databasestring optional- The new database (name) to connect to. For example, Postgres or defaultdb.
--origin-userstring optional- The new username used to authenticate to the database.
--origin-passwordstring optional- The new password used to authenticate to the database.
--access-client-idstring optional- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with
origin-port.
- The Client ID of the Access token to use when connecting to the origin database, must be set with a Client Access Secret. Mutually exclusive with
--access-client-secretstring optional- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with
origin-port.
- The Client Secret of the Access token to use when connecting to the origin database, must be set with a Client Access ID. Mutually exclusive with
--caching-disabledboolean optional- Disables the caching of SQL responses.
--max-agenumber optional- Specifies max duration for which items should persist in the cache, cannot be set when caching is disabled.
--swrnumber optional- Stale While Revalidate - Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled.
List all Hyperdrive configurations.
wrangler hyperdrive listDelete an existing Hyperdrive configuration.
wrangler hyperdrive delete <ID>IDstring required- The name of the Hyperdrive configuration to delete.
Get an existing Hyperdrive configuration.
wrangler hyperdrive get <ID>IDstring required- The name of the Hyperdrive configuration to get.
Interact with a Vectorize vector database.
Create a Vectorize index
wrangler vectorize create <name>Positionals
- name [string] [required]
The name of the Vectorize index to create (must be unique).
Options
- --dimensions [number]
The dimension size to configure this index for, based on the output dimensions of your ML model.
- --metric [string] [choices: "euclidean", "cosine", "dot-product"]
The distance metric to use for searching within the index.
- --preset [string] [choices: "@cf/baai/bge-small-en-v1.5", "@cf/baai/bge-base-en-v1.5", "@cf/baai/bge-large-en-v1.5", "openai/text-embedding-ada-002", "cohere/embed-multilingual-v2.0"]
The name of an preset representing an embeddings model: Vectorize will configure the dimensions and distance metric for you when provided.
- --description [string]
An optional description for this index.
- --json [boolean] [default: false]
return output as clean JSON
- --deprecated-v1 [boolean] [default: false]
Create a deprecated Vectorize V1 index. This is not recommended and indexes created with this option need all other Vectorize operations to have this option enabled.
List your Vectorize indexes
wrangler vectorize listOptions
- --json [boolean] [default: false]
return output as clean JSON
- --deprecated-v1 [boolean] [default: false]
List deprecated Vectorize V1 indexes for your account.
Get a Vectorize index by name
wrangler vectorize get <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --json [boolean] [default: false]
return output as clean JSON
- --deprecated-v1 [boolean] [default: false]
Fetch a deprecated V1 Vectorize index. This must be enabled if the index was created with V1 option.
Get additional details about the index
wrangler vectorize info <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --json [boolean] [default: false]
return output as clean JSON
Delete a Vectorize index
wrangler vectorize delete <name>Positionals
- name [string] [required]
The name of the Vectorize index
Options
- -y, --force [boolean] [default: false]
Skip confirmation
- --deprecated-v1 [boolean] [default: false]
Delete a deprecated Vectorize V1 index.
Insert vectors into a Vectorize index
wrangler vectorize insert <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --file [string] [required]
A file containing line separated json (ndjson) vector objects.
- --batch-size [number] [default: 1000]
Number of vector records to include when sending to the Cloudflare API.
- --json [boolean] [default: false]
return output as clean JSON
- --deprecated-v1 [boolean] [default: false]
Insert into a deprecated V1 Vectorize index. This must be enabled if the index was created with the V1 option.
Upsert vectors into a Vectorize index
wrangler vectorize upsert <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --file [string] [required]
A file containing line separated json (ndjson) vector objects.
- --batch-size [number] [default: 5000]
Number of vector records to include in a single upsert batch when sending to the Cloudflare API.
- --json [boolean] [default: false]
return output as clean JSON
Query a Vectorize index
wrangler vectorize query <name>Positionals
- name [string] [required]
The name of the Vectorize index
Options
- --vector [array] [required]
Vector to query the Vectorize Index
- --top-k [number] [default: 5]
The number of results (nearest neighbors) to return
- --return-values [boolean] [default: false]
Specify if the vector values should be included in the results
- --return-metadata [string] [choices: "all", "indexed", "none"] [default: "none"]
Specify if the vector metadata should be included in the results
- --namespace [string]
Filter the query results based on this namespace
- --filter [string]
Filter the query results based on this metadata filter.
Get vectors from a Vectorize index
wrangler vectorize get-vectors <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --ids [array] [required]
Vector identifiers to be fetched from the Vectorize Index. Example:
--ids a 'b' 1 '2'
Delete vectors in a Vectorize index
wrangler vectorize delete-vectors <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --ids [array] [required]
Vector identifiers to be deleted from the Vectorize Index.
Example:--ids a 'b' 1 '2'
Enable metadata filtering on the specified property
wrangler vectorize create-metadata-index <name>Positionals
- name [string] [required]
The name of the Vectorize index.
- property-name [string]
The name of the metadata property to index.
- type [string] [choices: "string", "number", "boolean"]
The type of metadata property to index. Valid types are 'string', 'number' and 'boolean'.
List metadata properties on which metadata filtering is enabled
wrangler vectorize list-metadata-index <name>Positionals
- name [string] [required]
The name of the Vectorize index.
Options
- --json [boolean] [default: false]
return output as clean JSON
Delete metadata indexes
wrangler vectorize delete-metadata-index <name>Positionals
- name [string] [required]
The name of the Vectorize index.
- property-name [string]
The name of the metadata property to index.
đź‘‚ Start a local server for developing your Worker
wrangler dev [script]Positionals
- script [string]
The path to an entry point for your worker
Options
- --name [string]
Name of the worker
- --compatibility-date [string]
Date to use for compatibility checks
- --compatibility-flags, --compatibility-flag [array]
Flags to use for compatibility checks
- --latest [boolean] [default: true]
Use the latest version of the worker runtime
- --assets [string]
Static assets to be served. Replaces Workers Sites.
- --no-bundle [boolean] [default: false]
Skip internal build steps and directly deploy script
- --ip [string]
IP address to listen on
- --port [number]
Port to listen on
- --inspector-port [number]
Port for devtools to connect to
- --routes, --route [array]
Routes to upload
- --host [string]
Host to forward requests to, defaults to the zone of project
- --local-protocol [choices: "http", "https"]
Protocol to listen to requests on, defaults to http.
- --https-key-path [string]
Path to a custom certificate key
- --https-cert-path [string]
Path to a custom certificate
- --local-upstream [string]
Host to act as origin in local mode, defaults to dev.host or route
- --upstream-protocol [choices: "http", "https"]
Protocol to forward requests to host on, defaults to https.
- --var [array]
A key-value pair to be injected into the script as a variable
- --define [array]
A key-value pair to be substituted in the script
- --alias [array]
A module pair to be substituted in the script
- --jsx-factory [string]
The function that is called for each JSX element
- --jsx-fragment [string]
The function that is called for each JSX fragment
- --tsconfig [string]
Path to a custom tsconfig.json file
- -r, --remote [boolean] [default: false]
Run on the global Cloudflare network with access to production resources
- --minify [boolean]
Minify the script
- --node-compat [boolean]
Enable Node.js compatibility
- --persist-to [string]
Specify directory to use for local persistence (defaults to .wrangler/state)
- --live-reload [boolean]
Auto reload HTML pages when change is detected in local mode
- --test-scheduled [boolean] [default: false]
Test scheduled events by visiting /__scheduled in browser
- --log-level [choices: "debug", "info", "log", "warn", "error", "none"] [default: "log"]
Specify logging level
- --show-interactive-dev-session [boolean]
Show interactive dev session
(defaults to true if the terminal supports interactivity) - --experimental-dev-env, --x-dev-env [boolean] [default: true]
Use the experimental DevEnv instantiation (unified across wrangler dev and unstable_dev)
- --experimental-registry, --x-registry [boolean] [default: false]
Use the experimental file based dev registry for multi-worker development
wrangler dev is a way to locally test your Worker while developing. With wrangler dev running, send HTTP requests to localhost:8787 and your Worker should execute as expected. You will also see console.log messages and exceptions appearing in your terminal.
🆙 Deploy a Worker to Cloudflare
wrangler deploy [script]Positionals
- script [string]
The path to an entry point for your worker
Options
- --name [string]
Name of the worker
- --no-bundle [boolean] [default: false]
Skip internal build steps and directly deploy Worker
- --outdir [string]
Output directory for the bundled worker
- --compatibility-date [string]
Date to use for compatibility checks
- --compatibility-flags, --compatibility-flag [array]
Flags to use for compatibility checks
- --latest [boolean] [default: false]
Use the latest version of the worker runtime
- --assets [string]
Static assets to be served. Replaces Workers Sites.
- --var [array]
A key-value pair to be injected into the script as a variable
- --define [array]
A key-value pair to be substituted in the script
- --alias [array]
A module pair to be substituted in the script
- --triggers, --schedule, --schedules [array]
cron schedules to attach
- --routes, --route [array]
Routes to upload
- --jsx-factory [string]
The function that is called for each JSX element
- --jsx-fragment [string]
The function that is called for each JSX fragment
- --tsconfig [string]
Path to a custom tsconfig.json file
- --minify [boolean]
Minify the Worker
- --node-compat [boolean]
Enable Node.js compatibility
- --dry-run [boolean]
Don't actually deploy
- --upload-source-maps [boolean]
Include source maps when uploading this worker.
- --old-asset-ttl [number]
Expire old assets in given seconds rather than immediate deletion.
- --keep-vars [boolean] [default: false]
Stop wrangler from deleting vars that are not present in the wrangler.toml
By default Wrangler will remove all vars and replace them with those found in the wrangler.toml configuration.
If your development approach is to modify vars after deployment via the dashboard you may wish to set this flag.--logpush
Send Trace Events from this worker to Workers Logpush.
This will not configure a corresponding Logpush job automatically.
[boolean]
--dispatch-namespace
Name of a dispatch namespace to deploy the Worker to (Workers for Platforms)
[string]
đź—‘ Delete a Worker from Cloudflare
wrangler delete [script]Positionals
- script [string]
The path to an entry point for your worker
Options
- --name [string]
Name of the worker
- --dry-run [boolean]
Don't actually delete
- --force [boolean]
Delete even if doing so will break other Workers that depend on this one
Manage Workers KV namespaces.
Create a new namespace.
wrangler kv namespace create <NAMESPACE> [OPTIONS]NAMESPACEstring required- The name of the new namespace.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace (the
preview_idvalue).
- Interact with a preview namespace (the
The following is an example of using the create command to create a KV namespace called MY_KV.
npx wrangler kv namespace create "MY_KV"🌀 Creating namespace with title "worker-MY_KV"✨ Success!Add the following to your configuration file in your kv_namespaces array:kv_namespaces = [ { binding = "MY_KV", id = "e29b263ab50e42ce9b637fa8370175e8" }]The following is an example of using the create command to create a preview KV namespace called MY_KV.
npx wrangler kv namespace create "MY_KV" --preview🌀 Creating namespace with title "my-site-MY_KV_preview"✨ Success!Add the following to your configuration file in your kv_namespaces array:kv_namespaces = [ { binding = "MY_KV", preview_id = "15137f8edf6c09742227e99b08aaf273" }]List all KV namespaces associated with the current account ID.
wrangler kv namespace listThe following is an example that passes the Wrangler command through the jq command:
npx wrangler kv namespace list | jq "."[ { "id": "06779da6940b431db6e566b4846d64db", "title": "TEST_NAMESPACE" }, { "id": "32ac1b3c2ed34ed3b397268817dea9ea", "title": "STATIC_CONTENT" }]Delete a given namespace.
wrangler kv namespace delete {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to delete.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to delete.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
The following is an example of deleting a KV namespace called MY_KV.
npx wrangler kv namespace delete --binding=MY_KVAre you sure you want to delete namespace f7b02e7fc70443149ac906dd81ec1791? [y/n]yesDeleting namespace f7b02e7fc70443149ac906dd81ec1791Deleted namespace f7b02e7fc70443149ac906dd81ec1791The following is an example of deleting a preview KV namespace called MY_KV.
npx wrangler kv namespace delete --binding=MY_KV --previewAre you sure you want to delete namespace 15137f8edf6c09742227e99b08aaf273? [y/n]yesDeleting namespace 15137f8edf6c09742227e99b08aaf273Deleted namespace 15137f8edf6c09742227e99b08aaf273Manage key-value pairs within a Workers KV namespace.
Write a single key-value pair to a particular namespace.
wrangler kv key put <KEY> {<VALUE>|--path=<PATH>} {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]KEYstring required- The key to write to.
VALUEstring optional- The value to write.
--pathoptional- When defined, the value is loaded from the file at
--pathrather than reading it from theVALUEargument. This is ideal for security-sensitive operations because it avoids saving keys and values into your terminal history.
- When defined, the value is loaded from the file at
--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to delete.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to delete.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
--ttlnumber optional- The lifetime (in number of seconds) that the key-value pair should exist before expiring. Must be at least
60seconds. This option takes precedence over theexpirationoption.
- The lifetime (in number of seconds) that the key-value pair should exist before expiring. Must be at least
--expirationnumber optional- The timestamp, in UNIX seconds, indicating when the key-value pair should expire.
--metadatastring optional- Any (escaped) JSON serialized arbitrary object to a maximum of 1024 bytes.
--localboolean optional- Interact with locally persisted data.
--persist-tostring optional- Specify directory for locally persisted data.
The following is an example that puts a key-value into the namespace with binding name of MY_KV.
npx wrangler kv key put --binding=MY_KV "my-key" "some-value"Writing the value "some-value" to key "my-key" on namespace f7b02e7fc70443149ac906dd81ec1791.The following is an example that puts a key-value into the preview namespace with binding name of MY_KV.
npx wrangler kv key put --binding=MY_KV --preview "my-key" "some-value"Writing the value "some-value" to key "my-key" on namespace 15137f8edf6c09742227e99b08aaf273.The following is an example that puts a key-value into a namespace, with a time-to-live value of 10000 seconds.
npx wrangler kv key put --binding=MY_KV "my-key" "some-value" --ttl=10000Writing the value "some-value" to key "my-key" on namespace f7b02e7fc70443149ac906dd81ec1791.The following is an example that puts a key-value into a namespace, where the value is read from the value.txt file.
npx wrangler kv key put --binding=MY_KV "my-key" --path=value.txtWriting the contents of value.txt to the key "my-key" on namespace f7b02e7fc70443149ac906dd81ec1791.Output a list of all keys in a given namespace.
wrangler kv key list {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to delete.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to delete.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
--prefixstring optional- Only list keys that begin with the given prefix.
--localboolean optional- Interact with locally persisted data.
--persist-tostring optional- Specify directory for locally persisted data.
Below is an example that passes the Wrangler command through the jq command:
npx wrangler kv key list --binding=MY_KV --prefix="public" | jq "."[ { "name": "public_key" }, { "name": "public_key_with_expiration", "expiration": "2019-09-10T23:18:58Z" }]Read a single value by key from the given namespace.
wrangler kv key get <KEY> {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]KEYstring required- The key value to get.
--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to get from.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to get from.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
--textboolean optional- Decode the returned value as a UTF-8 string.
--localboolean optional- Interact with locally persisted data.
--persist-tostring optional- Specify directory for locally persisted data.
The following is an example that gets the value of the "my-key" key from the KV namespace with binding name MY_KV.
npx wrangler kv key get --binding=MY_KV "my-key"valueRemove a single key value pair from the given namespace.
wrangler kv key delete <KEY> {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]KEYstring required- The key value to get.
--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to delete.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to delete.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
--localboolean optional- Interact with locally persisted data.
--persist-tostring optional- Specify directory for locally persisted data.
The following is an example that deletes the key-value pair with key "my-key" from the KV namespace with binding name MY_KV.
npx wrangler kv key delete --binding=MY_KV "my-key"Deleting the key "my-key" on namespace f7b02e7fc70443149ac906dd81ec1791.Manage multiple key-value pairs within a Workers KV namespace in batches.
Write a JSON file containing an array of key-value pairs to the given namespace.
wrangler kv bulk put <FILENAME> {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]FILENAMEstring required- The JSON file containing an array of key-value pairs to write to the namespace.
--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to delete.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to delete.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
--localboolean optional- Interact with locally persisted data.
--persist-tostring optional- Specify directory for locally persisted data.
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 }]KV namespace values can only store strings. In order to save complex a value, stringify it to JSON:
[ { "key": "test_key", "value": "{\"name\": \"test_value\"}", "expiration_ttl": 3600 }]Refer to the full schema for key-value entries uploaded via the bulk API:
keystring required- The key’s name. The name may be 512 bytes maximum. All printable, non-whitespace characters are valid.
valuestring required- The UTF-8 encoded string to be stored, up to 25 MB in length.
metadataobject optional- Any arbitrary object (must serialize to JSON) to a maximum of 1,024 bytes.
expirationnumber optional- The time, measured in number of seconds since the UNIX epoch, at which the key should expire.
expiration_ttlnumber optional- The number of seconds the document should exist before expiring. Must be at least
60seconds.
- The number of seconds the document should exist before expiring. Must be at least
base64boolean 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.
- 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
The following is an example of writing all the key-value pairs found in the allthethingsupload.json file.
npx wrangler kv bulk put --binding=MY_KV allthethingsupload.jsonSuccess!Delete all keys read from a JSON file within a given namespace.
wrangler kv bulk delete <FILENAME> {--binding=<BINDING>|--namespace-id=<NAMESPACE_ID>} [OPTIONS]FILENAMEstring required- The JSON file containing an array of keys to delete from the namespace.
--bindingstring- The binding name of the namespace, as stored in the
wrangler.tomlfile, to delete.
- The binding name of the namespace, as stored in the
--namespace-idstring- The ID of the namespace to delete.
--envstring optional- Perform on a specific environment.
--previewboolean optional- Interact with a preview namespace instead of production.
--localboolean optional- Interact with locally persisted data.
--persist-tostring optional- Specify directory for locally persisted data.
This command takes a JSON file as an argument containing an array of keys to delete.
The following is an example of the JSON input:
["test_key_1", "test_key_2"]The following is an example of deleting all the keys found in the allthethingsdelete.json file.
npx wrangler kv bulk delete --binding=MY_KV allthethingsdelete.json? Are you sure you want to delete all keys in allthethingsdelete.json from kv-namespace with id "f7b02e7fc70443149ac906dd81ec1791"? › (Y/n)Success!Interact with buckets in an R2 store.
Create a new R2 bucket
wrangler r2 bucket create <name>Positionals
- name [string] [required]
The name of the new bucket
Options
- -J, --jurisdiction [string]
The jurisdiction where the new bucket will be created
- -s, --storage-class [string]
The default storage class for objects uploaded to this bucket
Delete an R2 bucket
wrangler r2 bucket delete <name>Positionals
- name [string] [required]
The name of the bucket to delete
Options
- -J, --jurisdiction [string]
The jurisdiction where the bucket exists
List R2 buckets
wrangler r2 bucket listOptions
- -J, --jurisdiction [string]
The jurisdiction to list
Create an event notification rule for an R2 bucket
wrangler r2 bucket notification create <bucket>Positionals
- bucket [string] [required]
The name of the R2 bucket to create an event notification rule for
Options
- --event-types, --event-type [array] [required] [choices: "object-create", "object-delete"]
The type of event(s) that will emit event notifications
- --prefix [string]
The prefix that an object must match to emit event notifications (note: regular expressions not supported)
- --suffix [string]
The suffix that an object must match to emit event notifications (note: regular expressions not supported)
- --queue [string] [required]
The name of the queue that will receive event notification messages
Delete an event notification rule from an R2 bucket
wrangler r2 bucket notification delete <bucket>Positionals
- bucket [string] [required]
The name of the R2 bucket to delete an event notification rule for
Options
- --queue [string] [required]
The name of the queue that corresponds to the event notification rule. If no rule is provided, all event notification rules associated with the bucket and queue will be deleted
- --rule [string]
The ID of the event notification rule to delete
List event notification rules for a bucket
wrangler r2 bucket notification list <bucket>Positionals
- bucket [string] [required]
The name of the R2 bucket to get event notification rules for
Enable Sippy on an R2 bucket
wrangler r2 bucket sippy enable <name>Positionals
- name [string] [required]
The name of the bucket
Options
- -J, --jurisdiction [string]
The jurisdiction where the bucket exists
- --provider [choices: "AWS", "GCS"]
- --bucket [string]
The name of the upstream bucket
- --region [string]
(AWS provider only) The region of the upstream bucket
- --access-key-id [string]
(AWS provider only) The secret access key id for the upstream bucket
- --secret-access-key [string]
(AWS provider only) The secret access key for the upstream bucket
- --service-account-key-file [string]
(GCS provider only) The path to your Google Cloud service account key JSON file
- --client-email [string]
(GCS provider only) The client email for your Google Cloud service account key
- --private-key [string]
(GCS provider only) The private key for your Google Cloud service account key
- --r2-access-key-id [string]
The secret access key id for this R2 bucket
- --r2-secret-access-key [string]
The secret access key for this R2 bucket
Disable Sippy on an R2 bucket
wrangler r2 bucket sippy disable <name>Positionals
- name [string] [required]
The name of the bucket
Options
- -J, --jurisdiction [string]
The jurisdiction where the bucket exists
Check the status of Sippy on an R2 bucket
wrangler r2 bucket sippy get <name>Positionals
- name [string] [required]
The name of the bucket
Options
- -J, --jurisdiction [string]
The jurisdiction where the bucket exists
Interact with R2 objects.
Fetch an object from an R2 bucket
wrangler r2 object get <objectPath>Positionals
- objectPath [string] [required]
The source object path in the form of {bucket}/{key}
Options
- -f, --file [string]
The destination file to create
- -p, --pipe [boolean]
Enables the file to be piped to a destination, rather than specified with the --file option
- --local [boolean]
Interact with local storage
- --persist-to [string]
Directory for local persistence
- -J, --jurisdiction [string]
The jurisdiction where the object exists
Create an object in an R2 bucket
wrangler r2 object put <objectPath>Positionals
- objectPath [string] [required]
The destination object path in the form of {bucket}/{key}
Options
- -f, --file [string]
The path of the file to upload
- -p, --pipe [boolean]
Enables the file to be piped in, rather than specified with the --file option
- --content-type, --ct [string]
A standard MIME type describing the format of the object data
- --content-disposition, --cd [string]
Specifies presentational information for the object
- --content-encoding, --ce [string]
Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field
- --content-language, --cl [string]
The language the content is in
- --cache-control, --cc [string]
Specifies caching behavior along the request/reply chain
- -e, --expires [string]
The date and time at which the object is no longer cacheable
- --local [boolean]
Interact with local storage
- --persist-to [string]
Directory for local persistence
- -J, --jurisdiction [string]
The jurisdiction where the object will be created
- -s, --storage-class [string]
The storage class of the object to be created
Delete an object in an R2 bucket
wrangler r2 object delete <objectPath>Positionals
- objectPath [string] [required]
The destination object path in the form of {bucket}/{key}
Options
- --local [boolean]
Interact with local storage
- --persist-to [string]
Directory for local persistence
- -J, --jurisdiction [string]
The jurisdiction where the object exists
Manage the secret variables for a Worker.
This action creates a new version of the Worker and deploys it immediately. To only create a new version of the Worker, use the wrangler versions secret commands.
Create or update a secret variable for a Worker
wrangler secret put <key>Positionals
- key [string] [required]
The variable name to be accessible in the Worker
Options
- --name [string]
Name of the Worker
When running this command, you will be prompted to input the secret’s value:
npx wrangler secret put FOO? Enter a secret value: › ***🌀 Creating the secret for script worker-app✨ Success! Uploaded secret FOOThe put command can also receive piped input. For example:
echo "-----BEGIN PRIVATE KEY-----\nM...==\n-----END PRIVATE KEY-----\n" | wrangler secret put PRIVATE_KEYDelete a secret variable from a Worker
wrangler secret delete <key>Positionals
- key [string] [required]
The variable name to be accessible in the Worker
Options
- --name [string]
Name of the Worker
List all secrets for a Worker
wrangler secret listOptions
- --name [string]
Name of the Worker
- --format [choices: "json", "pretty"] [default: "json"]
The format to print the secrets in
The following is an example of listing the secrets for the current Worker.
npx wrangler secret list[ { "name": "FOO", "type": "secret_text" }]Bulk upload secrets for a Worker
wrangler secret bulk [json]Positionals
- json [string]
The JSON file of key-value pairs to upload, in form {"key": value, ...}
Options
- --name [string]
Name of the Worker
The following is an example of uploading secrets from a JSON file redirected to stdin. When complete, the output summary will show the number of secrets uploaded and the number of secrets that failed to upload.
{ "secret-name-1": "secret-value-1", "secret-name-2": "secret-value-2"}npx wrangler secret:bulk < secrets.json🌀 Creating the secrets for the Worker "script-name"✨ Successfully created secret for key: secret-name-1...🚨 Error uploading secret for key: secret-name-1✨ Successfully created secret for key: secret-name-2
Finished processing secrets JSON file:✨ 1 secrets successfully uploaded🚨 1 secrets failed to upload🦚 Start a log tailing session for a Worker
wrangler tail [worker]Positionals
- worker [string]
Name or route of the worker to tail
Options
- --format [choices: "json", "pretty"] [default: "json"]
The format of log entries
- --status [array] [choices: "ok", "error", "canceled"]
Filter by invocation status
- --header [string]
Filter by HTTP header
- --method [array]
Filter by HTTP method
- --sampling-rate [number]
Adds a percentage of requests to log sampling rate
- --search [string]
Filter by a text match in console.log messages
- --ip [array]
Filter by the IP address the request originates from. Use "self" to filter for your own IP
- --version-id [string]
Filter by Worker version
After starting wrangler tail, you will receive a live feed of console and exception logs for each request your Worker receives.
If your Worker has a high volume of traffic, the tail might enter sampling mode. This will cause some of your messages to be dropped and a warning to appear in your tail logs. To prevent messages from being dropped, add the options listed above to filter the volume of tail messages.
If sampling persists after using options to filter messages, consider using instant logs ↗.
Configure Cloudflare Pages.
Develop your full-stack Pages application locally
wrangler pages dev [directory] [-- command..]Positionals
- directory [string]
The directory of static assets to serve
- command [deprecated]
The proxy command to run
Options
- --compatibility-date [string]
Date to use for compatibility checks
- --compatibility-flags, --compatibility-flag [array]
Flags to use for compatibility checks
- --ip [string]
The IP address to listen on
- --port [number]
The port to listen on (serve from)
- --inspector-port [number]
Port for devtools to connect to
- --proxy [deprecated] [number]
The port to proxy (where the static assets are served)
- --script-path [default: _worker.js]
The location of the single Worker script if not using functions
[deprecated] [string]
- --no-bundle [boolean] [default: false]
Whether to run bundling on
_worker.js - -b, --binding [array]
Bind variable/secret (KEY=VALUE)
- -k, --kv [array]
KV namespace to bind (--kv KV_BINDING)
- --d1 [array]
D1 database to bind (--d1 D1_BINDING)
- -o, --do [array]
Durable Object to bind (--do DO_BINDING=CLASS_NAME@SCRIPT_NAME)
- --r2 [array]
R2 bucket to bind (--r2 R2_BINDING)
- --ai [string]
AI to bind (--ai AI_BINDING)
- --version-metadata [string]
Worker Version metadata (--version-metadata VERSION_METADATA_BINDING)
- --service [array]
Service to bind (--service SERVICE=SCRIPT_NAME)
- --live-reload [boolean] [default: false]
Auto reload HTML pages when change is detected
- --local-protocol [choices: "http", "https"]
Protocol to listen to requests on, defaults to http.
- --https-key-path [string]
Path to a custom certificate key
- --https-cert-path [string]
Path to a custom certificate
- --persist-to [string]
Specify directory to use for local persistence (defaults to .wrangler/state)
- --log-level [choices: "debug", "info", "log", "warn", "error", "none"]
Specify logging level
- --show-interactive-dev-session [boolean]
Show interactive dev session (defaults to true if the terminal supports interactivity)
- --experimental-dev-env, --x-dev-env [boolean] [default: false]
Use the experimental DevEnv instantiation (unified across wrangler dev and unstable_dev)
- --experimental-registry, --x-registry [boolean] [default: false]
Use the experimental file based dev registry for multi-worker development
Experimental: Download your Pages project config as a wrangler.toml file
wrangler pages download config [projectName]Positionals
- projectName [string]
The Pages project to download
Options
- --force [boolean]
Overwrite an existing
wrangler.tomlfile without prompting
List your Cloudflare Pages projects
wrangler pages project listCreate a new Cloudflare Pages project
wrangler pages project create [project-name]Positionals
- project-name [string]
The name of your Pages project
Options
- --production-branch [string]
The name of the production branch of your project
- --compatibility-flags, --compatibility-flag [array]
Flags to use for compatibility checks
- --compatibility-date [string]
Date to use for compatibility checks
Delete a Cloudflare Pages project
wrangler pages project delete [project-name]Positionals
- project-name [string] [required]
The name of your Pages project
Options
- -y, --yes [boolean]
Answer "yes" to confirm project deletion
List deployments in your Cloudflare Pages project
wrangler pages deployment listOptions
- --project-name [string]
The name of the project you would like to list deployments for
Start a tailing session for a project's deployment and livestream logs from your Functions
wrangler pages deployment tail [deployment]Positionals
- deployment [string]
(Optional) ID or URL of the deployment to tail. Specify by environment if deployment ID is unknown.
Options
- --project-name [string]
The name of the project you would like to tail
- --environment [string] [choices: "production", "preview"] [default: "production"]
When not providing a specific deployment ID, specifying environment will grab the latest production or preview deployment
- --format [choices: "json", "pretty"] [default: "json"]
The format of log entries
- --status [array] [choices: "ok", "error", "canceled"]
Filter by invocation status
- --header [string]
Filter by HTTP header
- --method [array]
Filter by HTTP method
- --search [string]
Filter by a text match in console.log messages
- --sampling-rate [number]
Adds a percentage of requests to log sampling rate
- --ip [array]
Filter by the IP address the request originates from. Use "self" to filter for your own IP
After starting wrangler pages deployment tail, you will receive a live stream of console and exception logs for each request your Functions receive.
Deploy a directory of static assets as a Pages deployment
wrangler pages deploy [directory]Positionals
- directory [string]
The directory of static files to upload
Options
- --project-name [string]
The name of the project you want to deploy to
- --branch [string]
The name of the branch you want to deploy to
- --commit-hash [string]
The SHA to attach to this deployment
- --commit-message [string]
The commit message to attach to this deployment
- --commit-dirty [boolean]
Whether or not the workspace should be considered dirty for this deployment
- --skip-caching [boolean]
Skip asset caching which speeds up builds
- --no-bundle [boolean] [default: false]
Whether to run bundling on
_worker.jsbefore deploying - --upload-source-maps [boolean] [default: false]
Whether to upload any server-side sourcemaps with this deployment
Create or update a secret variable for a Pages project
wrangler pages secret put <key>Positionals
- key [string] [required]
The variable name to be accessible in the Pages project
Options
- --project-name, --project [string]
The name of your Pages project
Delete a secret variable from a Pages project
wrangler pages secret delete <key>Positionals
- key [string] [required]
The variable name to be accessible in the Pages project
Options
- --project-name, --project [string]
The name of your Pages project
List all secrets for a Pages project
wrangler pages secret listOptions
- --project-name, --project [string]
The name of your Pages project
Bulk upload secrets for a Pages project
wrangler pages secret bulk [json]Positionals
- json [string]
The JSON file of key-value pairs to upload, in form {"key": value, ...}
Options
- --project-name, --project [string]
The name of your Pages project
Manage your Workers Queues configurations.
Create a Queue
wrangler queues create <name>Positionals
- name [string] [required]
The name of the queue
Options
- --delivery-delay-secs [number]
How long a published message should be delayed for, in seconds. Must be a positive integer
Delete a Queue
wrangler queues delete <name>Positionals
- name [string] [required]
The name of the queue
List Queues
wrangler queues listOptions
- --page [number]
Page number for pagination
Add a Queue Worker Consumer
wrangler queues consumer add <queue-name> <script-name>Positionals
- queue-name [string] [required]
Name of the queue to configure
- script-name [string] [required]
Name of the consumer script
Options
- --batch-size [number]
Maximum number of messages per batch
- --batch-timeout [number]
Maximum number of seconds to wait to fill a batch with messages
- --message-retries [number]
Maximum number of retries for each message
- --dead-letter-queue [string]
Queue to send messages that failed to be consumed
- --max-concurrency [number]
The maximum number of concurrent consumer Worker invocations. Must be a positive integer
- --retry-delay-secs [number]
The number of seconds to wait before retrying a message
Remove a Queue Worker Consumer
wrangler queues consumer remove <queue-name> <script-name>Positionals
- queue-name [string] [required]
Name of the queue to configure
- script-name [string] [required]
Name of the consumer script
Authorize Wrangler with your Cloudflare account using OAuth. Wrangler will attempt to automatically open your web browser to login with your Cloudflare account.
If you prefer to use API tokens for authentication, such as in headless or continuous integration environments, refer to Running Wrangler in CI/CD.
🔓 Login to Cloudflare
wrangler loginOptions
- --scopes-list unknown
List all the available OAuth scopes with descriptions
- --browser [boolean] [default: true]
Automatically open the OAuth link in a browser
- --scopes [array]
Pick the set of applicable OAuth scopes when logging in
If Wrangler fails to open a browser, you can copy and paste the URL generated by wrangler login in your terminal into a browser and log in.
If you are using Wrangler from a remote machine, but run the login flow from your local browser, you will receive the following error message after logging in:This site can't be reached.
To finish the login flow, run wrangler login and go through the login flow in the browser:
npx wrangler login ⛅️ wrangler 2.1.6-------------------Attempting to login via OAuth...Opening a link in your default browser: https://dash.cloudflare.com/oauth2/auth?xyz...The browser login flow will redirect you to a localhost URL on your machine.
Leave the login flow active. Open a second terminal session. In that second terminal session, use curl or an equivalent request library on the remote machine to fetch this localhost URL. Copy and paste the localhost URL that was generated during the wrangler login flow and run:
curl <LOCALHOST_URL>🚪 Logout from Cloudflare
wrangler logoutIf you are using CLOUDFLARE_API_TOKEN instead of OAuth, and you can logout by deleting your API token in the Cloudflare dashboard:
- Log in to the Cloudflare dashboard ↗.
- Go to My Profile > API Tokens.
- Select the three-dot menu on your Wrangler token.
- Select Delete.
🕵️ Retrieve your user information
wrangler whoamiOptions
- --account [string]
Show membership information for the given account (id or name).
Uploads your Worker code and config as a new Version [beta]
wrangler versions uploadPositionals
- script [string]
The path to an entry point for your worker
Options
- --name [string]
Name of the worker
- --no-bundle [boolean] [default: false]
Skip internal build steps and directly deploy Worker
- --outdir [string]
Output directory for the bundled worker
- --compatibility-date [string]
Date to use for compatibility checks
- --compatibility-flags, --compatibility-flag [array]
Flags to use for compatibility checks
- --latest [boolean] [default: false]
Use the latest version of the worker runtime
- --assets [string]
Static assets to be served. Replaces Workers Sites.
- --var [array]
A key-value pair to be injected into the script as a variable
- --define [array]
A key-value pair to be substituted in the script
- --alias [array]
A module pair to be substituted in the script
- --jsx-factory [string]
The function that is called for each JSX element
- --jsx-fragment [string]
The function that is called for each JSX fragment
- --tsconfig [string]
Path to a custom tsconfig.json file
- --minify [boolean]
Minify the Worker
- --upload-source-maps [boolean]
Include source maps when uploading this Worker Gradual Rollouts Version.
- --node-compat [boolean]
Enable Node.js compatibility
- --dry-run [boolean]
Don't actually deploy
- --tag [string]
A tag for this Worker Gradual Rollouts Version
- --message [string]
A descriptive message for this Worker Gradual Rollouts Version
Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta]
wrangler versions deploy [version-specs..]Positionals
- version-specs [array] [default: []]
Shorthand notation to deploy Worker Version(s) [<version-id>@<percentage>..]
Options
- --name [string]
Name of the worker
- --version-id [array]
Worker Version ID(s) to deploy
- --percentage [number]
Percentage of traffic to split between Worker Version(s) (0-100)
- --message [string]
Description of this deployment (optional)
- -y, --yes [boolean] [default: false]
Automatically accept defaults to prompts
- --dry-run [boolean] [default: false]
Don't actually deploy
List the 10 most recent Versions of your Worker [beta]
wrangler versions listOptions
- --name [string]
Name of the worker
- --json [boolean] [default: false]
Display output as clean JSON
Create or update a secret variable for a Worker
wrangler versions secret put <key>Positionals
- key [string] [required]
The variable name to be accessible in the Worker
Options
- --name [string]
Name of the Worker
- --message [string]
Description of this deployment
- --tag [string]
A tag for this version
Delete a secret variable from a Worker
wrangler versions secret delete <key>Positionals
- key [string] [required]
The variable name to be accessible in the Worker
Options
- --name [string]
Name of the Worker
- --message [string]
Description of this deployment
- --tag [string]
A tag for this version
Create or update a secret variable for a Worker
wrangler versions secret bulk [json]Positionals
- json [string]
The JSON file of key-value pairs to upload, in form {"key": value, ...}
Options
- --name [string]
Name of the Worker
- --message [string]
Description of this deployment
- --tag [string]
A tag for this version
Updates the triggers of your current deployment [beta]
wrangler triggers deployOptions
- --name [string]
Name of the worker
- --triggers, --schedule, --schedules [array]
cron schedules to attach
- --routes, --route [array]
Routes to upload
- --dry-run [boolean]
Don't actually deploy
Deployments track the version(s) of your Worker that are actively serving traffic.
Displays the 10 most recent deployments of your Worker
wrangler deployments listOptions
- --name [string]
Name of the worker
- --json [boolean] [default: false]
Display output as clean JSON
View the current state of your production
wrangler deployments statusOptions
- --name [string]
Name of the worker
- --json [boolean] [default: false]
Display output as clean JSON
đź”™ Rollback a deployment for a Worker
wrangler rollback [version-id]Positionals
- version-id [string]
The ID of the Worker Version to rollback to
Options
- --name [string]
The name of your worker
- -m, --message [string]
The reason for this rollback
- -y, --yes [boolean] [default: false]
Automatically accept defaults to prompts
List all dispatch namespaces
wrangler dispatch-namespace listGet information about a dispatch namespace
wrangler dispatch-namespace get <name>Positionals
- name [string] [required]
Name of the dispatch namespace
Create a dispatch namespace
wrangler dispatch-namespace create <name>Positionals
- name [string] [required]
Name of the dispatch namespace
Delete a dispatch namespace
wrangler dispatch-namespace delete <name>Positionals
- name [string] [required]
Name of the dispatch namespace
Rename a dispatch namespace
wrangler dispatch-namespace rename <old-name> <new-name>Positionals
- old-name [string] [required]
Name of the dispatch namespace
- new-name [string] [required]
New name of the dispatch namespace
Manage client certificates used for mTLS connections in subrequests.
These certificates can be used in mtls_certificate bindings, which allow a Worker to present the certificate when establishing a connection with an origin that requires client authentication (mTLS).
Upload an mTLS certificate
wrangler mtls-certificate uploadOptions
- --cert [string] [required]
The path to a certificate file (.pem) containing a chain of certificates to upload
- --key [string] [required]
The path to a file containing the private key for your leaf certificate
- --name [string]
The name for the certificate
The following is an example of using the upload command to upload an mTLS certificate.
npx wrangler mtls-certificate upload --cert cert.pem --key key.pem --name my-origin-certUploading mTLS Certificate my-origin-cert...Success! Uploaded mTLS Certificate my-origin-certID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8dIssuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=USExpires: 1/01/2025You can then add this certificate as a binding in your wrangler.toml:
mtls_certificates = [ { binding = "MY_CERT", certificate_id = "99f5fef1-6cc1-46b8-bd79-44a0d5082b8d" }]Note that the certificate and private keys must be in separate (typically .pem) files when uploading.
List uploaded mTLS certificates
wrangler mtls-certificate listThe following is an example of using the list command to upload an mTLS certificate.
npx wrangler mtls-certificate listID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8dName: my-origin-certIssuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=USCreated on: 1/01/2023Expires: 1/01/2025
ID: c5d004d1-8312-402c-b8ed-6194328d5cbeIssuer: CN=another-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=USCreated on: 1/01/2023Expires: 1/01/2025Delete an mTLS certificate
wrangler mtls-certificate deleteOptions
- --id [string]
The id of the mTLS certificate to delete
- --name [string]
The name of the mTLS certificate record to delete
The following is an example of using the delete command to delete an mTLS certificate.
npx wrangler mtls-certificate delete --id 99f5fef1-6cc1-46b8-bd79-44a0d5082b8dAre you sure you want to delete certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d (my-origin-cert)? [y/n]yesDeleting certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d...Deleted certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d successfully📝 Generate types from bindings and module rules in configuration
wrangler types [path]Positionals
- path [string] [default: "worker-configuration.d.ts"]
The path to the declaration file to generate
Options
- --env-interface [string] [default: "Env"]
The name of the generated environment interface
- --experimental-include-runtime, --x-include-runtime [string]
The path of the generated runtime types file