Skip to content
Start here

List Workers

workers.scripts.list(ScriptListParams**kwargs) -> SyncSinglePage[ScriptListResponse]
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
account_id: str

Identifier.

maxLength32
tags: Optional[str]

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

ReturnsExpand Collapse
class ScriptListResponse:
id: Optional[str]

The name used to identify the script.

cache_options: Optional[CacheOptions]

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: bool

Whether caching is enabled for this Worker.

cross_version_cache: Optional[bool]

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: Optional[str]

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

compatibility_flags: Optional[List[str]]

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: Optional[datetime]

When the script was created.

formatdate-time
etag: Optional[str]

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

handlers: Optional[List[str]]

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

has_assets: Optional[bool]

Whether a Worker contains assets.

has_modules: Optional[bool]

Whether a Worker contains modules.

last_deployed_from: Optional[str]

The client most recently used to deploy this Worker.

logpush: Optional[bool]

Whether Logpush is turned on for the Worker.

migration_tag: Optional[str]

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

modified_on: Optional[datetime]

When the script was last modified.

formatdate-time
named_handlers: Optional[List[NamedHandler]]

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

handlers: Optional[List[str]]

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

name: Optional[str]

The name of the export.

observability: Optional[Observability]

Observability settings for the Worker.

enabled: bool

Whether observability is enabled for the Worker.

head_sampling_rate: Optional[float]

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

logs: Optional[ObservabilityLogs]

Log settings for the Worker.

enabled: bool

Whether logs are enabled for the Worker.

invocation_logs: bool

Whether invocation logs are enabled for the Worker.

destinations: Optional[List[str]]

A list of destinations where logs will be exported to.

head_sampling_rate: Optional[float]

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

persist: Optional[bool]

Whether log persistence is enabled for the Worker.

traces: Optional[ObservabilityTraces]

Trace settings for the Worker.

destinations: Optional[List[str]]

A list of destinations where traces will be exported to.

enabled: Optional[bool]

Whether traces are enabled for the Worker.

head_sampling_rate: Optional[float]

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

persist: Optional[bool]

Whether trace persistence is enabled for the Worker.

propagation_policy: Optional[Literal["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: Optional[Placement]

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

One of the following:
class PlacementUnionMember0:
mode: Literal["smart"]
last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember1:
region: str

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

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember2:
hostname: str

HTTP hostname for targeted placement.

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember3:
host: str

TCP host and port for targeted placement.

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember4:
mode: Literal["targeted"]

Targeted placement mode.

region: str

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

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember5:
hostname: str

HTTP hostname for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember6:
host: str

TCP host and port for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
class PlacementUnionMember7:
mode: Literal["targeted"]

Targeted placement mode.

target: List[PlacementUnionMember7Target]

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

One of the following:
class PlacementUnionMember7TargetRegion:
region: str

Cloud region in format ‘provider:region’.

class PlacementUnionMember7TargetHostname:
hostname: str

HTTP hostname for targeted placement.

class PlacementUnionMember7TargetHost:
host: str

TCP host:port for targeted placement.

last_analyzed_at: Optional[datetime]

The last time the script was analyzed for Smart Placement.

formatdate-time
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
Deprecatedplacement_mode: Optional[Literal["smart", "targeted"]]
One of the following:
"smart"
"targeted"
Deprecatedplacement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]
One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
routes: Optional[List[Route]]

Routes associated with the Worker.

id: str

Identifier.

maxLength32
pattern: str

Pattern to match incoming requests against. Learn more.

script: Optional[str]

Name of the script to run if the route matches.

tag: Optional[str]

The immutable ID of the script.

tags: Optional[List[str]]

Tags associated with the Worker.

tail_consumers: Optional[List[ConsumerScript]]

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

service: str

Name of Worker that is to be the consumer.

environment: Optional[str]

Optional environment if the Worker utilizes one.

namespace: Optional[str]

Optional dispatch namespace the script belongs to.

usage_model: Optional[Literal["standard", "bundled", "unbound"]]

Usage model for the Worker invocations.

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

List Workers

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
page = client.workers.scripts.list(
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.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",
      "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",
      "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
}