PHP Client for Cloudflare API
Workers

Scripts

Scripts endpoint reference.

List

Fetch a list of uploaded workers.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
php
$response = $client->workers()->scripts()->list('ACCOUNT_ID');
View this operation on the Cloudflare API Reference

Download

Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->download('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Upload

Upload a worker module. You can find more about the multipart metadata on Cloudflare Docs.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->upload('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Update Content

Put script content without touching config or metadata

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->updateContent('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Get Content

Fetch script content only.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->getContent('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Get Script Settings

Get script-level settings when using Worker Versions. Includes Logpush and Tail Consumers.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->getScriptSettings('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Update Script Settings

Patch script-level settings when using Worker Versions. Includes Logpush and Tail Consumers.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
valuesarrayYesScript settings values.
php
$response = $client->workers()->scripts()->updateScriptSettings('ACCOUNT_ID', 'SCRIPT_NAME', []);
View this operation on the Cloudflare API Reference

Get Settings

Get metadata and config, such as bindings or usage model

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->getSettings('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Update Settings

Patch metadata or config, such as bindings or usage model

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
valuesarrayYesSettings values.
php
$response = $client->workers()->scripts()->updateSettings('ACCOUNT_ID', 'SCRIPT_NAME', []);
View this operation on the Cloudflare API Reference

Get Usage Model

Fetches the Usage Model for a given Worker.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
php
$response = $client->workers()->scripts()->getUsageModel('ACCOUNT_ID', 'SCRIPT_NAME');
View this operation on the Cloudflare API Reference

Update Usage Model

Updates the Usage Model for a given Worker. Requires a Workers Paid subscription.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
usageModelstringYesUsage model.
php
$response = $client->workers()->scripts()->updateUsageModel('ACCOUNT_ID', 'SCRIPT_NAME', 'USAGE_MODEL');
View this operation on the Cloudflare API Reference

Delete

Delete your worker. This call has no response body on a successful delete.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount identifier.
scriptNamestringYesName of the script, used in URLs and route configuration.
forceboolNofalseIf 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.
php
$response = $client->workers()->scripts()->delete('ACCOUNT_ID', 'SCRIPT_NAME', true);
View this operation on the Cloudflare API Reference
Copyright © 2026