Workers
Versions
Versions endpoint reference.
List
List of Worker Versions. The first version in the list is the latest version.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
params | array | No | [] | Array containing the necessary params. |
php
$response = $client->workers()->versions()->list('ACCOUNT_ID', 'SCRIPT_NAME', []);
Upload
Upload a Worker Version without deploying it to Cloudflare's network.
The request is a multipart upload: a JSON metadata part describing the
Worker, and one part per module holding its source. Deploy the version
afterwards with $client->workers()->deployments()->create().
$client->workers()->versions()->upload('ACCOUNT_ID', 'my-worker', [
['name' => 'worker.js', 'content' => file_get_contents('dist/worker.js')],
], [
'compatibility_date' => '2026-01-01',
'bindings' => [
['type' => 'plain_text', 'name' => 'MESSAGE', 'text' => 'Hello, world!'],
],
]);
| 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. |
php
$response = $client->workers()->versions()->upload('ACCOUNT_ID', 'SCRIPT_NAME', [], []);
Get
Get Version Details.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
scriptName | string | Yes | Name of the script, used in URLs and route configuration. | |
versionId | string | Yes | Version identifier. |
php
$response = $client->workers()->versions()->get('ACCOUNT_ID', 'SCRIPT_NAME', 'VERSION_ID');

