Scripts
List
Fetch a list of uploaded workers.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. |
$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 module. You can find more about the multipart metadata on Cloudflare Docs.
| 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()->upload('ACCOUNT_ID', 'SCRIPT_NAME');
Update Content
Put script content without touching config or metadata
| 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()->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);

