## List Workers `client.Workers.Scripts.List(ctx, params) (*SinglePage[ScriptListResponse], error)` **get** `/accounts/{account_id}/workers/scripts` Fetch a list of uploaded workers. ### Parameters - `params ScriptListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Tags param.Field[string]` Query param: Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'. ### Returns - `type ScriptListResponse struct{…}` - `ID string` The name used to identify the script. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []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`. - `CreatedOn Time` When the script was created. - `Etag string` Hashed script content, can be used in a If-None-Match header when updating. - `Handlers []string` The names of handlers exported as part of the default export. - `HasAssets bool` Whether a Worker contains assets. - `HasModules bool` Whether a Worker contains modules. - `LastDeployedFrom string` The client most recently used to deploy this Worker. - `Logpush bool` Whether Logpush is turned on for the Worker. - `MigrationTag string` The tag of the Durable Object migration that was most recently applied for this Worker. - `ModifiedOn Time` When the script was last modified. - `NamedHandlers []ScriptListResponseNamedHandler` Named exports, such as Durable Object class implementations and named entrypoints. - `Handlers []string` The names of handlers exported as part of the named export. - `Name string` The name of the export. - `Observability ScriptListResponseObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs ScriptListResponseObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces ScriptListResponseObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement ScriptListResponsePlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type ScriptListResponsePlacementObject struct{…}` - `Mode ScriptListResponsePlacementObjectMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectModeSmart ScriptListResponsePlacementObjectMode = "smart"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Mode ScriptListResponsePlacementObjectMode` Targeted placement mode. - `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode ScriptListResponsePlacementObjectMode` Targeted placement mode. - `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode ScriptListResponsePlacementObjectMode` Targeted placement mode. - `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptListResponsePlacementObject struct{…}` - `Mode ScriptListResponsePlacementObjectMode` Targeted placement mode. - `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"` - `Target []ScriptListResponsePlacementObjectTarget` Array of placement targets (currently limited to single target). - `type ScriptListResponsePlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type ScriptListResponsePlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type ScriptListResponsePlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptListResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"` - `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `PlacementMode ScriptListResponsePlacementMode` - `const ScriptListResponsePlacementModeSmart ScriptListResponsePlacementMode = "smart"` - `const ScriptListResponsePlacementModeTargeted ScriptListResponsePlacementMode = "targeted"` - `PlacementStatus ScriptListResponsePlacementStatus` - `const ScriptListResponsePlacementStatusSuccess ScriptListResponsePlacementStatus = "SUCCESS"` - `const ScriptListResponsePlacementStatusUnsupportedApplication ScriptListResponsePlacementStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptListResponsePlacementStatusInsufficientInvocations ScriptListResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"` - `Routes []ScriptListResponseRoute` Routes associated with the Worker. - `ID string` Identifier. - `Pattern string` Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). - `Script string` Name of the script to run if the route matches. - `Tag string` The immutable ID of the script. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` 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. - `UsageModel ScriptListResponseUsageModel` Usage model for the Worker invocations. - `const ScriptListResponseUsageModelStandard ScriptListResponseUsageModel = "standard"` - `const ScriptListResponseUsageModelBundled ScriptListResponseUsageModel = "bundled"` - `const ScriptListResponseUsageModelUnbound ScriptListResponseUsageModel = "unbound"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Workers.Scripts.List(context.TODO(), workers.ScriptListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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", "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 } }, "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 } ```