Scripts
List
Fetch a list of uploaded workers.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
params | array | No | [] | Query Parameters: `tags`, to filter by script tag. |
$response = $client->workers()->scripts()->list('ACCOUNT_ID', []);
Download
Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. |
$response = $client->workers()->scripts()->download('ACCOUNT_ID', 'SCRIPT_NAME');
Upload
Upload a Worker, replacing the deployed script and its configuration.
The request is a multipart upload: a JSON metadata part describing the
Worker, and one part per module holding its source. Bindings and settings
come from the metadata, so anything left out of it is dropped — send the
whole configuration, not just what changed. To replace only the code, use
updateContent(); to stage a Worker without deploying it, upload a
version instead.
$client->workers()->scripts()->upload('ACCOUNT_ID', 'my-worker', [
['name' => 'worker.js', 'content' => file_get_contents('dist/worker.js')],
], [
'compatibility_date' => '2026-01-01',
'bindings' => [
['type' => 'kv_namespace', 'name' => 'KV', 'namespace_id' => 'NAMESPACE_ID'],
],
]);
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
modules | array | Yes | The modules making up the Worker. Each one is `['name' => 'worker.js', 'content' => '…']`, optionally with `'type'` to override the default `application/javascript+module`. | |
metadata | array | No | [] | Multipart metadata: `compatibility_date`, `bindings`, `migrations`, `placement`, and so on. `main_module` defaults to the first module. |
params | array | No | [] | Query Parameters, such as `['bindings_inherit' => 'strict']` to fail rather than silently drop bindings that cannot be inherited. |
$response = $client->workers()->scripts()->upload('ACCOUNT_ID', 'SCRIPT_NAME', [], [], []);
Update Content
Replace a Worker's code, leaving its configuration and metadata alone.
The counterpart of upload() for a code-only deploy: bindings,
compatibility date and the rest of the Worker's settings are kept as they
are.
$client->workers()->scripts()->updateContent('ACCOUNT_ID', 'my-worker', [
['name' => 'worker.js', 'content' => file_get_contents('dist/worker.js')],
]);
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
modules | array | Yes | The modules making up the Worker. Each one is `['name' => 'worker.js', 'content' => '…']`, optionally with `'type'` to override the default `application/javascript+module`. | |
metadata | array | No | [] | Multipart metadata naming the entry point. `main_module` defaults to the first module. |
$response = $client->workers()->scripts()->updateContent('ACCOUNT_ID', 'SCRIPT_NAME', [], []);
Get Content
Fetch script content only.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. |
$response = $client->workers()->scripts()->getContent('ACCOUNT_ID', 'SCRIPT_NAME');
Get Script Settings
Get script-level settings when using Worker Versions. Includes Logpush and Tail Consumers.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. |
$response = $client->workers()->scripts()->getScriptSettings('ACCOUNT_ID', 'SCRIPT_NAME');
Update Script Settings
Patch script-level settings when using Worker Versions. Includes Logpush and Tail Consumers.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
values | array | Yes | Script settings values. |
$response = $client->workers()->scripts()->updateScriptSettings('ACCOUNT_ID', 'SCRIPT_NAME', []);
Get Settings
Get metadata and config, such as bindings or usage model
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. |
$response = $client->workers()->scripts()->getSettings('ACCOUNT_ID', 'SCRIPT_NAME');
Update Settings
Patch metadata or config, such as bindings or usage model
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
values | array | Yes | Settings values. |
$response = $client->workers()->scripts()->updateSettings('ACCOUNT_ID', 'SCRIPT_NAME', []);
Get Usage Model
Fetches the Usage Model for a given Worker.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. |
$response = $client->workers()->scripts()->getUsageModel('ACCOUNT_ID', 'SCRIPT_NAME');
Update Usage Model
Updates the Usage Model for a given Worker. Requires a Workers Paid subscription.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
usageModel | string | Yes | Usage model. |
$response = $client->workers()->scripts()->updateUsageModel('ACCOUNT_ID', 'SCRIPT_NAME', 'USAGE_MODEL');
Delete
Delete your worker. This call has no response body on a successful delete.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
force | bool | No | false | If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script. |
$response = $client->workers()->scripts()->delete('ACCOUNT_ID', 'SCRIPT_NAME', true);

