Skip to main content

workers_scripts

Creates, updates, deletes, gets or lists a workers_scripts resource.

Overview

Nameworkers_scripts
TypeResource
Idcloudflare.workers.workers_scripts

Fields

The following fields are returned by SELECT queries:

List Workers response.

NameDatatypeDescription
idstringThe name used to identify the script. (example: my-workers-script)
compatibility_datestringDate indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. (example: 2021-01-01)
compatibility_flagsarrayFlags 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. (x-stainless-collection-type: set)
created_onstring (date-time)When the script was created. (example: 2017-01-01T00:00:00Z)
etagstringHashed script content, can be used in a If-None-Match header when updating. (example: ea95132c15732412d22c1476fa83f27a)
handlersarrayThe names of handlers exported as part of the default export.
has_assetsbooleanWhether a Worker contains assets.
has_modulesbooleanWhether a Worker contains modules.
last_deployed_fromstringThe client most recently used to deploy this Worker. (example: wrangler)
logpushbooleanWhether Logpush is turned on for the Worker.
migration_tagstringThe tag of the Durable Object migration that was most recently applied for this Worker. (example: v1)
modified_onstring (date-time)When the script was last modified. (example: 2017-01-01T00:00:00Z)
named_handlersarrayNamed exports, such as Durable Object class implementations and named entrypoints.
observabilityobjectObservability settings for the Worker.
placementobjectConfiguration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host.
placement_modestringConfiguration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host. (smart, targeted)
placement_statusstringStatus of Smart Placement. (SUCCESS, UNSUPPORTED_APPLICATION, INSUFFICIENT_INVOCATIONS)
routesarrayRoutes associated with the Worker.
tagstringThe immutable ID of the script. (example: e8f70fdbc8b1fb0b8ddb1af166186758)
tagsarrayTags associated with the Worker. (x-stainless-collection-type: set)
tail_consumersarrayList of Workers that will consume logs from the attached Worker. (x-stainless-collection-type: set)
usage_modelstringUsage model for the Worker invocations. (standard, bundled, unbound) (default: standard, example: standard)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_idtagsFetch a list of uploaded workers.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
tagsstringFilter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.

SELECT examples

Fetch a list of uploaded workers.

SELECT
id,
compatibility_date,
compatibility_flags,
created_on,
etag,
handlers,
has_assets,
has_modules,
last_deployed_from,
logpush,
migration_tag,
modified_on,
named_handlers,
observability,
placement,
placement_mode,
placement_status,
routes,
tag,
tags,
tail_consumers,
usage_model
FROM cloudflare.workers.workers_scripts
WHERE account_id = '{{ account_id }}' -- required
AND tags = '{{ tags }}'
;