Wrangler commands
Wrangler offers a number of commands to manage your Cloudflare Workers.
- docs- Open this page in your default browser.
- init- Create a skeleton Wrangler project, including the- wrangler.tomlfile.
- generate- Create a Wrangler project using an existing Workers template.
- 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.
- 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.
 Background
This page provides a reference for Wrangler commands.
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.
You can add Wrangler commands that you use often as scripts in your project’s package.json file:
You can then run them using your package manager of choice:
docs
Open the Cloudflare developer documentation in your default browser.
- COMMAND- string- The Wrangler command you want to learn more about. This opens your default browser to the section of the documentation that describes the command.
 
init
Create a skeleton Wrangler project, including the wrangler.toml file.
- NAME- string- The name of the Workers project. This is both the directory name and nameproperty in the generatedwrangler.tomlconfiguration file.
 
- The name of the Workers project. This is both the directory name and 
- --yes- boolean- Answer yes to any prompts for new projects.
 
- --from-dash- string- Fetch a Worker initialized from the dashboard. This is done by passing the flag and the Worker name. wrangler init --from-dash <WORKER_NAME>.
- The --from-dashcommand will not automatically sync changes made to the dashboard after the command is used. Therefore, it is recommended that you continue using the CLI.
 
- Fetch a Worker initialized from the dashboard. This is done by passing the flag and the Worker name. 
generate
Create a Wrangler project using an existing Workers template.
- NAME- string- The name of the Workers project. This is both the directory name and nameproperty in the generatedwrangler.tomlconfiguration file.
 
- The name of the Workers project. This is both the directory name and 
- TEMPLATE- string- The URL of a GitHub template, with a default worker-template. Browse a list of available templates on the cloudflare/workers-sdk repository.
 
d1
Interact with Cloudflare’s D1 service.
create
Creates a new D1 database, and provides the binding and UUID that you will put in your wrangler.toml file.
- DATABASE_NAME- string- The name of the new D1 database.
 
- --experimental-backend- boolean- Use the new experimental storage backend for this database.
 
- --location- string- Provide an optional location hint for your database leader.
- Available options include weur(Western Europe),eeur(Eastern Europe),apac(Asia Pacific),wnam(Western North America), andenam(Eastern North America).
 
list
List all D1 databases in your account.
delete
Delete a D1 database.
- DATABASE_NAME- string- The name of the D1 database to delete.
 
execute
Execute a query on a D1 database.
- DATABASE_NAME- string- The name of the D1 database to execute a query on.
 
- --command- string- The SQL query you wish to execute.
 
- --file- string- Path to the SQL file you wish to execute.
 
- Note that you must provide either --commandor--filefor this command to run successfully.
time-travel restore
Restore a database to a specific point-in-time using Time Travel.
- DATABASE_NAME- string- The name of the D1 database to execute a query on.
 
- --bookmark- string- A D1 bookmark representing the state of a database at a specific point in time.
 
- --timestamp- string- A UNIX timestamp or JavaScript date-time stringwithin the last 30 days.
 
- A UNIX timestamp or JavaScript date-time 
time-travel info
Inspect the current state of a database for a specific point-in-time using Time Travel.
- DATABASE_NAME- string- The name of the D1 database to execute a query on.
 
- --timestamp- string- A UNIX timestamp or JavaScript date-time stringwithin the last 30 days.
 
- A UNIX timestamp or JavaScript date-time 
backup create
Initiate a D1 backup.
- DATABASE_NAME- string- The name of the D1 database to backup.
 
backup list
List all available backups.
- DATABASE_NAME- string- The name of the D1 database to list the backups of.
 
backup restore
Restore a backup into a D1 database.
- DATABASE_NAME- string- The name of the D1 database to restore the backup into.
 
- BACKUP_ID- string- The ID of the backup you wish to restore.
 
backup download
Download existing data to your local machine.
- DATABASE_NAME- string- The name of the D1 database you wish to download the backup of.
 
- BACKUP_ID- string- The ID of the backup you wish to download.
 
migrations create
Create a new migration.
This will generate a new versioned file inside the migrations folder. Name your migration file as a description of your change. This will make it easier for you to find your migration in the migrations folder. An example filename looks like:
0000_create_user_table.sql
The filename will include a version number and the migration name you specify below.
- DATABASE_NAME- string- The name of the D1 database you wish to create a migration for.
 
- MIGRATION_NAME- string- A descriptive name for the migration you wish to create.
 
migrations list
View a list of unapplied migration files.
- DATABASE_NAME- string- The name of the D1 database you wish to list unapplied migrations for.
 
- --local- boolean- Show the list of unapplied migration files on your locally persisted D1 database.
 
migrations apply
Apply any unapplied migrations.
This command will prompt you to confirm the migrations you are about to apply. Confirm that you would like to proceed. After, a backup will be captured.
The progress of each migration will be printed in the console.
When running the apply command in a CI/CD environment or another non-interactive command line, the confirmation step will be skipped, but the backup will still be captured.
If applying a migration results in an error, this migration will be rolled back, and the previous successful migration will remain applied.
- DATABASE_NAME- string- The name of the D1 database you wish to apply your migrations on.
 
- --local- boolean- Execute any unapplied migrations on your locally persisted D1 database.
 
hyperdrive
Manage Hyperdrive database configurations.
create
Create a new Hyperdrive configuration.
- ID- string- The ID of the Hyperdrive configuration to create.
 
- --connection-string- string- The database connection string in the form postgres://user:password@hostname:port/database.
 
- The database connection string in the form 
update
Update an existing Hyperdrive configuration.
- ID- string- The ID of the Hyperdrive configuration to update.
 
- --origin-host- string- The new database hostname or IP address Hyperdrive should connect to.
 
- --origin-port- string- The new database port to connect to.
 
- --database- string- The new database (name) to connect to. For example, Postgres or defaultdb.
 
- --origin-user- string- The new username used to authenticate to the database.
 
- --origin-password- string- The new password used to authenticate to the database.
 
list
List all Hyperdrive configurations.
delete
Delete an existing Hyperdrive configuration.
- ID- string- The name of the Hyperdrive configuration to delete.
 
get
Get an existing Hyperdrive configuration.
- ID- string- The name of the Hyperdrive configuration to get.
 
vectorize
Interact with a Vectorize vector database.
create
Creates a new vector index, and provides the binding and name that you will put in your wrangler.toml file.
- INDEX_NAME- string- The name of the new index to create. Cannot be changed.
 
- --dimensions- number- The vector dimension width to configure the index for. Cannot be changed after creation.
 
- --metric- string- The distance metric to use for calculating vector distance. Must be one of cosine,euclidean, ordot-product.
 
- The distance metric to use for calculating vector distance. Must be one of 
get
Get details about an individual index, including its configuration.
- INDEX_NAME- string- The name of the index to fetch details for.
 
list
List all Vectorize indexes in your account, including the configured dimensions and distance metric.
delete
Delete a Vectorize index.
- INDEX_NAME- string- The name of the Vectorize index to delete.
 
- --force- boolean- Skip confirmation when deleting the index (Note: This is not a recoverable operation).
 
insert
Insert vectors into an index.
- INDEX_NAME- string- The name of the Vectorize index to delete.
 
- --file- string- A file containing the vectors to insert in newline-delimited JSON (JSON) format.
 
- --batch-size- number- The number of vectors to insert at a time (default: 5000).
 
- The number of vectors to insert at a time (default: 
dev
Start a local server for developing your Worker.
- SCRIPT- string- The path to an entry point for your Worker. Only required if your wrangler.tomldoes not include amainkey (for example,main = "index.js").
 
- The path to an entry point for your Worker. Only required if your 
- --name- string- Name of the Worker.
 
- --no-bundle- boolean- Skip Wrangler’s build steps. Particularly useful when using custom builds. Refer to Bundling for more information.
 
- --env- string- Perform on a specific environment.
 
- --compatibility-date- string- A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used.
 
- --compatibility-flags,- --compatibility-flag- string[]- Flags to use for compatibility checks.
 
- --latest- boolean- Use the latest version of the Workers runtime.
 
- --ip- string- IP address to listen on, defaults to localhost.
 
- IP address to listen on, defaults to 
- --port- number- Port to listen on.
 
- --inspector-port- number- Port for devtools to connect to.
 
- --routes,- --route- string[]- Routes to upload.
- For example: --route example.com/*.
 
- --host- string- Host to forward requests to, defaults to the zone of project.
 
- --local-protocol- “http”|“https”- Protocol to listen to requests on.
 
- --local-upstream- string- Host to act as origin in local mode, defaults to dev.hostor route.
 
- Host to act as origin in local mode, defaults to 
- --assets- string- Root folder of static assets to be served.
- Use in combination with --nameand--latestfor basic static file hosting. For example:wrangler dev --name personal_blog --assets dist/ --latest.
 
- --site- string- Root folder of static assets for Workers Sites.
 
- --site-include- string[]- Array of .gitignore-style patterns that match file or directory names from the sites directory. Only matched items will be uploaded.
 
- Array of 
- --site-exclude- string[]- Array of .gitignore-style patterns that match file or directory names from the sites directory. Matched items will not be uploaded.
 
- Array of 
- --upstream-protocol- “http”|“https”- Protocol to forward requests to host on.
 
- --var- key:value[]- Array of key:valuepairs to inject as variables into your code. The value will always be passed as a string to your Worker.
- For example, --var git_hash:$(git rev-parse HEAD) test:123makes thegit_hashandtestvariables available in your Worker’senv.
- This flag is an alternative to defining varsin yourwrangler.toml. If defined in both places, this flag’s values will be used.
 
- Array of 
- --define- key:value[]- Array of key:valuepairs to replace global identifiers in your code.
- For example, --define GIT_HASH:$(git rev-parse HEAD)will replace all uses ofGIT_HASHwith the actual value at build time.
- This flag is an alternative to defining definein yourwrangler.toml. If defined in both places, this flag’s values will be used.
 
- Array of 
- --tsconfig- string- Path to a custom tsconfig.jsonfile.
 
- Path to a custom 
- --minify- boolean- Minify the Worker.
 
- --node-compat- boolean- Enable Node.js compatibility.
 
- --persist-to- string- Specify directory to use for local persistence.
 
- --remote- boolean- Develop against remote resources and data stored on Cloudflare’s network.
 
- --test-scheduled- boolean- Exposes a /__scheduledfetch route which will trigger a scheduled event (Cron Trigger) for testing during development. To simulate different cron patterns, acronquery parameter can be passed in:/__scheduled?cron=*+*+*+*+*.
 
- Exposes a 
- --log-level- “debug”|“info”|“log”|“warn”|“error”|“none”- Specify Wrangler’s logging level.
 
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
Deploy your Worker to Cloudflare.
- SCRIPT- string- The path to an entry point for your Worker. The path to an entry point for your Worker. Only required if your wrangler.tomldoes not include amainkey (for example,main = "index.js").
 
- The path to an entry point for your Worker. The path to an entry point for your Worker. Only required if your 
- --name- string- Name of the Worker.
 
- --no-bundle- boolean- Skip Wrangler’s build steps. Particularly useful when using custom builds. Refer to Bundling for more information.
 
- --env- string- Perform on a specific environment.
 
- --outdir- string- Path to directory where Wrangler will write the bundled Worker files.
 
- --compatibility-date- string- A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used.
 
- --compatibility-flags,- --compatibility-flag- string[]- Flags to use for compatibility checks.
 
- --latest- boolean- Use the latest version of the Workers runtime.
 
- --assets- string- Root folder of static assets to be served.
- Use in combination with --nameand--latestfor basic static file hosting. For example:npx wrangler deploy --name personal_blog --assets dist/ --latest.
 
- --site- string- Root folder of static assets for Workers Sites.
 
- --site-include- string[]- Array of .gitignore-style patterns that match file or directory names from the sites directory. Only matched items will be uploaded.
 
- Array of 
- --site-exclude- string[]- Array of .gitignore-style patterns that match file or directory names from the sites directory. Matched items will not be uploaded.
 
- Array of 
- --var- key:value[]- Array of key:valuepairs to inject as variables into your code. The value will always be passed as a string to your Worker.
- For example, --var git_hash:$(git rev-parse HEAD) test:123makes thegit_hashandtestvariables available in your Worker’senv.
- This flag is an alternative to defining varsin yourwrangler.toml. If defined in both places, this flag’s values will be used.
 
- Array of 
- --define- key:value[]- Array of key:valuepairs to replace global identifiers in your code.
- For example, --define GIT_HASH:$(git rev-parse HEAD)will replace all uses ofGIT_HASHwith the actual value at build time.
- This flag is an alternative to defining definein yourwrangler.toml. If defined in both places, this flag’s values will be used.
 
- Array of 
- --triggers,- --schedule,- --schedules- string[]- Cron schedules to attach to the deployed Worker. Refer to Cron Trigger Examples.
 
- --routes,- --route- string[]- Routes where this Worker will be deployed.
- For example: --route example.com/*.
 
- --tsconfig- string- Path to a custom tsconfig.jsonfile.
 
- Path to a custom 
- --minify- boolean- Minify the bundled Worker before deploying.
 
- --node-compat- boolean- Enable node.js compatibility.
 
- --dry-run- boolean- Compile a project without actually deploying to live servers. Combined with --outdir, this is also useful for testing the output ofnpx wrangler deploy. It also gives developers a chance to upload our generated sourcemap to a service like Sentry, so that errors from the Worker can be mapped against source code, but before the service goes live.
 
- Compile a project without actually deploying to live servers. Combined with 
- --keep-vars- boolean- It is recommended best practice to treat your Wrangler developer environment as a source of truth for your Worker configuration, and avoid making changes via the Cloudflare dashboard.
- If you change your environment variables or bindings in the Cloudflare dashboard, Wrangler will override them the next time you deploy. If you want to disable this behaviour set keep-varstotrue.
 
publish
Publish your Worker to Cloudflare.
delete
Delete your Worker and all associated Cloudflare developer platform resources.
- SCRIPT- string- The path to an entry point for your Worker. The path to an entry point for your Worker. Only required if your wrangler.tomldoes not include amainkey (for example,main = "index.js").
 
- The path to an entry point for your Worker. The path to an entry point for your Worker. Only required if your 
- --name- string- Name of the Worker.
 
- --env- string- Perform on a specific environment.
 
- --dry-run- boolean- Do not actually delete the Worker. This is useful for testing the output of wrangler delete.
 
- Do not actually delete the Worker. This is useful for testing the output of 
kv:namespace
Manage Workers KV namespaces.
create
Create a new namespace.
- NAMESPACE- string- The name of the new namespace.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- 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.
The following is an example of using the create command to create a preview KV namespace called MY_KV.
list
List all KV namespaces associated with the current account ID.
The following is an example that passes the Wrangler command through the jq command:
delete
Delete a given namespace.
- --binding- string- 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-id- string- The ID of the namespace to delete.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
The following is an example of deleting a KV namespace called MY_KV.
The following is an example of deleting a preview KV namespace called MY_KV.
kv:key
Manage key-value pairs within a Workers KV namespace.
put
Write a single key-value pair to a particular namespace.
- KEY- string- The key to write to.
 
- VALUE- string- The value to write.
 
- --path- 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 
- --binding- string- 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-id- string- The ID of the namespace to delete.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
- --ttl- number- 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 
- --expiration- number- The timestamp, in UNIX seconds, indicating when the key-value pair should expire.
 
- --metadata- string- Any (escaped) JSON serialized arbitrary object to a maximum of 1024 bytes.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- 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.
The following is an example that puts a key-value into the preview namespace with binding name of MY_KV.
The following is an example that puts a key-value into a namespace, with a time-to-live value of 10000 seconds.
The following is an example that puts a key-value into a namespace, where the value is read from the value.txt file.
list
Output a list of all keys in a given namespace.
- --binding- string- 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-id- string- The ID of the namespace to delete.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
- --prefix- string- Only list keys that begin with the given prefix.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- Specify directory for locally persisted data.
 
Below is an example that passes the Wrangler command through the jq command:
get
Read a single value by key from the given namespace.
- KEY- string- The key value to get.
 
- --binding- string- 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-id- string- The ID of the namespace to get from.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
- --text- boolean- Decode the returned value as a UTF-8 string.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- 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.
delete
Remove a single key value pair from the given namespace.
- KEY- string- The key value to get.
 
- --binding- string- 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-id- string- The ID of the namespace to delete.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- 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.
kv:bulk
Manage multiple key-value pairs within a Workers KV namespace in batches.
put
Write a JSON file containing an array of key-value pairs to the given namespace.
- FILENAME- string- The JSON file containing an array of key-value pairs to write to the namespace.
 
- --binding- string- 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-id- string- The ID of the namespace to delete.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- 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:
KV namespace values can only store strings. In order to save complex a value, stringify it to JSON:
Refer to the full schema for key-value entries uploaded via the bulk API:
- key- string- The key’s name. The name may be 512 bytes maximum. All printable, non-whitespace characters are valid.
 
- value- string- The UTF-8 encoded string to be stored, up to 25 MB in length.
 
- metadata- object- Any arbitrary object (must serialize to JSON) to a maximum of 1024 bytes.
 
- expiration- number- The time, measured in number of seconds since the UNIX epoch, at which the key should expire.
 
- expiration_ttl- number- 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 
- base64- boolean- 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.
delete
Delete all keys read from a JSON file within a given namespace.
- FILENAME- string- The JSON file containing an array of keys to delete from the namespace.
 
- --binding- string- 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-id- string- The ID of the namespace to delete.
 
- --env- string- Perform on a specific environment.
 
- --preview- boolean- Interact with a preview namespace instead of production.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- 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:
The following is an example of deleting all the keys found in the allthethingsdelete.json file.
r2 bucket
Interact with buckets in an R2 store.
create
Create a new R2 bucket.
- NAME- string- The name of the new R2 bucket.
 
delete
Delete an R2 bucket.
- NAME- string- The name of the R2 bucket to delete.
 
list
List R2 bucket in the current account.
r2 object
Interact with R2 objects.
get
Fetch an object from an R2 bucket.
- OBJECT_PATH- string- The source object path in the form of {bucket}/{key}.
 
- The source object path in the form of 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- Specify directory for locally persisted data.
 
put
Create an object in an R2 bucket.
- OBJECT_PATH- string- The destination object path in the form of {bucket}/{key}.
 
- The destination object path in the form of 
- --file- string- The path of the file to upload. Note you must provide either --fileor--pipe.
 
- The path of the file to upload. Note you must provide either 
- --pipe- boolean- Enables the file to be piped in, rather than specified with the --fileoption. Note you must provide either--fileor--pipe.
 
- Enables the file to be piped in, rather than specified with the 
- --content-type- string- A standard MIME type describing the format of the object data.
 
- --content-disposition- string- Specifies presentational information for the object.
 
- --content-encoding- 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-Typeheader field.
 
- 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-language- string- The language the content is in.
 
- --cache-control- string- Specifies caching behavior along the request/reply chain.
 
- --expires- string- The date and time at which the object is no longer cacheable.
 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- Specify directory for locally persisted data.
 
delete
Delete an object in an R2 bucket.
- OBJECT_PATH- string- The destination object path in the form of {bucket}/{key}.
 
- The destination object path in the form of 
- --local- boolean- Interact with locally persisted data.
 
- --persist-to- string- Specify directory for locally persisted data.
 
secret
Manage the secret variables for a Worker.
put
Create or replace a secret for a Worker.
- KEY- string- The variable name for this secret to be accessed in the Worker.
 
- --name- string- Perform on a specific Worker rather than inheriting from wrangler.toml.
 
- Perform on a specific Worker rather than inheriting from 
- --env- string- Perform on a specific environment.
 
When running this command, you will be prompted to input the secret’s value:
The put command can also receive piped input. For example:
delete
Delete a secret for a Worker.
- KEY- string- The variable name for this secret to be accessed in the Worker.
 
- --name- string- Perform on a specific Worker rather than inheriting from wrangler.toml.
 
- Perform on a specific Worker rather than inheriting from 
- --env- string- Perform on a specific environment.
 
list
List the names of all the secrets for a Worker.
- --name- string- Perform on a specific Worker rather than inheriting from wrangler.toml.
 
- Perform on a specific Worker rather than inheriting from 
- --env- string- Perform on a specific environment
 
The following is an example of listing the secrets for the current Worker.
secret:bulk
Upload multiple secrets for a Worker at once.
- FILENAME- string- The JSON file containing key-value pairs to upload as secrets, in the form {"SECRET_NAME": "secret value", ...}.
- If omitted, Wrangler expects to receive input from stdinrather than a file.
 
- The JSON file containing key-value pairs to upload as secrets, in the form 
- --name- string- Perform on a specific Worker rather than inheriting from wrangler.toml.
 
- Perform on a specific Worker rather than inheriting from 
- --env- string- Perform on a specific environment.
 
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.
secrets.json{  "secret-name-1": "secret-value-1",  "secret-name-2": "secret-value-2"
}
tail
Start a session to livestream logs from a deployed Worker.
- WORKER- string- The name of your Worker or the route the Worker is running on.
 
- --format- “json”|“pretty”- The format of the log entries.
 
- --status- “ok”|“error”|“canceled”- Filter by invocation status.
 
- --header- string- Filter by HTTP header.
 
- --method- string- Filter by HTTP method.
 
- --sampling-rate- number- Add a fraction of requests to log sampling rate (between 0and1).
 
- Add a fraction of requests to log sampling rate (between 
- --search- string- Filter by a text match in console.logmessages.
 
- Filter by a text match in 
- --ip- (string|“self”)[]- Filter by the IP address the request originates from. Use "self"to show only messages from your own IP.
 
- Filter by the IP address the request originates from. Use 
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.
pages
Configure Cloudflare Pages.
dev
Develop your full stack Pages application locally.
- DIRECTORY- string- The directory of static assets to serve.
 
- COMMAND...- string- The proxy command(s) to run.
 
- --local- boolean- Run on your local machine.
 
- --port- number- The port to listen on (serve from).
 
- --proxy- number- The port to proxy (where the static assets are served).
 
- --script-path- string- The location of the single Worker file if not using functions.
 
- --binding- string[]- Bind an environment variable or secret (for example, --binding <VARIABLE_NAME>=<VALUE>).
 
- Bind an environment variable or secret (for example, 
- --kv- string[]- Binding name of KV namespace to bind (for example, --kv <BINDING_NAME>).
 
- Binding name of KV namespace to bind (for example, 
- --r2- string[]- Binding name of R2 bucket to bind (for example, --r2 <BINDING_NAME>).
 
- Binding name of R2 bucket to bind (for example, 
- --d1- string[]- Binding name of D1 database to bind (for example, --d1 <BINDING_NAME>).
 
- Binding name of D1 database to bind (for example, 
- --do- string[]- Binding name of Durable Object to bind (for example, --do <BINDING_NAME>=<CLASS>).
 
- Binding name of Durable Object to bind (for example, 
- --live-reload- boolean- Auto reload HTML pages when change is detected.
 
- --compatibility-flag- string[]- Runtime compatibility flags to apply.
 
- --compatibility-date- string- Runtime compatibility date to apply.
 
project list
List your Pages projects.
project create
Create a new Cloudflare Pages project.
- PROJECT_NAME- string- The name of your Pages project.
 
- --production-branch- string- The name of the production branch of your project.
 
project delete
Delete a Cloudflare Pages project.
- PROJECT_NAME- string- The name of the Pages project to delete.
 
- --yes- boolean- Answer "yes"to confirmation prompt.
 
- Answer 
deployment list
List deployments in your Cloudflare Pages project.
- --project-name- string- The name of the project you would like to list deployments for.
 
deployment tail
Start a session to livestream logs from your deployed Pages Functions.
- DEPLOYMENT- string- ID or URL of the deployment to tail. Specify by environment if deployment ID is unknown.
 
- --project-name- string- The name of the project you would like to tail.
 
- --environment- “production”|“preview”- When not providing a specific deployment ID, specifying environment will grab the latest production or preview deployment.
 
- --format- “json”|“pretty”- The format of the log entries.
 
- --status- “ok”|“error”|“canceled”- Filter by invocation status.
 
- --header- string- Filter by HTTP header.
 
- --method- string- Filter by HTTP method.
 
- --sampling-rate- number- Add a percentage of requests to log sampling rate.
 
- --search- string- Filter by a text match in console.logmessages.
 
- Filter by a text match in 
- --ip- (string|“self”)[]- Filter by the IP address the request originates from. Use "self"to show only messages from your own IP.
 
- Filter by the IP address the request originates from. Use 
After starting wrangler pages deployment tail, you will receive a live stream of console and exception logs for each request your Functions receive.
deploy
Deploy a directory of static assets as a Pages deployment.
- DIRECTORY- string- The directory of static files to upload.
 
- --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.
 
publish
Publish a directory of static assets as a Pages deployment.
queues
Manage your Workers Queues configurations.
create
Create a new Queue.
- name- string- The name of the queue to create.
 
delete
Delete an existing queue.
- name- string- The name of the queue to delete.
 
list
List all queues in the current account.
consumer
Manage queue consumer configurations.
consumer add <script-name>
Add a Worker script as a queue consumer.
- queue-name- string- The name of the queue to add the consumer to.
 
- script-name- string- The name of the Workers script to add as a consumer of the named queue.
 
consumer remove
Remove a consumer from a queue.
- queue-name- string- The name of the queue to remove the consumer from.
 
- script-name- string- The name of the Workers script to remove as the consumer.
 
login
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.
- --scopes-list- string- List all the available OAuth scopes with descriptions.
 
- --scopes $SCOPES- string- Allows to choose your set of OAuth scopes. The set of scopes must be entered in a whitespace-separated list,
for example, $ wrangler login --scopes account:read user:read.
 
- Allows to choose your set of OAuth scopes. The set of scopes must be entered in a whitespace-separated list,
for example, 
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.
Use wrangler login on a remote machine
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:
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:
logout
Remove Wrangler’s authorization for accessing your account. This command will invalidate your current OAuth token.
If 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.
whoami
Retrieve your user information and test your authentication configuration.
deployments
For more information about deployments and how they work, refer to Deployments.
list
Retrieve details for the 10 most recent deployments. Details include Deployment ID, Created on, Author, Source, and an indication of which deployment is Active. Where applicable, details also include rollback information and a Message if one was provided on rollback.
- --name- string- Perform on a specific Worker rather than inheriting from wrangler.toml.
 
- Perform on a specific Worker rather than inheriting from 
Example output:
view 
Retrieve details for the specified deployment, or the latest if no ID is provided. Details include Deployment ID, Author, Source, Created on, and bindings. Where applicable, details also include rollback information and a Message if one was provided on rollback.
- DEPLOYMENT_ID- string- The ID of the deployment you wish to view.
 
- --name- string- Perform on a specific Worker rather than inheriting from wrangler.toml.
 
- Perform on a specific Worker rather than inheriting from 
Example output:
rollback
Rollback to a specified deployment by ID, or to the previous deployment if no ID is provided. The command will prompt you for confirmation of the rollback. On confirmation, you will be prompted to provide an optional message.
There are limitations on what deployments you can rollback to. Refer to Rollbacks in the Deployments documentation for more information.
- DEPLOYMENT_ID- string- The ID of the deployment you wish to view.
 
- --message- string- Add message for rollback. Accepts empty string. When specified, interactive prompts for rollback confirmation and message are skipped.
 
Example output:
 dispatch namespace
list
List all dispatch namespaces.
get
Get information about a dispatch namespace.
- NAME- string- The name of the dispatch namespace to get details about.
 
create
Create a dispatch namespace.
- NAME- string- The name of the dispatch namespace to create.
 
delete
Delete a dispatch namespace.
- NAME- string- The name of the dispatch namespace to delete.
 
rename
Rename a dispatch namespace.
- OLD_NAME- string- The previous name of the dispatch namespace.
 
- NEW_NAME- string- The new name of the dispatch namespace.
 
mtls-certificate
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
Upload a client certificate.
- --cert- string- A path to the TLS certificate to upload. Certificate chains are supported.
 
- --key- string- A path to the private key to upload.
 
- --name- string- The name assigned to the mTLS certificate at upload.
 
The following is an example of using the upload command to upload an mTLS certificate.
You can then add this certificate as a binding in your wrangler.toml:
Note that the certificate and private keys must be in separate (typically .pem) files when uploading.
list
List mTLS certificates associated with the current account ID.
The following is an example of using the list command to upload an mTLS certificate.
delete
Delete a client certificate.
- --id- string- The ID of the mTLS certificate.
 
- --name- string- The name assigned to the mTLS certificate at upload.
 
The following is an example of using the delete command to delete an mTLS certificate.
types
Generate types from bindings and module rules in configuration.