Skip to content
Start here

Workers

ModelsExpand Collapse
class MigrationStep:
deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
class SingleStepMigration:

A single set of migrations to apply.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
class WorkerMetadata:

JSON-encoded metadata about the uploaded parts and Worker configuration.

body_part: Optional[str]

Name of the part in the multipart request that contains the script (e.g. the file adding a listener to the fetch event). Indicates a service worker syntax Worker.

main_module: Optional[str]

Name of the part in the multipart request that contains the main module (e.g. the file exporting a fetch handler). Indicates a module syntax Worker.

WorkersBeta

WorkersBetaWorkers

List Workers
workers.beta.workers.list(WorkerListParams**kwargs) -> SyncV4PagePaginationArray[Worker]
GET/accounts/{account_id}/workers/workers
Get Worker
workers.beta.workers.get(strworker_id, WorkerGetParams**kwargs) -> Worker
GET/accounts/{account_id}/workers/workers/{worker_id}
Create Worker
workers.beta.workers.create(WorkerCreateParams**kwargs) -> Worker
POST/accounts/{account_id}/workers/workers
Update Worker
workers.beta.workers.update(strworker_id, WorkerUpdateParams**kwargs) -> Worker
PUT/accounts/{account_id}/workers/workers/{worker_id}
Edit Worker
workers.beta.workers.edit(strworker_id, WorkerEditParams**kwargs) -> Worker
PATCH/accounts/{account_id}/workers/workers/{worker_id}
Delete Worker
workers.beta.workers.delete(strworker_id, WorkerDeleteParams**kwargs) -> WorkerDeleteResponse
DELETE/accounts/{account_id}/workers/workers/{worker_id}
ModelsExpand Collapse
class Worker:
id: str

Immutable ID of the Worker.

created_on: datetime

When the Worker was created.

formatdate-time
logpush: bool

Whether logpush is enabled for the Worker.

name: str

Name of the Worker.

observability: Observability

Observability settings for the Worker.

enabled: Optional[bool]

Whether observability is enabled for the Worker.

head_sampling_rate: Optional[float]

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

logs: Optional[ObservabilityLogs]

Log settings for the Worker.

destinations: Optional[List[str]]

A list of destinations where logs will be exported to.

enabled: Optional[bool]

Whether logs are enabled for the Worker.

head_sampling_rate: Optional[float]

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

invocation_logs: Optional[bool]

Whether invocation logs are enabled for the Worker.

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%).

persist: Optional[bool]

Whether trace persistence is enabled for the Worker.

references: References

Other resources that reference the Worker and depend on it existing.

dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]

Other Workers that reference the Worker as an outbound for a dispatch namespace.

namespace_id: str

ID of the dispatch namespace.

namespace_name: str

Name of the dispatch namespace.

worker_id: str

ID of the Worker using the dispatch namespace.

worker_name: str

Name of the Worker using the dispatch namespace.

domains: List[ReferencesDomain]

Custom domains connected to the Worker.

id: str

ID of the custom domain.

certificate_id: str

ID of the TLS certificate issued for the custom domain.

hostname: str

Full hostname of the custom domain, including the zone name.

zone_id: str

ID of the zone.

zone_name: str

Name of the zone.

durable_objects: List[ReferencesDurableObject]

Other Workers that reference Durable Object classes implemented by the Worker.

namespace_id: str

ID of the Durable Object namespace being used.

namespace_name: str

Name of the Durable Object namespace being used.

worker_id: str

ID of the Worker using the Durable Object implementation.

worker_name: str

Name of the Worker using the Durable Object implementation.

queues: List[ReferencesQueue]

Queues that send messages to the Worker.

queue_consumer_id: str

ID of the queue consumer configuration.

queue_id: str

ID of the queue.

queue_name: str

Name of the queue.

workers: List[ReferencesWorker]

Other Workers that reference the Worker using service bindings.

id: str

ID of the referencing Worker.

name: str

Name of the referencing Worker.

subdomain: Subdomain

Subdomain settings for the Worker.

enabled: Optional[bool]

Whether the *.workers.dev subdomain is enabled for the Worker.

previews_enabled: Optional[bool]

Whether preview URLs are enabled for the Worker.

tags: List[str]

Tags associated with the Worker.

tail_consumers: List[TailConsumer]

Other Workers that should consume logs from the Worker.

name: str

Name of the consumer Worker.

updated_on: datetime

When the Worker was most recently updated.

formatdate-time
deployed_on: Optional[datetime]

When the Worker's most recent deployment was created. null if the Worker has never been deployed.

formatdate-time
class WorkerDeleteResponse:
errors: List[Error]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[ErrorSource]
pointer: Optional[str]
messages: List[Message]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[MessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

WorkersBetaWorkersVersions

List Versions
workers.beta.workers.versions.list(strworker_id, VersionListParams**kwargs) -> SyncV4PagePaginationArray[Version]
GET/accounts/{account_id}/workers/workers/{worker_id}/versions
Get Version
workers.beta.workers.versions.get(strversion_id, VersionGetParams**kwargs) -> Version
GET/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}
Create Version
workers.beta.workers.versions.create(strworker_id, VersionCreateParams**kwargs) -> Version
POST/accounts/{account_id}/workers/workers/{worker_id}/versions
Delete Version
workers.beta.workers.versions.delete(strversion_id, VersionDeleteParams**kwargs) -> VersionDeleteResponse
DELETE/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}
ModelsExpand Collapse
class Version:
id: str

Version identifier.

formatuuid
created_on: datetime

When the version was created.

formatdate-time
number: int

The integer version number, starting from one.

urls: List[str]

All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version.

annotations: Optional[Annotations]

Metadata about the version.

workers_message: Optional[str]

Human-readable message about the version.

maxLength100
workers_tag: Optional[str]

User-provided identifier for the version.

maxLength25
workers_triggered_by: Optional[str]

Operation that triggered the creation of the version.

assets: Optional[Assets]

Configuration for assets within a Worker.

_headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain.

config: Optional[AssetsConfig]

Configuration for assets within a Worker.

html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]

Determines the redirects and rewrites of requests for HTML content.

One of the following:
"auto-trailing-slash"
"force-trailing-slash"
"drop-trailing-slash"
"none"
not_found_handling: Optional[Literal["none", "404-page", "single-page-application"]]

Determines the response when a request does not match a static asset, and there is no Worker script.

One of the following:
"none"
"404-page"
"single-page-application"
run_worker_first: Optional[Union[List[str], bool, null]]

Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules.

One of the following:
List[str]

Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules.

bool

Enables routing to always invoke the Worker script ahead of all requests. When true, this is equivalent to ["/*"] in the string array version of this field.

jwt: Optional[str]

Token provided upon successful upload of all files from a registered manifest.

bindings: Optional[List[Binding]]

List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.

One of the following:
class BindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAISearch:
instance_name: str

The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.

name: str

A JavaScript variable name for the binding.

type: Literal["ai_search"]

The kind of resource that the binding provides.

namespace: Optional[str]

The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.

class BindingWorkersBindingKindAISearchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.

type: Literal["ai_search_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAnalyticsEngine:
dataset: str

The name of the dataset to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["analytics_engine"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindD1:
id: str

Identifier of the D1 database to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["d1"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDataBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the data content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["data_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDispatchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The name of the dispatch namespace.

type: Literal["dispatch_namespace"]

The kind of resource that the binding provides.

outbound: Optional[BindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[BindingWorkersBindingKindDispatchNamespaceOutboundParam]]

Pass information from the Dispatch Worker to the Outbound Worker through the parameters.

name: str

Name of the parameter.

worker: Optional[BindingWorkersBindingKindDispatchNamespaceOutboundWorker]

Outbound worker.

entrypoint: Optional[str]

Entrypoint to invoke on the outbound worker.

environment: Optional[str]

Environment of the outbound worker.

service: Optional[str]

Name of the outbound worker.

class BindingWorkersBindingKindDurableObjectNamespace:
name: str

A JavaScript variable name for the binding.

type: Literal["durable_object_namespace"]

The kind of resource that the binding provides.

class_name: Optional[str]

The exported class name of the Durable Object.

dispatch_namespace: Optional[str]

The dispatch namespace the Durable Object script belongs to.

environment: Optional[str]

The environment of the script_name to bind to.

namespace_id: Optional[str]

Namespace identifier tag.

maxLength32
script_name: Optional[str]

The script where the Durable Object is defined, if it is external to this Worker.

class BindingWorkersBindingKindHyperdrive:
id: str

Identifier of the Hyperdrive connection to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["hyperdrive"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindInherit:
name: str

The name of the inherited binding.

type: Literal["inherit"]

The kind of resource that the binding provides.

old_name: Optional[str]

The old name of the inherited binding. If set, the binding will be renamed from old_name to name in the new version. If not set, the binding will keep the same name between versions.

version_id: Optional[str]

Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.

class BindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindJson:
json: object

JSON data to use.

name: str

A JavaScript variable name for the binding.

type: Literal["json"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindKVNamespace:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Namespace identifier tag.

maxLength32
type: Literal["kv_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMTLSCertificate:
certificate_id: str

Identifier of the certificate to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["mtls_certificate"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPlainText:
name: str

A JavaScript variable name for the binding.

text: str

The text value to use.

type: Literal["plain_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPipelines:
name: str

A JavaScript variable name for the binding.

pipeline: str

Name of the Pipeline to bind to.

type: Literal["pipelines"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindQueue:
name: str

A JavaScript variable name for the binding.

queue_name: str

Name of the Queue to bind to.

type: Literal["queue"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: BindingWorkersBindingKindRatelimitSimple

The rate limit configuration.

limit: float

The limit (requests per period).

period: int

The period in seconds.

type: Literal["ratelimit"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindR2Bucket:
bucket_name: str

R2 bucket to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["r2_bucket"]

The kind of resource that the binding provides.

jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]

The jurisdiction of the R2 bucket.

One of the following:
"eu"
"fedramp"
"fedramp-high"
class BindingWorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSendEmail:
name: str

A JavaScript variable name for the binding.

type: Literal["send_email"]

The kind of resource that the binding provides.

allowed_destination_addresses: Optional[List[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[List[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class BindingWorkersBindingKindService:
name: str

A JavaScript variable name for the binding.

service: str

Name of Worker to bind to.

type: Literal["service"]

The kind of resource that the binding provides.

entrypoint: Optional[str]

Entrypoint to invoke on the target Worker.

environment: Optional[str]

Optional environment if the Worker utilizes one.

class BindingWorkersBindingKindTextBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the text content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["text_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVectorize:
index_name: str

Name of the Vectorize index to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["vectorize"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretsStoreSecret:
name: str

A JavaScript variable name for the binding.

secret_name: str

Name of the secret in the store.

store_id: str

ID of the store containing the secret.

type: Literal["secrets_store_secret"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

class BindingWorkersBindingKindWorkflow:
name: str

A JavaScript variable name for the binding.

type: Literal["workflow"]

The kind of resource that the binding provides.

workflow_name: str

Name of the Workflow to bind to.

class_name: Optional[str]

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

script_name: Optional[str]

Script name that contains the Workflow. If not provided, defaults to this script name.

class BindingWorkersBindingKindWasmModule:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the WebAssembly module content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["wasm_module"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCService:
name: str

A JavaScript variable name for the binding.

service_id: str

Identifier of the VPC service to bind to.

type: Literal["vpc_service"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCNetwork:
name: str

A JavaScript variable name for the binding.

type: Literal["vpc_network"]

The kind of resource that the binding provides.

network_id: Optional[str]

Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.

tunnel_id: Optional[str]

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

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.

limits: Optional[Limits]

Resource limits enforced at runtime.

cpu_ms: int

CPU time limit in milliseconds.

main_module: Optional[str]

The name of the main module in the modules array (e.g. the name of the module that exports a fetch handler).

migrations: Optional[Migrations]

Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed.

One of the following:
class SingleStepMigration:

A single set of migrations to apply.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
class MigrationsWorkersMultipleStepMigrations:
new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

steps: Optional[List[MigrationStep]]

Migrations to apply in order.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
modules: Optional[List[Module]]

Code, sourcemaps, and other content used at runtime.

This includes _headers and _redirects files used to configure Static Assets. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain.

content_base64: str

The base64-encoded module content.

formatbyte
content_type: str

The content type of the module.

name: str

The name of the module.

placement: Optional[Placement]

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

One of the following:
class PlacementMode:
mode: Literal["smart"]

Enables Smart Placement.

class PlacementRegion:
region: str

Cloud region for targeted placement in format 'provider:region'.

class PlacementHostname:
hostname: str

HTTP hostname for targeted placement.

class PlacementHost:
host: str

TCP host and port for targeted placement.

class PlacementUnionMember4:
mode: Literal["targeted"]

Targeted placement mode.

region: str

Cloud region for targeted placement in format 'provider:region'.

class PlacementUnionMember5:
hostname: str

HTTP hostname for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

class PlacementUnionMember6:
host: str

TCP host and port for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

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.

source: Optional[str]

The client used to create the version.

startup_time_ms: Optional[int]

Time in milliseconds spent on Worker startup.

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

Usage model for the version.

One of the following:
"standard"
"bundled"
"unbound"
class VersionDeleteResponse:
errors: List[Error]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[ErrorSource]
pointer: Optional[str]
messages: List[Message]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[MessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

WorkersRoutes

List Routes
workers.routes.list(RouteListParams**kwargs) -> SyncSinglePage[RouteListResponse]
GET/zones/{zone_id}/workers/routes
Get Route
workers.routes.get(strroute_id, RouteGetParams**kwargs) -> RouteGetResponse
GET/zones/{zone_id}/workers/routes/{route_id}
Create Route
workers.routes.create(RouteCreateParams**kwargs) -> RouteCreateResponse
POST/zones/{zone_id}/workers/routes
Update Route
workers.routes.update(strroute_id, RouteUpdateParams**kwargs) -> RouteUpdateResponse
PUT/zones/{zone_id}/workers/routes/{route_id}
Delete Route
workers.routes.delete(strroute_id, RouteDeleteParams**kwargs) -> RouteDeleteResponse
DELETE/zones/{zone_id}/workers/routes/{route_id}
ModelsExpand Collapse
class RouteListResponse:
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.

class RouteGetResponse:
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.

class RouteCreateResponse:
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.

class RouteUpdateResponse:
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.

class RouteDeleteResponse:
id: Optional[str]

Identifier.

maxLength32

WorkersAssets

WorkersAssetsUpload

Upload Assets
workers.assets.upload.create(UploadCreateParams**kwargs) -> UploadCreateResponse
POST/accounts/{account_id}/workers/assets/upload
ModelsExpand Collapse
class UploadCreateResponse:
jwt: Optional[str]

A "completion" JWT which can be redeemed when creating a Worker version.

WorkersScripts

List Workers
workers.scripts.list(ScriptListParams**kwargs) -> SyncSinglePage[ScriptListResponse]
GET/accounts/{account_id}/workers/scripts
Search Workers
workers.scripts.search(ScriptSearchParams**kwargs) -> ScriptSearchResponse
GET/accounts/{account_id}/workers/scripts-search
Download Worker
workers.scripts.get(strscript_name, ScriptGetParams**kwargs) -> ScriptGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}
Upload Worker Module
workers.scripts.update(strscript_name, ScriptUpdateParams**kwargs) -> ScriptUpdateResponse
PUT/accounts/{account_id}/workers/scripts/{script_name}
Delete Worker
workers.scripts.delete(strscript_name, ScriptDeleteParams**kwargs) -> object
DELETE/accounts/{account_id}/workers/scripts/{script_name}
ModelsExpand Collapse
class Script:
id: Optional[str]

The name used to identify the script.

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.

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"]

Enables Smart 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 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"]]

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

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

Status of Smart Placement.

One of the following:
"SUCCESS"
"UNSUPPORTED_APPLICATION"
"INSUFFICIENT_INVOCATIONS"
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"
class ScriptSetting:
logpush: Optional[bool]

Whether Logpush is turned on for the Worker.

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.

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.

class ScriptListResponse:
id: Optional[str]

The name used to identify the script.

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.

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"]

Enables Smart 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 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[ScriptSearchResponseItem]
id: str

Identifier.

maxLength32
created_on: datetime

When the script was created.

formatdate-time
modified_on: datetime

When the script was last modified.

formatdate-time
script_name: str

Name of the script, used in URLs and route configuration.

environment_is_default: Optional[bool]

Whether the environment is the default environment.

environment_name: Optional[str]

Name of the environment.

service_name: Optional[str]

Name of the service.

str
class ScriptUpdateResponse:
startup_time_ms: int
id: Optional[str]

The name used to identify the script.

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

The entry point for the script.

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.

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"]

Enables Smart 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 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"
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"

WorkersScriptsAssets

WorkersScriptsAssetsUpload

Create Assets Upload Session
workers.scripts.assets.upload.create(strscript_name, UploadCreateParams**kwargs) -> UploadCreateResponse
POST/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session
ModelsExpand Collapse
class UploadCreateResponse:
buckets: Optional[List[List[str]]]

The requests to make to upload assets.

jwt: Optional[str]

A JWT to use as authentication for uploading assets.

WorkersScriptsSubdomain

Get Worker subdomain
workers.scripts.subdomain.get(strscript_name, SubdomainGetParams**kwargs) -> SubdomainGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/subdomain
Post Worker subdomain
workers.scripts.subdomain.create(strscript_name, SubdomainCreateParams**kwargs) -> SubdomainCreateResponse
POST/accounts/{account_id}/workers/scripts/{script_name}/subdomain
Delete Worker subdomain
workers.scripts.subdomain.delete(strscript_name, SubdomainDeleteParams**kwargs) -> SubdomainDeleteResponse
DELETE/accounts/{account_id}/workers/scripts/{script_name}/subdomain
ModelsExpand Collapse
class SubdomainGetResponse:
enabled: bool

Whether the Worker is available on the workers.dev subdomain.

previews_enabled: bool

Whether the Worker's Preview URLs are available on the workers.dev subdomain.

class SubdomainCreateResponse:
enabled: bool

Whether the Worker is available on the workers.dev subdomain.

previews_enabled: bool

Whether the Worker's Preview URLs are available on the workers.dev subdomain.

class SubdomainDeleteResponse:
enabled: bool

Whether the Worker is available on the workers.dev subdomain.

previews_enabled: bool

Whether the Worker's Preview URLs are available on the workers.dev subdomain.

WorkersScriptsSchedules

Get Cron Triggers
workers.scripts.schedules.get(strscript_name, ScheduleGetParams**kwargs) -> ScheduleGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/schedules
Update Cron Triggers
workers.scripts.schedules.update(strscript_name, ScheduleUpdateParams**kwargs) -> ScheduleUpdateResponse
PUT/accounts/{account_id}/workers/scripts/{script_name}/schedules
ModelsExpand Collapse
class ScheduleGetResponse:
schedules: List[Schedule]
cron: str
created_on: Optional[str]
modified_on: Optional[str]
class ScheduleUpdateResponse:
schedules: List[Schedule]
cron: str
created_on: Optional[str]
modified_on: Optional[str]

WorkersScriptsTail

List Tails
workers.scripts.tail.get(strscript_name, TailGetParams**kwargs) -> TailGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/tails
Start Tail
workers.scripts.tail.create(strscript_name, TailCreateParams**kwargs) -> TailCreateResponse
POST/accounts/{account_id}/workers/scripts/{script_name}/tails
Delete Tail
workers.scripts.tail.delete(strid, TailDeleteParams**kwargs) -> TailDeleteResponse
DELETE/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}
ModelsExpand Collapse
class ConsumerScript:

A reference to a script 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.

class TailGetResponse:
id: str

Identifier.

maxLength32
expires_at: str
url: str
class TailCreateResponse:
id: str

Identifier.

maxLength32
expires_at: str
url: str
class TailDeleteResponse:
errors: List[Error]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[ErrorSource]
pointer: Optional[str]
messages: List[Message]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[MessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

WorkersScriptsContent

Get script content
workers.scripts.content.get(strscript_name, ContentGetParams**kwargs) -> BinaryResponseContent
GET/accounts/{account_id}/workers/scripts/{script_name}/content/v2
Put script content
workers.scripts.content.update(strscript_name, ContentUpdateParams**kwargs) -> Script
PUT/accounts/{account_id}/workers/scripts/{script_name}/content

WorkersScriptsSettings

Get Script Settings
workers.scripts.settings.get(strscript_name, SettingGetParams**kwargs) -> ScriptSetting
GET/accounts/{account_id}/workers/scripts/{script_name}/script-settings
Patch Script Settings
workers.scripts.settings.edit(strscript_name, SettingEditParams**kwargs) -> ScriptSetting
PATCH/accounts/{account_id}/workers/scripts/{script_name}/script-settings

WorkersScriptsDeployments

List Deployments
workers.scripts.deployments.list(strscript_name, DeploymentListParams**kwargs) -> DeploymentListResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/deployments
Create Deployment
workers.scripts.deployments.create(strscript_name, DeploymentCreateParams**kwargs) -> Deployment
POST/accounts/{account_id}/workers/scripts/{script_name}/deployments
Get Deployment
workers.scripts.deployments.get(strdeployment_id, DeploymentGetParams**kwargs) -> Deployment
GET/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}
Delete Deployment
workers.scripts.deployments.delete(strdeployment_id, DeploymentDeleteParams**kwargs) -> DeploymentDeleteResponse
DELETE/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}
ModelsExpand Collapse
class Deployment:
id: str
formatuuid
created_on: datetime
formatdate-time
source: str
strategy: Literal["percentage"]
versions: List[Version]
percentage: float
maximum100
minimum0.01
version_id: str
formatuuid
annotations: Optional[Annotations]
workers_message: Optional[str]

Human-readable message about the deployment. Truncated to 100 bytes.

maxLength100
workers_triggered_by: Optional[str]

Operation that triggered the creation of the deployment.

author_email: Optional[str]
formatemail
class DeploymentListResponse:
deployments: List[Deployment]
id: str
formatuuid
created_on: datetime
formatdate-time
source: str
strategy: Literal["percentage"]
versions: List[Version]
percentage: float
maximum100
minimum0.01
version_id: str
formatuuid
annotations: Optional[Annotations]
workers_message: Optional[str]

Human-readable message about the deployment. Truncated to 100 bytes.

maxLength100
workers_triggered_by: Optional[str]

Operation that triggered the creation of the deployment.

author_email: Optional[str]
formatemail
class DeploymentDeleteResponse:
errors: List[Error]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[ErrorSource]
pointer: Optional[str]
messages: List[Message]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[MessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

WorkersScriptsVersions

List Versions
workers.scripts.versions.list(strscript_name, VersionListParams**kwargs) -> SyncV4PagePagination[VersionListResponse]
GET/accounts/{account_id}/workers/scripts/{script_name}/versions
Get Version Detail
workers.scripts.versions.get(strversion_id, VersionGetParams**kwargs) -> VersionGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}
Upload Version
workers.scripts.versions.create(strscript_name, VersionCreateParams**kwargs) -> VersionCreateResponse
POST/accounts/{account_id}/workers/scripts/{script_name}/versions
ModelsExpand Collapse
class VersionListResponse:
id: Optional[str]

Unique identifier for the version.

metadata: Optional[Metadata]
author_email: Optional[str]

Email of the user who created the version.

author_id: Optional[str]

Identifier of the user who created the version.

created_on: Optional[str]

When the version was created.

has_preview: Optional[bool]

Whether the version can be previewed.

modified_on: Optional[str]

When the version was last modified.

source: Optional[Literal["unknown", "api", "wrangler", 7 more]]

The source of the version upload.

One of the following:
"unknown"
"api"
"wrangler"
"terraform"
"dash"
"dash_template"
"integration"
"quick_editor"
"playground"
"workersci"
number: Optional[float]

Sequential version number.

class VersionGetResponse:
resources: Resources
bindings: Optional[List[ResourcesBinding]]

List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.

One of the following:
class ResourcesBindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAISearch:
instance_name: str

The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.

name: str

A JavaScript variable name for the binding.

type: Literal["ai_search"]

The kind of resource that the binding provides.

namespace: Optional[str]

The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.

class ResourcesBindingWorkersBindingKindAISearchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.

type: Literal["ai_search_namespace"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAnalyticsEngine:
dataset: str

The name of the dataset to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["analytics_engine"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindD1:
id: str

Identifier of the D1 database to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["d1"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindDataBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the data content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["data_blob"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindDispatchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The name of the dispatch namespace.

type: Literal["dispatch_namespace"]

The kind of resource that the binding provides.

outbound: Optional[ResourcesBindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[ResourcesBindingWorkersBindingKindDispatchNamespaceOutboundParam]]

Pass information from the Dispatch Worker to the Outbound Worker through the parameters.

name: str

Name of the parameter.

worker: Optional[ResourcesBindingWorkersBindingKindDispatchNamespaceOutboundWorker]

Outbound worker.

entrypoint: Optional[str]

Entrypoint to invoke on the outbound worker.

environment: Optional[str]

Environment of the outbound worker.

service: Optional[str]

Name of the outbound worker.

class ResourcesBindingWorkersBindingKindDurableObjectNamespace:
name: str

A JavaScript variable name for the binding.

type: Literal["durable_object_namespace"]

The kind of resource that the binding provides.

class_name: Optional[str]

The exported class name of the Durable Object.

dispatch_namespace: Optional[str]

The dispatch namespace the Durable Object script belongs to.

environment: Optional[str]

The environment of the script_name to bind to.

namespace_id: Optional[str]

Namespace identifier tag.

maxLength32
script_name: Optional[str]

The script where the Durable Object is defined, if it is external to this Worker.

class ResourcesBindingWorkersBindingKindHyperdrive:
id: str

Identifier of the Hyperdrive connection to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["hyperdrive"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindInherit:
name: str

The name of the inherited binding.

type: Literal["inherit"]

The kind of resource that the binding provides.

old_name: Optional[str]

The old name of the inherited binding. If set, the binding will be renamed from old_name to name in the new version. If not set, the binding will keep the same name between versions.

version_id: Optional[str]

Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.

class ResourcesBindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindJson:
json: object

JSON data to use.

name: str

A JavaScript variable name for the binding.

type: Literal["json"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindKVNamespace:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Namespace identifier tag.

maxLength32
type: Literal["kv_namespace"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindMTLSCertificate:
certificate_id: str

Identifier of the certificate to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["mtls_certificate"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindPlainText:
name: str

A JavaScript variable name for the binding.

text: str

The text value to use.

type: Literal["plain_text"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindPipelines:
name: str

A JavaScript variable name for the binding.

pipeline: str

Name of the Pipeline to bind to.

type: Literal["pipelines"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindQueue:
name: str

A JavaScript variable name for the binding.

queue_name: str

Name of the Queue to bind to.

type: Literal["queue"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: ResourcesBindingWorkersBindingKindRatelimitSimple

The rate limit configuration.

limit: float

The limit (requests per period).

period: int

The period in seconds.

type: Literal["ratelimit"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindR2Bucket:
bucket_name: str

R2 bucket to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["r2_bucket"]

The kind of resource that the binding provides.

jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]

The jurisdiction of the R2 bucket.

One of the following:
"eu"
"fedramp"
"fedramp-high"
class ResourcesBindingWorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSendEmail:
name: str

A JavaScript variable name for the binding.

type: Literal["send_email"]

The kind of resource that the binding provides.

allowed_destination_addresses: Optional[List[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[List[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class ResourcesBindingWorkersBindingKindService:
name: str

A JavaScript variable name for the binding.

service: str

Name of Worker to bind to.

type: Literal["service"]

The kind of resource that the binding provides.

entrypoint: Optional[str]

Entrypoint to invoke on the target Worker.

environment: Optional[str]

Optional environment if the Worker utilizes one.

class ResourcesBindingWorkersBindingKindTextBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the text content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["text_blob"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVectorize:
index_name: str

Name of the Vectorize index to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["vectorize"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSecretsStoreSecret:
name: str

A JavaScript variable name for the binding.

secret_name: str

Name of the secret in the store.

store_id: str

ID of the store containing the secret.

type: Literal["secrets_store_secret"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

class ResourcesBindingWorkersBindingKindWorkflow:
name: str

A JavaScript variable name for the binding.

type: Literal["workflow"]

The kind of resource that the binding provides.

workflow_name: str

Name of the Workflow to bind to.

class_name: Optional[str]

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

script_name: Optional[str]

Script name that contains the Workflow. If not provided, defaults to this script name.

class ResourcesBindingWorkersBindingKindWasmModule:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the WebAssembly module content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["wasm_module"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVPCService:
name: str

A JavaScript variable name for the binding.

service_id: str

Identifier of the VPC service to bind to.

type: Literal["vpc_service"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVPCNetwork:
name: str

A JavaScript variable name for the binding.

type: Literal["vpc_network"]

The kind of resource that the binding provides.

network_id: Optional[str]

Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.

tunnel_id: Optional[str]

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

script: Optional[ResourcesScript]
etag: Optional[str]

Hashed script content

handlers: Optional[List[str]]

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

last_deployed_from: Optional[str]

The client most recently used to deploy this Worker.

named_handlers: Optional[List[ResourcesScriptNamedHandler]]

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 exported class or entrypoint.

script_runtime: Optional[ResourcesScriptRuntime]

Runtime configuration for the Worker.

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.

limits: Optional[ResourcesScriptRuntimeLimits]

Resource limits for the Worker.

cpu_ms: Optional[int]

The amount of CPU time this Worker can use in milliseconds.

migration_tag: Optional[str]

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

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

Usage model for the Worker invocations.

One of the following:
"bundled"
"unbound"
"standard"
id: Optional[str]

Unique identifier for the version.

metadata: Optional[Metadata]
author_email: Optional[str]

Email of the user who created the version.

author_id: Optional[str]

Identifier of the user who created the version.

created_on: Optional[str]

When the version was created.

has_preview: Optional[bool]

Whether the version can be previewed.

modified_on: Optional[str]

When the version was last modified.

source: Optional[Literal["unknown", "api", "wrangler", 7 more]]

The source of the version upload.

One of the following:
"unknown"
"api"
"wrangler"
"terraform"
"dash"
"dash_template"
"integration"
"quick_editor"
"playground"
"workersci"
number: Optional[float]

Sequential version number.

class VersionCreateResponse:
resources: Resources
bindings: Optional[List[ResourcesBinding]]

List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.

One of the following:
class ResourcesBindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAISearch:
instance_name: str

The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.

name: str

A JavaScript variable name for the binding.

type: Literal["ai_search"]

The kind of resource that the binding provides.

namespace: Optional[str]

The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.

class ResourcesBindingWorkersBindingKindAISearchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.

type: Literal["ai_search_namespace"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAnalyticsEngine:
dataset: str

The name of the dataset to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["analytics_engine"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindD1:
id: str

Identifier of the D1 database to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["d1"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindDataBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the data content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["data_blob"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindDispatchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The name of the dispatch namespace.

type: Literal["dispatch_namespace"]

The kind of resource that the binding provides.

outbound: Optional[ResourcesBindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[ResourcesBindingWorkersBindingKindDispatchNamespaceOutboundParam]]

Pass information from the Dispatch Worker to the Outbound Worker through the parameters.

name: str

Name of the parameter.

worker: Optional[ResourcesBindingWorkersBindingKindDispatchNamespaceOutboundWorker]

Outbound worker.

entrypoint: Optional[str]

Entrypoint to invoke on the outbound worker.

environment: Optional[str]

Environment of the outbound worker.

service: Optional[str]

Name of the outbound worker.

class ResourcesBindingWorkersBindingKindDurableObjectNamespace:
name: str

A JavaScript variable name for the binding.

type: Literal["durable_object_namespace"]

The kind of resource that the binding provides.

class_name: Optional[str]

The exported class name of the Durable Object.

dispatch_namespace: Optional[str]

The dispatch namespace the Durable Object script belongs to.

environment: Optional[str]

The environment of the script_name to bind to.

namespace_id: Optional[str]

Namespace identifier tag.

maxLength32
script_name: Optional[str]

The script where the Durable Object is defined, if it is external to this Worker.

class ResourcesBindingWorkersBindingKindHyperdrive:
id: str

Identifier of the Hyperdrive connection to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["hyperdrive"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindInherit:
name: str

The name of the inherited binding.

type: Literal["inherit"]

The kind of resource that the binding provides.

old_name: Optional[str]

The old name of the inherited binding. If set, the binding will be renamed from old_name to name in the new version. If not set, the binding will keep the same name between versions.

version_id: Optional[str]

Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.

class ResourcesBindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindJson:
json: object

JSON data to use.

name: str

A JavaScript variable name for the binding.

type: Literal["json"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindKVNamespace:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Namespace identifier tag.

maxLength32
type: Literal["kv_namespace"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindMTLSCertificate:
certificate_id: str

Identifier of the certificate to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["mtls_certificate"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindPlainText:
name: str

A JavaScript variable name for the binding.

text: str

The text value to use.

type: Literal["plain_text"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindPipelines:
name: str

A JavaScript variable name for the binding.

pipeline: str

Name of the Pipeline to bind to.

type: Literal["pipelines"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindQueue:
name: str

A JavaScript variable name for the binding.

queue_name: str

Name of the Queue to bind to.

type: Literal["queue"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: ResourcesBindingWorkersBindingKindRatelimitSimple

The rate limit configuration.

limit: float

The limit (requests per period).

period: int

The period in seconds.

type: Literal["ratelimit"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindR2Bucket:
bucket_name: str

R2 bucket to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["r2_bucket"]

The kind of resource that the binding provides.

jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]

The jurisdiction of the R2 bucket.

One of the following:
"eu"
"fedramp"
"fedramp-high"
class ResourcesBindingWorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSendEmail:
name: str

A JavaScript variable name for the binding.

type: Literal["send_email"]

The kind of resource that the binding provides.

allowed_destination_addresses: Optional[List[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[List[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class ResourcesBindingWorkersBindingKindService:
name: str

A JavaScript variable name for the binding.

service: str

Name of Worker to bind to.

type: Literal["service"]

The kind of resource that the binding provides.

entrypoint: Optional[str]

Entrypoint to invoke on the target Worker.

environment: Optional[str]

Optional environment if the Worker utilizes one.

class ResourcesBindingWorkersBindingKindTextBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the text content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["text_blob"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVectorize:
index_name: str

Name of the Vectorize index to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["vectorize"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSecretsStoreSecret:
name: str

A JavaScript variable name for the binding.

secret_name: str

Name of the secret in the store.

store_id: str

ID of the store containing the secret.

type: Literal["secrets_store_secret"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

class ResourcesBindingWorkersBindingKindWorkflow:
name: str

A JavaScript variable name for the binding.

type: Literal["workflow"]

The kind of resource that the binding provides.

workflow_name: str

Name of the Workflow to bind to.

class_name: Optional[str]

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

script_name: Optional[str]

Script name that contains the Workflow. If not provided, defaults to this script name.

class ResourcesBindingWorkersBindingKindWasmModule:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the WebAssembly module content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["wasm_module"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVPCService:
name: str

A JavaScript variable name for the binding.

service_id: str

Identifier of the VPC service to bind to.

type: Literal["vpc_service"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindVPCNetwork:
name: str

A JavaScript variable name for the binding.

type: Literal["vpc_network"]

The kind of resource that the binding provides.

network_id: Optional[str]

Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.

tunnel_id: Optional[str]

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

script: Optional[ResourcesScript]
etag: Optional[str]

Hashed script content

handlers: Optional[List[str]]

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

last_deployed_from: Optional[str]

The client most recently used to deploy this Worker.

named_handlers: Optional[List[ResourcesScriptNamedHandler]]

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 exported class or entrypoint.

script_runtime: Optional[ResourcesScriptRuntime]

Runtime configuration for the Worker.

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.

limits: Optional[ResourcesScriptRuntimeLimits]

Resource limits for the Worker.

cpu_ms: Optional[int]

The amount of CPU time this Worker can use in milliseconds.

migration_tag: Optional[str]

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

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

Usage model for the Worker invocations.

One of the following:
"bundled"
"unbound"
"standard"
id: Optional[str]

Unique identifier for the version.

metadata: Optional[Metadata]
author_email: Optional[str]

Email of the user who created the version.

author_id: Optional[str]

Identifier of the user who created the version.

created_on: Optional[str]

When the version was created.

has_preview: Optional[bool]

Whether the version can be previewed.

modified_on: Optional[str]

When the version was last modified.

source: Optional[Literal["unknown", "api", "wrangler", 7 more]]

The source of the version upload.

One of the following:
"unknown"
"api"
"wrangler"
"terraform"
"dash"
"dash_template"
"integration"
"quick_editor"
"playground"
"workersci"
number: Optional[float]

Sequential version number.

startup_time_ms: Optional[int]

Time in milliseconds spent on Worker startup.

WorkersScriptsSecrets

List script secrets
workers.scripts.secrets.list(strscript_name, SecretListParams**kwargs) -> SyncSinglePage[SecretListResponse]
GET/accounts/{account_id}/workers/scripts/{script_name}/secrets
Get secret binding
workers.scripts.secrets.get(strsecret_name, SecretGetParams**kwargs) -> SecretGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}
Add script secret
workers.scripts.secrets.update(strscript_name, SecretUpdateParams**kwargs) -> SecretUpdateResponse
PUT/accounts/{account_id}/workers/scripts/{script_name}/secrets
Delete script secret
workers.scripts.secrets.delete(strsecret_name, SecretDeleteParams**kwargs) -> object
DELETE/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}
ModelsExpand Collapse

A secret value accessible through a binding.

One of the following:
class WorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class WorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

A secret value accessible through a binding.

One of the following:
class WorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class WorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

A secret value accessible through a binding.

One of the following:
class WorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class WorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

WorkersScriptsScript And Version Settings

Get Settings
workers.scripts.script_and_version_settings.get(strscript_name, ScriptAndVersionSettingGetParams**kwargs) -> ScriptAndVersionSettingGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/settings
Patch Settings
workers.scripts.script_and_version_settings.edit(strscript_name, ScriptAndVersionSettingEditParams**kwargs) -> ScriptAndVersionSettingEditResponse
PATCH/accounts/{account_id}/workers/scripts/{script_name}/settings
ModelsExpand Collapse
class ScriptAndVersionSettingGetResponse:
annotations: Optional[Annotations]

Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.

workers_message: Optional[str]

Human-readable message about the version.

maxLength100
workers_tag: Optional[str]

User-provided identifier for the version.

maxLength25
workers_triggered_by: Optional[str]

Operation that triggered the creation of the version. This is read-only and set by the server.

bindings: Optional[List[Binding]]

List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.

One of the following:
class BindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAISearch:
instance_name: str

The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.

name: str

A JavaScript variable name for the binding.

type: Literal["ai_search"]

The kind of resource that the binding provides.

namespace: Optional[str]

The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.

class BindingWorkersBindingKindAISearchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.

type: Literal["ai_search_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAnalyticsEngine:
dataset: str

The name of the dataset to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["analytics_engine"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindD1:
id: str

Identifier of the D1 database to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["d1"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDataBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the data content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["data_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDispatchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The name of the dispatch namespace.

type: Literal["dispatch_namespace"]

The kind of resource that the binding provides.

outbound: Optional[BindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[BindingWorkersBindingKindDispatchNamespaceOutboundParam]]

Pass information from the Dispatch Worker to the Outbound Worker through the parameters.

name: str

Name of the parameter.

worker: Optional[BindingWorkersBindingKindDispatchNamespaceOutboundWorker]

Outbound worker.

entrypoint: Optional[str]

Entrypoint to invoke on the outbound worker.

environment: Optional[str]

Environment of the outbound worker.

service: Optional[str]

Name of the outbound worker.

class BindingWorkersBindingKindDurableObjectNamespace:
name: str

A JavaScript variable name for the binding.

type: Literal["durable_object_namespace"]

The kind of resource that the binding provides.

class_name: Optional[str]

The exported class name of the Durable Object.

dispatch_namespace: Optional[str]

The dispatch namespace the Durable Object script belongs to.

environment: Optional[str]

The environment of the script_name to bind to.

namespace_id: Optional[str]

Namespace identifier tag.

maxLength32
script_name: Optional[str]

The script where the Durable Object is defined, if it is external to this Worker.

class BindingWorkersBindingKindHyperdrive:
id: str

Identifier of the Hyperdrive connection to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["hyperdrive"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindInherit:
name: str

The name of the inherited binding.

type: Literal["inherit"]

The kind of resource that the binding provides.

old_name: Optional[str]

The old name of the inherited binding. If set, the binding will be renamed from old_name to name in the new version. If not set, the binding will keep the same name between versions.

version_id: Optional[str]

Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.

class BindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindJson:
json: object

JSON data to use.

name: str

A JavaScript variable name for the binding.

type: Literal["json"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindKVNamespace:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Namespace identifier tag.

maxLength32
type: Literal["kv_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMTLSCertificate:
certificate_id: str

Identifier of the certificate to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["mtls_certificate"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPlainText:
name: str

A JavaScript variable name for the binding.

text: str

The text value to use.

type: Literal["plain_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPipelines:
name: str

A JavaScript variable name for the binding.

pipeline: str

Name of the Pipeline to bind to.

type: Literal["pipelines"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindQueue:
name: str

A JavaScript variable name for the binding.

queue_name: str

Name of the Queue to bind to.

type: Literal["queue"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: BindingWorkersBindingKindRatelimitSimple

The rate limit configuration.

limit: float

The limit (requests per period).

period: int

The period in seconds.

type: Literal["ratelimit"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindR2Bucket:
bucket_name: str

R2 bucket to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["r2_bucket"]

The kind of resource that the binding provides.

jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]

The jurisdiction of the R2 bucket.

One of the following:
"eu"
"fedramp"
"fedramp-high"
class BindingWorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSendEmail:
name: str

A JavaScript variable name for the binding.

type: Literal["send_email"]

The kind of resource that the binding provides.

allowed_destination_addresses: Optional[List[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[List[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class BindingWorkersBindingKindService:
name: str

A JavaScript variable name for the binding.

service: str

Name of Worker to bind to.

type: Literal["service"]

The kind of resource that the binding provides.

entrypoint: Optional[str]

Entrypoint to invoke on the target Worker.

environment: Optional[str]

Optional environment if the Worker utilizes one.

class BindingWorkersBindingKindTextBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the text content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["text_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVectorize:
index_name: str

Name of the Vectorize index to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["vectorize"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretsStoreSecret:
name: str

A JavaScript variable name for the binding.

secret_name: str

Name of the secret in the store.

store_id: str

ID of the store containing the secret.

type: Literal["secrets_store_secret"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

class BindingWorkersBindingKindWorkflow:
name: str

A JavaScript variable name for the binding.

type: Literal["workflow"]

The kind of resource that the binding provides.

workflow_name: str

Name of the Workflow to bind to.

class_name: Optional[str]

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

script_name: Optional[str]

Script name that contains the Workflow. If not provided, defaults to this script name.

class BindingWorkersBindingKindWasmModule:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the WebAssembly module content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["wasm_module"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCService:
name: str

A JavaScript variable name for the binding.

service_id: str

Identifier of the VPC service to bind to.

type: Literal["vpc_service"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCNetwork:
name: str

A JavaScript variable name for the binding.

type: Literal["vpc_network"]

The kind of resource that the binding provides.

network_id: Optional[str]

Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.

tunnel_id: Optional[str]

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

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.

limits: Optional[Limits]

Limits to apply for this Worker.

cpu_ms: Optional[int]

The amount of CPU time this Worker can use in milliseconds.

logpush: Optional[bool]

Whether Logpush is turned on for the Worker.

migrations: Optional[Migrations]

Migrations to apply for Durable Objects associated with this Worker.

One of the following:
class SingleStepMigration:

A single set of migrations to apply.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
class MigrationsWorkersMultipleStepMigrations:
new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

steps: Optional[List[MigrationStep]]

Migrations to apply in order.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
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.

placement: Optional[Placement]

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

One of the following:
class PlacementMode:
mode: Literal["smart"]

Enables Smart Placement.

class PlacementRegion:
region: str

Cloud region for targeted placement in format 'provider:region'.

class PlacementHostname:
hostname: str

HTTP hostname for targeted placement.

class PlacementHost:
host: str

TCP host and port for targeted placement.

class PlacementUnionMember4:
mode: Literal["targeted"]

Targeted placement mode.

region: str

Cloud region for targeted placement in format 'provider:region'.

class PlacementUnionMember5:
hostname: str

HTTP hostname for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

class PlacementUnionMember6:
host: str

TCP host and port for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

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.

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"
class ScriptAndVersionSettingEditResponse:
annotations: Optional[Annotations]

Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.

workers_message: Optional[str]

Human-readable message about the version.

maxLength100
workers_tag: Optional[str]

User-provided identifier for the version.

maxLength25
workers_triggered_by: Optional[str]

Operation that triggered the creation of the version. This is read-only and set by the server.

bindings: Optional[List[Binding]]

List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.

One of the following:
class BindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAISearch:
instance_name: str

The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.

name: str

A JavaScript variable name for the binding.

type: Literal["ai_search"]

The kind of resource that the binding provides.

namespace: Optional[str]

The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.

class BindingWorkersBindingKindAISearchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.

type: Literal["ai_search_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAnalyticsEngine:
dataset: str

The name of the dataset to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["analytics_engine"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindD1:
id: str

Identifier of the D1 database to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["d1"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDataBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the data content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["data_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDispatchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The name of the dispatch namespace.

type: Literal["dispatch_namespace"]

The kind of resource that the binding provides.

outbound: Optional[BindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[BindingWorkersBindingKindDispatchNamespaceOutboundParam]]

Pass information from the Dispatch Worker to the Outbound Worker through the parameters.

name: str

Name of the parameter.

worker: Optional[BindingWorkersBindingKindDispatchNamespaceOutboundWorker]

Outbound worker.

entrypoint: Optional[str]

Entrypoint to invoke on the outbound worker.

environment: Optional[str]

Environment of the outbound worker.

service: Optional[str]

Name of the outbound worker.

class BindingWorkersBindingKindDurableObjectNamespace:
name: str

A JavaScript variable name for the binding.

type: Literal["durable_object_namespace"]

The kind of resource that the binding provides.

class_name: Optional[str]

The exported class name of the Durable Object.

dispatch_namespace: Optional[str]

The dispatch namespace the Durable Object script belongs to.

environment: Optional[str]

The environment of the script_name to bind to.

namespace_id: Optional[str]

Namespace identifier tag.

maxLength32
script_name: Optional[str]

The script where the Durable Object is defined, if it is external to this Worker.

class BindingWorkersBindingKindHyperdrive:
id: str

Identifier of the Hyperdrive connection to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["hyperdrive"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindInherit:
name: str

The name of the inherited binding.

type: Literal["inherit"]

The kind of resource that the binding provides.

old_name: Optional[str]

The old name of the inherited binding. If set, the binding will be renamed from old_name to name in the new version. If not set, the binding will keep the same name between versions.

version_id: Optional[str]

Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.

class BindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindJson:
json: object

JSON data to use.

name: str

A JavaScript variable name for the binding.

type: Literal["json"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindKVNamespace:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Namespace identifier tag.

maxLength32
type: Literal["kv_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMTLSCertificate:
certificate_id: str

Identifier of the certificate to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["mtls_certificate"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPlainText:
name: str

A JavaScript variable name for the binding.

text: str

The text value to use.

type: Literal["plain_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPipelines:
name: str

A JavaScript variable name for the binding.

pipeline: str

Name of the Pipeline to bind to.

type: Literal["pipelines"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindQueue:
name: str

A JavaScript variable name for the binding.

queue_name: str

Name of the Queue to bind to.

type: Literal["queue"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: BindingWorkersBindingKindRatelimitSimple

The rate limit configuration.

limit: float

The limit (requests per period).

period: int

The period in seconds.

type: Literal["ratelimit"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindR2Bucket:
bucket_name: str

R2 bucket to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["r2_bucket"]

The kind of resource that the binding provides.

jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]

The jurisdiction of the R2 bucket.

One of the following:
"eu"
"fedramp"
"fedramp-high"
class BindingWorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSendEmail:
name: str

A JavaScript variable name for the binding.

type: Literal["send_email"]

The kind of resource that the binding provides.

allowed_destination_addresses: Optional[List[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[List[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class BindingWorkersBindingKindService:
name: str

A JavaScript variable name for the binding.

service: str

Name of Worker to bind to.

type: Literal["service"]

The kind of resource that the binding provides.

entrypoint: Optional[str]

Entrypoint to invoke on the target Worker.

environment: Optional[str]

Optional environment if the Worker utilizes one.

class BindingWorkersBindingKindTextBlob:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the text content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["text_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVectorize:
index_name: str

Name of the Vectorize index to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["vectorize"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretsStoreSecret:
name: str

A JavaScript variable name for the binding.

secret_name: str

Name of the secret in the store.

store_id: str

ID of the store containing the secret.

type: Literal["secrets_store_secret"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

key_jwk: Optional[object]

Key data in JSON Web Key format. Required if format is "jwk".

class BindingWorkersBindingKindWorkflow:
name: str

A JavaScript variable name for the binding.

type: Literal["workflow"]

The kind of resource that the binding provides.

workflow_name: str

Name of the Workflow to bind to.

class_name: Optional[str]

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

script_name: Optional[str]

Script name that contains the Workflow. If not provided, defaults to this script name.

class BindingWorkersBindingKindWasmModule:
name: str

A JavaScript variable name for the binding.

part: str

The name of the file containing the WebAssembly module content. Only accepted for service worker syntax Workers.

Deprecatedtype: Literal["wasm_module"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCService:
name: str

A JavaScript variable name for the binding.

service_id: str

Identifier of the VPC service to bind to.

type: Literal["vpc_service"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCNetwork:
name: str

A JavaScript variable name for the binding.

type: Literal["vpc_network"]

The kind of resource that the binding provides.

network_id: Optional[str]

Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.

tunnel_id: Optional[str]

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

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.

limits: Optional[Limits]

Limits to apply for this Worker.

cpu_ms: Optional[int]

The amount of CPU time this Worker can use in milliseconds.

logpush: Optional[bool]

Whether Logpush is turned on for the Worker.

migrations: Optional[Migrations]

Migrations to apply for Durable Objects associated with this Worker.

One of the following:
class SingleStepMigration:

A single set of migrations to apply.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
class MigrationsWorkersMultipleStepMigrations:
new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

steps: Optional[List[MigrationStep]]

Migrations to apply in order.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
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.

placement: Optional[Placement]

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

One of the following:
class PlacementMode:
mode: Literal["smart"]

Enables Smart Placement.

class PlacementRegion:
region: str

Cloud region for targeted placement in format 'provider:region'.

class PlacementHostname:
hostname: str

HTTP hostname for targeted placement.

class PlacementHost:
host: str

TCP host and port for targeted placement.

class PlacementUnionMember4:
mode: Literal["targeted"]

Targeted placement mode.

region: str

Cloud region for targeted placement in format 'provider:region'.

class PlacementUnionMember5:
hostname: str

HTTP hostname for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

class PlacementUnionMember6:
host: str

TCP host and port for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

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.

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"

WorkersAccount Settings

Fetch Worker Account Settings
workers.account_settings.get(AccountSettingGetParams**kwargs) -> AccountSettingGetResponse
GET/accounts/{account_id}/workers/account-settings
Create Worker Account Settings
workers.account_settings.update(AccountSettingUpdateParams**kwargs) -> AccountSettingUpdateResponse
PUT/accounts/{account_id}/workers/account-settings
ModelsExpand Collapse
class AccountSettingGetResponse:
default_usage_model: Optional[str]
green_compute: Optional[bool]
class AccountSettingUpdateResponse:
default_usage_model: Optional[str]
green_compute: Optional[bool]

WorkersDomains

List Domains
workers.domains.list(DomainListParams**kwargs) -> SyncSinglePage[DomainListResponse]
GET/accounts/{account_id}/workers/domains
Get Domain
workers.domains.get(strdomain_id, DomainGetParams**kwargs) -> DomainGetResponse
GET/accounts/{account_id}/workers/domains/{domain_id}
Attach Domain
workers.domains.update(DomainUpdateParams**kwargs) -> DomainUpdateResponse
PUT/accounts/{account_id}/workers/domains
Detach Domain
workers.domains.delete(strdomain_id, DomainDeleteParams**kwargs) -> DomainDeleteResponse
DELETE/accounts/{account_id}/workers/domains/{domain_id}
ModelsExpand Collapse
class DomainListResponse:
id: str

Immutable ID of the domain.

cert_id: str

ID of the TLS certificate issued for the domain.

formatuuid
Deprecatedenvironment: str

Worker environment associated with the domain.

hostname: str

Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.

service: str

Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.

zone_id: str

ID of the zone containing the domain hostname.

zone_name: str

Name of the zone containing the domain hostname.

class DomainGetResponse:
id: str

Immutable ID of the domain.

cert_id: str

ID of the TLS certificate issued for the domain.

formatuuid
Deprecatedenvironment: str

Worker environment associated with the domain.

hostname: str

Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.

service: str

Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.

zone_id: str

ID of the zone containing the domain hostname.

zone_name: str

Name of the zone containing the domain hostname.

class DomainUpdateResponse:
id: str

Immutable ID of the domain.

cert_id: str

ID of the TLS certificate issued for the domain.

formatuuid
Deprecatedenvironment: str

Worker environment associated with the domain.

hostname: str

Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.

service: str

Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.

zone_id: str

ID of the zone containing the domain hostname.

zone_name: str

Name of the zone containing the domain hostname.

class DomainDeleteResponse:
errors: List[Error]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[ErrorSource]
pointer: Optional[str]
messages: List[Message]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[MessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

WorkersSubdomains

Get Subdomain
workers.subdomains.get(SubdomainGetParams**kwargs) -> SubdomainGetResponse
GET/accounts/{account_id}/workers/subdomain
Create Subdomain
workers.subdomains.update(SubdomainUpdateParams**kwargs) -> SubdomainUpdateResponse
PUT/accounts/{account_id}/workers/subdomain
Delete Subdomain
workers.subdomains.delete(SubdomainDeleteParams**kwargs)
DELETE/accounts/{account_id}/workers/subdomain
ModelsExpand Collapse
class SubdomainGetResponse:
subdomain: str
class SubdomainUpdateResponse:
subdomain: str

WorkersObservability

WorkersObservabilityTelemetry

List keys
workers.observability.telemetry.keys(TelemetryKeysParams**kwargs) -> SyncSinglePage[TelemetryKeysResponse]
POST/accounts/{account_id}/workers/observability/telemetry/keys
Run a query
workers.observability.telemetry.query(TelemetryQueryParams**kwargs) -> TelemetryQueryResponse
POST/accounts/{account_id}/workers/observability/telemetry/query
List values
workers.observability.telemetry.values(TelemetryValuesParams**kwargs) -> SyncSinglePage[TelemetryValuesResponse]
POST/accounts/{account_id}/workers/observability/telemetry/values
ModelsExpand Collapse
class TelemetryKeysResponse:
key: str
last_seen_at: float
type: Literal["string", "boolean", "number"]
One of the following:
"string"
"boolean"
"number"
class TelemetryQueryResponse:
run: Run

A Workers Observability Query Object

id: str
account_id: str
dry: bool
granularity: float
query: RunQuery
id: str
adhoc: bool

If the query wasn't explcitly saved

created: str
created_by: str
description: Optional[str]
maxLength1000
name: str

Query name

maxLength250
minLength1
parameters: RunQueryParameters
calculations: Optional[List[RunQueryParametersCalculation]]

Create Calculations to compute as part of the query.

operator: Literal["uniq", "count", "max", 35 more]
One of the following:
"uniq"
"count"
"max"
"min"
"sum"
"avg"
"median"
"p001"
"p01"
"p05"
"p10"
"p25"
"p75"
"p90"
"p95"
"p99"
"p999"
"stddev"
"variance"
"COUNT_DISTINCT"
"COUNT"
"MAX"
"MIN"
"SUM"
"AVG"
"MEDIAN"
"P001"
"P01"
"P05"
"P10"
"P25"
"P75"
"P90"
"P95"
"P99"
"P999"
"STDDEV"
"VARIANCE"
alias: Optional[str]
key: Optional[str]
key_type: Optional[Literal["string", "number", "boolean"]]
One of the following:
"string"
"number"
"boolean"
datasets: Optional[List[str]]

Set the Datasets to query. Leave it empty to query all the datasets.

filter_combination: Optional[Literal["and", "or", "AND", "OR"]]

Set a Flag to describe how to combine the filters on the query.

One of the following:
"and"
"or"
"AND"
"OR"
filters: Optional[List[RunQueryParametersFilter]]

Configure the Filters to apply to the query. Supports nested groups via kind: 'group'.

One of the following:
class RunQueryParametersFilterUnionMember0:
filter_combination: Literal["and", "or", "AND", "OR"]
One of the following:
"and"
"or"
"AND"
"OR"
filters: List[object]
kind: Literal["group"]
class RunQueryParametersFilterWorkersObservabilityFilterLeaf:

Filtering best practices: use observability_keys and observability_values to confirm available fields and values. If searching for errors, filter for $metadata.error exists.

key: str

Filter field name. IMPORTANT: do not guess keys. Always use verified keys from previous query results or the observability_keys response. Preferred keys: $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, $metadata.error.

operation: Literal["includes", "not_includes", "starts_with", 25 more]
One of the following:
"includes"
"not_includes"
"starts_with"
"regex"
"exists"
"is_null"
"in"
"not_in"
"eq"
"neq"
"gt"
"gte"
"lt"
"lte"
"="
"!="
">"
">="
"<"
"<="
"INCLUDES"
"DOES_NOT_INCLUDE"
"MATCH_REGEX"
"EXISTS"
"DOES_NOT_EXIST"
"IN"
"NOT_IN"
"STARTS_WITH"
type: Literal["string", "number", "boolean"]
One of the following:
"string"
"number"
"boolean"
kind: Optional[Literal["filter"]]
value: Optional[Union[str, float, bool, null]]

Filter comparison value. IMPORTANT: must match actual values in your logs. Verify using previous query results or the /values endpoint. Ensure value type matches the field type. String comparisons are case-sensitive unless using specific operations. Regex uses ClickHouse RE2 syntax (no lookaheads/lookbehinds); examples: ^5\d{2}$ for HTTP 5xx, \bERROR\b for word boundary.

One of the following:
str
float
bool
group_bys: Optional[List[RunQueryParametersGroupBy]]

Define how to group the results of the query.

type: Literal["string", "number", "boolean"]
One of the following:
"string"
"number"
"boolean"
value: str
havings: Optional[List[RunQueryParametersHaving]]

Configure the Having clauses that filter on calculations in the query result.

key: str
operation: Literal["eq", "neq", "gt", 3 more]
One of the following:
"eq"
"neq"
"gt"
"gte"
"lt"
"lte"
value: float
limit: Optional[int]

Set a limit on the number of results / records returned by the query

maximum100
minimum0
needle: Optional[RunQueryParametersNeedle]

Define an expression to search using full-text search.

value: RunQueryParametersNeedleValue
is_regex: Optional[bool]
match_case: Optional[bool]
order_by: Optional[RunQueryParametersOrderBy]

Configure the order of the results returned by the query.

value: str

Configure which Calculation to order the results by.

order: Optional[Literal["asc", "desc"]]

Set the order of the results

One of the following:
"asc"
"desc"
updated: str
updated_by: str
status: Literal["STARTED", "COMPLETED"]
One of the following:
"STARTED"
"COMPLETED"
timeframe: RunTimeframe

Time range for the query execution

from_: float

Start timestamp for the query timeframe (Unix timestamp in milliseconds)

to: float

End timestamp for the query timeframe (Unix timestamp in milliseconds)

user_id: str
created: Optional[str]
statistics: Optional[RunStatistics]
bytes_read: float

Number of uncompressed bytes read from the table.

elapsed: float

Time in seconds for the query to run.

rows_read: float

Number of rows scanned from the table.

abr_level: Optional[float]

The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the ABR level is 1

updated: Optional[str]
statistics: Statistics

The statistics object contains information about query performance from the database, it does not include any network latency

bytes_read: float

Number of uncompressed bytes read from the table.

elapsed: float

Time in seconds for the query to run.

rows_read: float

Number of rows scanned from the table.

abr_level: Optional[float]

The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the ABR level is 1

agents: Optional[List[Agent]]
agent_class: str
event_type_counts: Dict[str, float]
first_event_ms: float
has_errors: bool
last_event_ms: float
namespace: str
service: str
total_events: float
calculations: Optional[List[Calculation]]
aggregates: List[CalculationAggregate]
count: float
interval: float
sample_interval: float
value: float
groups: Optional[List[CalculationAggregateGroup]]
key: str
value: Union[str, float, bool]
One of the following:
str
float
bool
calculation: str
series: List[CalculationSeries]
data: List[CalculationSeriesData]
count: float
interval: float
sample_interval: float
value: float
first_seen: Optional[str]
groups: Optional[List[CalculationSeriesDataGroup]]
key: str
value: Union[str, float, bool]
One of the following:
str
float
bool
last_seen: Optional[str]
time: str
alias: Optional[str]
compare: Optional[List[Compare]]
aggregates: List[CompareAggregate]
count: float
interval: float
sample_interval: float
value: float
groups: Optional[List[CompareAggregateGroup]]
key: str
value: Union[str, float, bool]
One of the following:
str
float
bool
calculation: str
series: List[CompareSeries]
data: List[CompareSeriesData]
count: float
interval: float
sample_interval: float
value: float
first_seen: Optional[str]
groups: Optional[List[CompareSeriesDataGroup]]
key: str
value: Union[str, float, bool]
One of the following:
str
float
bool
last_seen: Optional[str]
time: str
alias: Optional[str]
events: Optional[Events]
count: Optional[float]
events: Optional[List[EventsEvent]]
metadata: EventsEventMetadata
id: str

Unique event ID. Use as the cursor for offset-based pagination.

account: Optional[str]
cloud_service: Optional[str]
cold_start: Optional[int]
exclusiveMinimum
minimum0
cost: Optional[int]
exclusiveMinimum
minimum0
duration: Optional[int]
exclusiveMinimum
minimum0
end_time: Optional[int]
minimum0
error: Optional[str]
error_template: Optional[str]
fingerprint: Optional[str]
level: Optional[str]
message: Optional[str]
message_template: Optional[str]
metric_name: Optional[str]
origin: Optional[str]
parent_span_id: Optional[str]
provider: Optional[str]
region: Optional[str]
request_id: Optional[str]
service: Optional[str]
span_id: Optional[str]
span_name: Optional[str]
stack_id: Optional[str]
start_time: Optional[int]
minimum0
status_code: Optional[int]
exclusiveMinimum
minimum0
trace_duration: Optional[int]
exclusiveMinimum
minimum0
trace_id: Optional[str]
transaction_name: Optional[str]
trigger: Optional[str]
type: Optional[str]
url: Optional[str]
dataset: str
source: Union[str, object]
One of the following:
str
object
timestamp: int
minimum0
containers: Optional[object]

Cloudflare Containers event information enriches your logs so you can easily identify and debug issues.

workers: Optional[EventsEventWorkers]

Cloudflare Workers event information enriches your logs so you can easily identify and debug issues.

One of the following:
class EventsEventWorkersUnionMember0:
event_type: Literal["fetch", "scheduled", "alarm", 8 more]
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
request_id: str
script_name: str
durable_object_id: Optional[str]
entrypoint: Optional[str]
event: Optional[Dict[str, object]]
execution_model: Optional[Literal["durableObject", "stateless"]]
One of the following:
"durableObject"
"stateless"
outcome: Optional[str]
script_version: Optional[EventsEventWorkersUnionMember0ScriptVersion]
id: Optional[str]
message: Optional[str]
tag: Optional[str]
truncated: Optional[bool]
class EventsEventWorkersUnionMember1:
cpu_time_ms: float
event_type: Literal["fetch", "scheduled", "alarm", 8 more]
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
outcome: str
request_id: str
script_name: str
wall_time_ms: float
diagnostics_channel_events: Optional[List[EventsEventWorkersUnionMember1DiagnosticsChannelEvent]]
channel: str
message: str
timestamp: float
dispatch_namespace: Optional[str]
durable_object_id: Optional[str]
entrypoint: Optional[str]
event: Optional[Dict[str, object]]
execution_model: Optional[Literal["durableObject", "stateless"]]
One of the following:
"durableObject"
"stateless"
script_version: Optional[EventsEventWorkersUnionMember1ScriptVersion]
id: Optional[str]
message: Optional[str]
tag: Optional[str]
truncated: Optional[bool]
fields: Optional[List[EventsField]]
key: str
type: str
series: Optional[List[EventsSeries]]
data: List[EventsSeriesData]
aggregates: EventsSeriesDataAggregates
Deprecated_count: int
exclusiveMinimum
minimum0
Deprecated_interval: float
exclusiveMinimum
minimum0
Deprecated_first_seen: Optional[str]
Deprecated_last_seen: Optional[str]
Deprecatedbin: Optional[object]
count: float
interval: float
sample_interval: float
errors: Optional[float]
groups: Optional[Dict[str, Union[str, float, bool]]]

Groups in the query results.

One of the following:
str
float
bool
time: str
invocations: Optional[Dict[str, List[Invocation]]]
metadata: InvocationMetadata
id: str

Unique event ID. Use as the cursor for offset-based pagination.

account: Optional[str]
cloud_service: Optional[str]
cold_start: Optional[int]
exclusiveMinimum
minimum0
cost: Optional[int]
exclusiveMinimum
minimum0
duration: Optional[int]
exclusiveMinimum
minimum0
end_time: Optional[int]
minimum0
error: Optional[str]
error_template: Optional[str]
fingerprint: Optional[str]
level: Optional[str]
message: Optional[str]
message_template: Optional[str]
metric_name: Optional[str]
origin: Optional[str]
parent_span_id: Optional[str]
provider: Optional[str]
region: Optional[str]
request_id: Optional[str]
service: Optional[str]
span_id: Optional[str]
span_name: Optional[str]
stack_id: Optional[str]
start_time: Optional[int]
minimum0
status_code: Optional[int]
exclusiveMinimum
minimum0
trace_duration: Optional[int]
exclusiveMinimum
minimum0
trace_id: Optional[str]
transaction_name: Optional[str]
trigger: Optional[str]
type: Optional[str]
url: Optional[str]
dataset: str
source: Union[str, object]
One of the following:
str
object
timestamp: int
minimum0
containers: Optional[object]

Cloudflare Containers event information enriches your logs so you can easily identify and debug issues.

workers: Optional[InvocationWorkers]

Cloudflare Workers event information enriches your logs so you can easily identify and debug issues.

One of the following:
class InvocationWorkersUnionMember0:
event_type: Literal["fetch", "scheduled", "alarm", 8 more]
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
request_id: str
script_name: str
durable_object_id: Optional[str]
entrypoint: Optional[str]
event: Optional[Dict[str, object]]
execution_model: Optional[Literal["durableObject", "stateless"]]
One of the following:
"durableObject"
"stateless"
outcome: Optional[str]
script_version: Optional[InvocationWorkersUnionMember0ScriptVersion]
id: Optional[str]
message: Optional[str]
tag: Optional[str]
truncated: Optional[bool]
class InvocationWorkersUnionMember1:
cpu_time_ms: float
event_type: Literal["fetch", "scheduled", "alarm", 8 more]
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
outcome: str
request_id: str
script_name: str
wall_time_ms: float
diagnostics_channel_events: Optional[List[InvocationWorkersUnionMember1DiagnosticsChannelEvent]]
channel: str
message: str
timestamp: float
dispatch_namespace: Optional[str]
durable_object_id: Optional[str]
entrypoint: Optional[str]
event: Optional[Dict[str, object]]
execution_model: Optional[Literal["durableObject", "stateless"]]
One of the following:
"durableObject"
"stateless"
script_version: Optional[InvocationWorkersUnionMember1ScriptVersion]
id: Optional[str]
message: Optional[str]
tag: Optional[str]
truncated: Optional[bool]
traces: Optional[List[Trace]]
root_span_name: str
root_transaction_name: str
service: List[str]
spans: float
trace_duration_ms: float
trace_end_ms: float
trace_id: str
trace_start_ms: float
errors: Optional[List[str]]
class TelemetryValuesResponse:
dataset: str
key: str
type: Literal["string", "boolean", "number"]
One of the following:
"string"
"boolean"
"number"
value: Union[str, float, bool]
One of the following:
str
float
bool

WorkersObservabilityDestinations

Get Destinations
workers.observability.destinations.list(DestinationListParams**kwargs) -> SyncSinglePage[DestinationListResponse]
GET/accounts/{account_id}/workers/observability/destinations
Create Destination
workers.observability.destinations.create(DestinationCreateParams**kwargs) -> DestinationCreateResponse
POST/accounts/{account_id}/workers/observability/destinations
Update Destination
workers.observability.destinations.update(strslug, DestinationUpdateParams**kwargs) -> DestinationUpdateResponse
PATCH/accounts/{account_id}/workers/observability/destinations/{slug}
Delete Destination
workers.observability.destinations.delete(strslug, DestinationDeleteParams**kwargs) -> DestinationDeleteResponse
DELETE/accounts/{account_id}/workers/observability/destinations/{slug}
ModelsExpand Collapse
class DestinationListResponse:
configuration: Configuration
destination_conf: str
headers: Dict[str, str]
job_status: ConfigurationJobStatus
error_message: str
last_complete: str
last_error: str
logpush_dataset: Literal["opentelemetry-traces", "opentelemetry-logs"]
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
type: Literal["logpush"]
url: str
enabled: bool
name: str
scripts: List[str]
slug: str
class DestinationCreateResponse:
configuration: Configuration
destination_conf: str
logpush_dataset: Literal["opentelemetry-traces", "opentelemetry-logs"]
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
logpush_job: float
type: Literal["logpush"]
url: str
enabled: bool
name: str
scripts: List[str]
slug: str
class DestinationUpdateResponse:
configuration: Configuration
destination_conf: str
logpush_dataset: Literal["opentelemetry-traces", "opentelemetry-logs"]
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
logpush_job: float
type: Literal["logpush"]
url: str
enabled: bool
name: str
scripts: List[str]
slug: str
class DestinationDeleteResponse:
configuration: Configuration
destination_conf: str
logpush_dataset: Literal["opentelemetry-traces", "opentelemetry-logs"]
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
logpush_job: float
type: Literal["logpush"]
url: str
enabled: bool
name: str
scripts: List[str]
slug: str