Skip to content
Start here

List Workers

client.workers.scripts.list(ScriptListParams { account_id, tags } params, RequestOptionsoptions?): SinglePage<ScriptListResponse { id, cache_options, compatibility_date, 21 more } >
GET/accounts/{account_id}/workers/scripts

Fetch a list of uploaded workers.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers Tail ReadWorkers Scripts WriteWorkers Scripts Read
ParametersExpand Collapse
params: ScriptListParams { account_id, tags }
account_id: string

Path param: Identifier.

maxLength32
tags?: string

Query param: Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is ‘yes’ or ‘no’.

ReturnsExpand Collapse
ScriptListResponse { id, cache_options, compatibility_date, 21 more }
id?: string

The name used to identify the script.

cache_options?: CacheOptions { enabled, cross_version_cache }

Global CacheW configuration for the Worker. When caching is on, the platform provisions a cloudflare.app zone for the Worker. A type: worker entry in the exports map can override this value for a single entrypoint.

enabled: boolean

Whether caching is enabled for this Worker.

cross_version_cache?: boolean

Whether cached responses are shared across Worker version uploads. This is independent of enabled. It can stay true while caching is off, so the preference survives turning caching off and back on.

compatibility_date?: string

Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.

compatibility_flags?: Array<string>

Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a compatibility_date.

created_on?: string

When the script was created.

formatdate-time
etag?: string

Hashed script content, can be used in a If-None-Match header when updating.

exports?: Record<string, WorkersWorkerExport { type, cache, state } | WorkersDurableObjectExport { storage, type, container, state } | WorkersDurableObjectDeletedExport { state, type } | 3 more>

Declarative exports for the Worker’s most recent version, including Durable Object classes (with their storage backend) and named Worker entrypoints. Tombstoned lifecycle entries are omitted, so only live exports (created and expecting-transfer) are returned.

One of the following:
WorkersWorkerExport { type, cache, state }

A named Worker entrypoint export (type: worker). Worker entrypoints are always live (state: created) and carry no storage or lifecycle fields. The optional cache block overrides the Worker’s global cache_options.enabled for this entrypoint.

type: "worker"

Marks this entry as a Worker entrypoint export.

cache?: Cache { enabled }

Cache override for this entrypoint. Overrides the Worker’s global cache_options.enabled for this entrypoint only.

enabled: boolean

Whether caching is enabled for this entrypoint.

state?: "created"

Live export. May be omitted; defaults to created.

WorkersDurableObjectExport { storage, type, container, state }

A live Durable Object export (state: created, the default). The platform auto-provisions the namespace on first deploy, matches it on subsequent deploys, and never mutates or deletes it as a side effect of a code-only change. storage is required; renamed_to, transferred_to and transfer_from are not allowed on a live entry.

storage: "sqlite" | "legacy-kv"

Durable Object storage backend. sqlite is the recommended (and only) backend for new namespaces. legacy-kv is accepted only for a class whose namespace already exists as KV-backed; the exports flow never provisions a new legacy-kv namespace.

One of the following:
"sqlite"
"legacy-kv"
type: "durable-object"

Marks this entry as a Durable Object export.

container?: string

Name of the container (declared in the upload’s metadata.containers) that backs this Durable Object. When set, the namespace is container-enabled. Valid only on live entries.

maxLength128
state?: "created"

Live export. May be omitted; defaults to created.

WorkersDurableObjectDeletedExport { state, type }

A deleted tombstone: retires the provisioned namespace for this class and all of its data. The class must be absent from the uploaded code and no other Worker in the account may bind to the namespace, otherwise the deploy is rejected. No other fields are allowed. Deletion is irreversible.

state: "deleted"

Tombstone that deletes the namespace.

type: "durable-object"

Marks this entry as a Durable Object export.

WorkersDurableObjectRenamedExport { renamed_to, state, type }

A renamed tombstone: rewrites the provisioned namespace’s class name from this map key to renamed_to. The source class may stay in code during the rollout window (an info notice is emitted). storage, transferred_to and transfer_from are not allowed.

renamed_to: string

The destination class name. Must differ from the source class (the map key) and must be declared as a live (created) entry in the same exports map. Write-only: never present in GET responses.

maxLength128
state: "renamed"

Tombstone that renames the namespace’s class.

type: "durable-object"

Marks this entry as a Durable Object export.

WorkersDurableObjectTransferredExport { state, transferred_to, type }

A transferred tombstone (source side of a two-phase transfer): hands ownership of the provisioned namespace to another script in the same account, named by transferred_to. The target must have already deployed a matching expecting-transfer entry. The source class may stay in code during the rollout window (an info notice is emitted). storage, renamed_to and transfer_from are not allowed.

state: "transferred"

Tombstone that transfers the namespace to another script.

transferred_to: string

The destination script name. Must be in the same account and the same dispatch-namespace context (or both non-dispatch). Cross-dispatch-namespace transfers are rejected. Write-only: never present in GET responses.

maxLength128
type: "durable-object"

Marks this entry as a Durable Object export.

WorkersDurableObjectExpectingTransferExport { state, storage, transfer_from, 2 more }

The target side of a two-phase transfer (state: expecting-transfer). Declares that this script expects to receive a namespace for this class from the transfer_from script. This is a live entry, not a tombstone: bindings resolve through the source’s namespace until the source commits with a transferred tombstone. storage and transfer_from are required; renamed_to and transferred_to are not allowed.

state: "expecting-transfer"

Target side of a two-phase transfer.

storage: "sqlite" | "legacy-kv"

Durable Object storage backend. sqlite is the recommended (and only) backend for new namespaces. legacy-kv is accepted only for a class whose namespace already exists as KV-backed; the exports flow never provisions a new legacy-kv namespace.

One of the following:
"sqlite"
"legacy-kv"
transfer_from: string

The source script name to receive the namespace from. Must be in the same account and dispatch-namespace context. Present on reads for expecting-transfer entries.

maxLength128
type: "durable-object"

Marks this entry as a Durable Object export.

container?: string

Name of the container (declared in the upload’s metadata.containers) that backs this Durable Object once the transfer settles. Valid only on live entries.

maxLength128
handlers?: Array<string>

The names of handlers exported as part of the default export.

has_assets?: boolean

Whether a Worker contains assets.

has_modules?: boolean

Whether a Worker contains modules.

last_deployed_from?: string

The client most recently used to deploy this Worker.

logpush?: boolean

Whether Logpush is turned on for the Worker.

migration_tag?: string

The tag of the Durable Object migration that was most recently applied for this Worker.

modified_on?: string

When the script was last modified.

formatdate-time
named_handlers?: Array<NamedHandler>

Named exports, such as Durable Object class implementations and named entrypoints.

handlers?: Array<string>

The names of handlers exported as part of the named export.

name?: string

The name of the export.

observability?: Observability { enabled, head_sampling_rate, logs, traces }

Observability settings for the Worker.

enabled: boolean

Whether observability is enabled for the Worker.

head_sampling_rate?: number | null

The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

logs?: Logs | null

Log settings for the Worker.

enabled: boolean

Whether logs are enabled for the Worker.

invocation_logs: boolean

Whether invocation logs are enabled for the Worker.

destinations?: Array<string>

A list of destinations where logs will be exported to.

head_sampling_rate?: number | null

The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

persist?: boolean

Whether log persistence is enabled for the Worker.

traces?: Traces | null

Trace settings for the Worker.

destinations?: Array<string>

A list of destinations where traces will be exported to.

enabled?: boolean

Whether traces are enabled for the Worker.

head_sampling_rate?: number | null

The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

persist?: boolean

Whether trace persistence is enabled for the Worker.

propagation_policy?: "authenticated" | "accept"

Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. “authenticated” (default) honors inbound trace context only when accompanied by a valid trace auth token. “accept” unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.

One of the following:
"authenticated"
"accept"
placement?: UnionMember0 { mode, last_analyzed_at, status } | UnionMember1 { region, last_analyzed_at, status } | UnionMember2 { hostname, last_analyzed_at, status } | 5 more

Configuration for Smart Placement. Specify mode=‘smart’ for Smart Placement, or one of region/hostname/host.

One of the following:
UnionMember0 { mode, last_analyzed_at, status }
mode: "smart"
last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember1 { region, last_analyzed_at, status }
region: string

Cloud region for targeted placement in format ‘provider:region’.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember2 { hostname, last_analyzed_at, status }
hostname: string

HTTP hostname for targeted placement.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember3 { host, last_analyzed_at, status }
host: string

TCP host and port for targeted placement.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember4 { mode, region, last_analyzed_at, status }
mode: "targeted"

Targeted placement mode.

region: string

Cloud region for targeted placement in format ‘provider:region’.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember5 { hostname, mode, last_analyzed_at, status }
hostname: string

HTTP hostname for targeted placement.

mode: "targeted"

Targeted placement mode.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember6 { host, mode, last_analyzed_at, status }
host: string

TCP host and port for targeted placement.

mode: "targeted"

Targeted placement mode.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
UnionMember7 { mode, target, last_analyzed_at, status }
mode: "targeted"

Targeted placement mode.

target: Array<Region { region } | Hostname { hostname } | Host { host } >

Array of placement targets (currently limited to single target).

One of the following:
Region { region }
region: string

Cloud region in format ‘provider:region’.

Hostname { hostname }
hostname: string

HTTP hostname for targeted placement.

Host { host }
host: string

TCP host:port for targeted placement.

last_analyzed_at?: string

The last time the script was analyzed for Smart Placement.

formatdate-time
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
Deprecatedplacement_mode?: "smart" | "targeted"
One of the following:
"smart"
"targeted"
Deprecatedplacement_status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"
One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
routes?: Array<Route> | null

Routes associated with the Worker.

id: string

Identifier.

maxLength32
pattern: string

Pattern to match incoming requests against. Learn more.

script?: string

Name of the script to run if the route matches.

tag?: string

The immutable ID of the script.

tags?: Array<string> | null

Tags associated with the Worker.

tail_consumers?: Array<ConsumerScript { service, environment, namespace } > | null

List of Workers that will consume logs from the attached Worker.

service: string

Name of Worker that is to be the consumer.

environment?: string

Optional environment if the Worker utilizes one.

namespace?: string

Optional dispatch namespace the script belongs to.

usage_model?: "standard" | "bundled" | "unbound"

Usage model for the Worker invocations.

One of the following:
"standard"
"bundled"
"unbound"

List Workers

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const scriptListResponse of client.workers.scripts.list({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
  console.log(scriptListResponse.id);
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "my-workers-script",
      "cache_options": {
        "enabled": true,
        "cross_version_cache": true
      },
      "compatibility_date": "2021-01-01",
      "compatibility_flags": [
        "nodejs_compat"
      ],
      "created_on": "2017-01-01T00:00:00Z",
      "etag": "ea95132c15732412d22c1476fa83f27a",
      "exports": {
        "Admin": {
          "type": "worker",
          "cache": {
            "enabled": true
          },
          "state": "created"
        },
        "Counter": {
          "storage": "sqlite",
          "type": "durable-object",
          "container": "my-container",
          "state": "created"
        },
        "OldCounter": {
          "state": "renamed",
          "type": "durable-object"
        },
        "default": {
          "type": "worker",
          "cache": {
            "enabled": false
          },
          "state": "created"
        }
      },
      "handlers": [
        "fetch",
        "scheduled"
      ],
      "has_assets": false,
      "has_modules": false,
      "last_deployed_from": "wrangler",
      "logpush": false,
      "migration_tag": "v1",
      "modified_on": "2017-01-01T00:00:00Z",
      "named_handlers": [
        {
          "handlers": [
            "class"
          ],
          "name": "MyDurableObject"
        }
      ],
      "observability": {
        "enabled": true,
        "head_sampling_rate": 0.1,
        "logs": {
          "enabled": true,
          "invocation_logs": true,
          "destinations": [
            "cloudflare"
          ],
          "head_sampling_rate": 0.1,
          "persist": true
        },
        "traces": {
          "destinations": [
            "cloudflare"
          ],
          "enabled": true,
          "head_sampling_rate": 0.1,
          "persist": true,
          "propagation_policy": "authenticated"
        }
      },
      "placement": {
        "mode": "smart",
        "last_analyzed_at": "2025-01-01T00:00:00Z",
        "status": "SUCCESS"
      },
      "placement_mode": "smart",
      "placement_status": "SUCCESS",
      "routes": [
        {
          "id": "023e105f4ecef8ad9ca31a8372d0c353",
          "pattern": "example.com/*",
          "script": "my-workers-script"
        }
      ],
      "tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
      "tags": [
        "my-team",
        "my-public-api"
      ],
      "tail_consumers": [
        {
          "service": "my-log-consumer",
          "environment": "production",
          "namespace": "my-namespace"
        }
      ],
      "usage_model": "standard"
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "my-workers-script",
      "cache_options": {
        "enabled": true,
        "cross_version_cache": true
      },
      "compatibility_date": "2021-01-01",
      "compatibility_flags": [
        "nodejs_compat"
      ],
      "created_on": "2017-01-01T00:00:00Z",
      "etag": "ea95132c15732412d22c1476fa83f27a",
      "exports": {
        "Admin": {
          "type": "worker",
          "cache": {
            "enabled": true
          },
          "state": "created"
        },
        "Counter": {
          "storage": "sqlite",
          "type": "durable-object",
          "container": "my-container",
          "state": "created"
        },
        "OldCounter": {
          "state": "renamed",
          "type": "durable-object"
        },
        "default": {
          "type": "worker",
          "cache": {
            "enabled": false
          },
          "state": "created"
        }
      },
      "handlers": [
        "fetch",
        "scheduled"
      ],
      "has_assets": false,
      "has_modules": false,
      "last_deployed_from": "wrangler",
      "logpush": false,
      "migration_tag": "v1",
      "modified_on": "2017-01-01T00:00:00Z",
      "named_handlers": [
        {
          "handlers": [
            "class"
          ],
          "name": "MyDurableObject"
        }
      ],
      "observability": {
        "enabled": true,
        "head_sampling_rate": 0.1,
        "logs": {
          "enabled": true,
          "invocation_logs": true,
          "destinations": [
            "cloudflare"
          ],
          "head_sampling_rate": 0.1,
          "persist": true
        },
        "traces": {
          "destinations": [
            "cloudflare"
          ],
          "enabled": true,
          "head_sampling_rate": 0.1,
          "persist": true,
          "propagation_policy": "authenticated"
        }
      },
      "placement": {
        "mode": "smart",
        "last_analyzed_at": "2025-01-01T00:00:00Z",
        "status": "SUCCESS"
      },
      "placement_mode": "smart",
      "placement_status": "SUCCESS",
      "routes": [
        {
          "id": "023e105f4ecef8ad9ca31a8372d0c353",
          "pattern": "example.com/*",
          "script": "my-workers-script"
        }
      ],
      "tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
      "tags": [
        "my-team",
        "my-public-api"
      ],
      "tail_consumers": [
        {
          "service": "my-log-consumer",
          "environment": "production",
          "namespace": "my-namespace"
        }
      ],
      "usage_model": "standard"
    }
  ],
  "success": true
}