Deploy Worker
deploy_workerUpload and deploy a Worker script with ES modules and bindings, replacing existing code. Set keep_assets to preserve static assets while updating code.
Instructions
Upload and deploy a Worker script (ES modules) with optional bindings (plain_text, secret_text, kv_namespace, r2_bucket, d1, assets). Replaces the Worker's code and binding set if it already exists. Set keep_assets to retain a site's static assets while updating code. By default the Worker is served on workers.dev.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modules | Yes | ES modules; the first is the entry point unless main_module says otherwise | |
| bindings | No | Resource bindings (replaces the full set) | |
| keep_assets | No | Retain the previous version's static assets (deploy code changes to a site without re-uploading files) | |
| main_module | No | Entry-point module name (default: first module) | |
| script_name | Yes | Worker name (lowercase, alphanumeric and hyphens) | |
| compatibility_date | No | YYYY-MM-DD; defaults to today (if omitted at the API level it would fall back to 2021-11-02) | |
| enable_workers_dev | No | Serve the Worker at <script_name>.<account>.workers.dev. Default: enabled for newly created Workers; existing Workers keep their current setting. | |
| compatibility_flags | No | ||
| enable_observability | No | Enable Workers Logs for this Worker (required for query_worker_logs) |