# Scripts
## List Workers
`workers.scripts.list(ScriptListParams**kwargs) -> SyncSinglePage[ScriptListResponse]`
**get** `/accounts/{account_id}/workers/scripts`
Fetch a list of uploaded workers.
### Parameters
- `account_id: str`
Identifier.
- `tags: Optional[str]`
Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.
### Returns
- `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.
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `placement_mode: Optional[Literal["smart", "targeted"]]`
- `"smart"`
- `"targeted"`
- `placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `routes: Optional[List[Route]]`
Routes associated with the Worker.
- `id: str`
Identifier.
- `pattern: str`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
page = client.workers.scripts.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "my-workers-script",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2017-01-01T00:00:00Z",
"etag": "ea95132c15732412d22c1476fa83f27a",
"handlers": [
"fetch",
"scheduled"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2017-01-01T00:00:00Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"routes": [
{
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
}
],
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
}
],
"success": true
}
```
## Search Workers
`workers.scripts.search(ScriptSearchParams**kwargs) -> ScriptSearchResponse`
**get** `/accounts/{account_id}/workers/scripts-search`
Search for Workers in an account.
### Parameters
- `account_id: str`
Identifier.
- `id: Optional[str]`
Worker ID (also called tag) to search for. Only exact matches are returned.
- `name: Optional[str]`
Worker name to search for. Both exact and partial matches are returned.
- `order_by: Optional[Literal["created_on", "modified_on", "name"]]`
Property to sort results by. Results are sorted in ascending order.
- `"created_on"`
- `"modified_on"`
- `"name"`
- `page: Optional[int]`
Current page.
- `per_page: Optional[int]`
Items per page.
### Returns
- `List[ScriptSearchResponseItem]`
- `id: str`
Identifier.
- `created_on: datetime`
When the script was created.
- `modified_on: datetime`
When the script was last modified.
- `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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
response = client.workers.scripts.search(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(response)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"created_on": "2017-01-01T00:00:00Z",
"modified_on": "2017-01-01T00:00:00Z",
"script_name": "this-is_my_script-01",
"environment_is_default": true,
"environment_name": "production",
"service_name": "my-service"
}
],
"success": true,
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}
```
## Download Worker
`workers.scripts.get(strscript_name, ScriptGetParams**kwargs) -> ScriptGetResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}`
Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `str`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script = client.workers.scripts.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(script)
```
## Upload Worker Module
`workers.scripts.update(strscript_name, ScriptUpdateParams**kwargs) -> ScriptUpdateResponse`
**put** `/accounts/{account_id}/workers/scripts/{script_name}`
Upload a worker module. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `metadata: Metadata`
JSON-encoded metadata about the uploaded parts and Worker configuration.
- `annotations: Optional[MetadataAnnotations]`
Annotations for the version created by this upload.
- `workers_message: Optional[str]`
Human-readable message about the version.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `assets: Optional[MetadataAssets]`
Configuration for assets within a Worker.
- `config: Optional[MetadataAssetsConfig]`
Configuration for assets within a Worker.
- `_headers: Optional[str]`
The contents of a _headers file (used to attach custom headers on asset responses).
- `_redirects: Optional[str]`
The contents of a _redirects file (used to apply redirects or proxy paths ahead of asset serving).
- `html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]`
Determines the redirects and rewrites of requests for HTML content.
- `"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.
- `"none"`
- `"404-page"`
- `"single-page-application"`
- `run_worker_first: Optional[Union[SequenceNotStr[str], bool]]`
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.
- `SequenceNotStr[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.
- `serve_directly: Optional[bool]`
When true and the incoming request matches an asset, that will be served instead of invoking the Worker script. When false, requests will always invoke the Worker script.
- `jwt: Optional[str]`
Token provided upon successful upload of all files from a registered manifest.
- `bindings: Optional[Iterable[MetadataBinding]]`
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.
- `class MetadataBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `class MetadataBindingWorkersBindingKindAISearch: …`
- `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.
- `"ai_search"`
- `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 MetadataBindingWorkersBindingKindAISearchNamespace: …`
- `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.
- `"ai_search_namespace"`
- `class MetadataBindingWorkersBindingKindAnalyticsEngine: …`
- `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.
- `"analytics_engine"`
- `class MetadataBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class MetadataBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `class MetadataBindingWorkersBindingKindD1: …`
- `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.
- `"d1"`
- `class MetadataBindingWorkersBindingKindDataBlob: …`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `class MetadataBindingWorkersBindingKindDispatchNamespace: …`
- `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.
- `"dispatch_namespace"`
- `outbound: Optional[MetadataBindingWorkersBindingKindDispatchNamespaceOutbound]`
Outbound worker.
- `params: Optional[Iterable[MetadataBindingWorkersBindingKindDispatchNamespaceOutboundParam]]`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `name: str`
Name of the parameter.
- `worker: Optional[MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker]`
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 MetadataBindingWorkersBindingKindDurableObjectNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["durable_object_namespace"]`
The kind of resource that the binding provides.
- `"durable_object_namespace"`
- `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.
- `script_name: Optional[str]`
The script where the Durable Object is defined, if it is external to this Worker.
- `class MetadataBindingWorkersBindingKindHyperdrive: …`
- `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.
- `"hyperdrive"`
- `class MetadataBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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 MetadataBindingWorkersBindingKindImages: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["images"]`
The kind of resource that the binding provides.
- `"images"`
- `class MetadataBindingWorkersBindingKindJson: …`
- `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.
- `"json"`
- `class MetadataBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class MetadataBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `class MetadataBindingWorkersBindingKindMTLSCertificate: …`
- `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.
- `"mtls_certificate"`
- `class MetadataBindingWorkersBindingKindPlainText: …`
- `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.
- `"plain_text"`
- `class MetadataBindingWorkersBindingKindPipelines: …`
- `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.
- `"pipelines"`
- `class MetadataBindingWorkersBindingKindQueue: …`
- `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.
- `"queue"`
- `class MetadataBindingWorkersBindingKindRatelimit: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Identifier of the rate limit namespace to bind to.
- `simple: MetadataBindingWorkersBindingKindRatelimitSimple`
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.
- `"ratelimit"`
- `class MetadataBindingWorkersBindingKindR2Bucket: …`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"eu"`
- `"fedramp"`
- `"fedramp-high"`
- `class MetadataBindingWorkersBindingKindSecretText: …`
- `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.
- `"secret_text"`
- `class MetadataBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `allowed_destination_addresses: Optional[SequenceNotStr[str]]`
List of allowed destination addresses.
- `allowed_sender_addresses: Optional[SequenceNotStr[str]]`
List of allowed sender addresses.
- `destination_address: Optional[str]`
Destination address for the email.
- `class MetadataBindingWorkersBindingKindService: …`
- `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.
- `"service"`
- `entrypoint: Optional[str]`
Entrypoint to invoke on the target Worker.
- `environment: Optional[str]`
Optional environment if the Worker utilizes one.
- `class MetadataBindingWorkersBindingKindTextBlob: …`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `class MetadataBindingWorkersBindingKindVectorize: …`
- `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.
- `"vectorize"`
- `class MetadataBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `class MetadataBindingWorkersBindingKindSecretsStoreSecret: …`
- `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.
- `"secrets_store_secret"`
- `class MetadataBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `class MetadataBindingWorkersBindingKindWorkflow: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["workflow"]`
The kind of resource that the binding provides.
- `"workflow"`
- `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 MetadataBindingWorkersBindingKindWasmModule: …`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `class MetadataBindingWorkersBindingKindVPCService: …`
- `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.
- `"vpc_service"`
- `class MetadataBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `body_part: Optional[str]`
Name of the uploaded file that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` 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[SequenceNotStr[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`.
- `keep_assets: Optional[bool]`
Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token.
- `keep_bindings: Optional[SequenceNotStr[str]]`
List of binding types to keep from previous_upload.
- `limits: Optional[MetadataLimits]`
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.
- `main_module: Optional[str]`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
- `migrations: Optional[MetadataMigrations]`
Migrations to apply for Durable Objects associated with this Worker.
- `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 MetadataMigrationsWorkersMultipleStepMigrations: …`
- `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[Iterable[MigrationStepParam]]`
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[MetadataObservability]`
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[MetadataObservabilityLogs]`
Log settings for the Worker.
- `enabled: bool`
Whether logs are enabled for the Worker.
- `invocation_logs: bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `destinations: Optional[SequenceNotStr[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[MetadataObservabilityTraces]`
Trace settings for the Worker.
- `destinations: Optional[SequenceNotStr[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[MetadataPlacement]`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class MetadataPlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember1: …`
- `region: str`
Cloud region for targeted placement in format 'provider:region'.
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember2: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember3: …`
- `host: str`
TCP host and port for targeted placement.
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `region: str`
Cloud region for targeted placement in format 'provider:region'.
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class MetadataPlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: Iterable[MetadataPlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `class MetadataPlacementUnionMember7TargetRegion: …`
- `region: str`
Cloud region in format 'provider:region'.
- `class MetadataPlacementUnionMember7TargetHostname: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `class MetadataPlacementUnionMember7TargetHost: …`
- `host: str`
TCP host:port for targeted placement.
- `last_analyzed_at: Optional[Union[str, datetime]]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `tags: Optional[SequenceNotStr[str]]`
List of strings to use as tags for this Worker.
- `tail_consumers: Optional[Iterable[ConsumerScriptParam]]`
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.
- `"standard"`
- `"bundled"`
- `"unbound"`
- `bindings_inherit: Optional[Literal["strict"]]`
When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.
- `"strict"`
- `files: Optional[SequenceNotStr[FileTypes]]`
An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
### Returns
- `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.
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `placement_mode: Optional[Literal["smart", "targeted"]]`
- `"smart"`
- `"targeted"`
- `placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
- `"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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script = client.workers.scripts.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={},
)
print(script.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"startup_time_ms": 10,
"id": "this-is_my_script-01",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2022-05-05T05:15:11.602148Z",
"entry_point": "index.js",
"etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1",
"handlers": [
"fetch"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2022-05-20T19:02:56.446492Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## Delete Worker
`workers.scripts.delete(strscript_name, ScriptDeleteParams**kwargs) -> object`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}`
Delete your worker. This call has no response body on a successful delete.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `force: Optional[bool]`
If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.
### Returns
- `object`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script = client.workers.scripts.delete(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(script)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {}
}
```
## Domain Types
### Script
- `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.
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `placement_mode: Optional[Literal["smart", "targeted"]]`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `"smart"`
- `"targeted"`
- `placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Script Setting
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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.
### Script List Response
- `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.
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `placement_mode: Optional[Literal["smart", "targeted"]]`
- `"smart"`
- `"targeted"`
- `placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `routes: Optional[List[Route]]`
Routes associated with the Worker.
- `id: str`
Identifier.
- `pattern: str`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Script Search Response
- `List[ScriptSearchResponseItem]`
- `id: str`
Identifier.
- `created_on: datetime`
When the script was created.
- `modified_on: datetime`
When the script was last modified.
- `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.
### Script Get Response
- `str`
### Script Update Response
- `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.
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `placement_mode: Optional[Literal["smart", "targeted"]]`
- `"smart"`
- `"targeted"`
- `placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
- `"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.
- `"standard"`
- `"bundled"`
- `"unbound"`
# Assets
# Upload
## 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`
Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `manifest: Dict[str, Manifest]`
A manifest ([path]: {hash, size}) map of files to upload. As an example, `/blog/hello-world.html` would be a valid path key.
- `hash: str`
The hash of the file.
- `size: int`
The size of the file in bytes.
### Returns
- `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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
upload = client.workers.scripts.assets.upload.create(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
manifest={
"foo": {
"hash": "hash",
"size": 0,
}
},
)
print(upload.buckets)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"buckets": [
[
"string"
]
],
"jwt": "jwt"
}
}
```
## Domain Types
### Upload Create Response
- `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.
# Subdomain
## Get Worker subdomain
`workers.scripts.subdomain.get(strscript_name, SubdomainGetParams**kwargs) -> SubdomainGetResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Get if the Worker is available on the workers.dev subdomain.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
subdomain = client.workers.scripts.subdomain.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(subdomain.enabled)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Post Worker subdomain
`workers.scripts.subdomain.create(strscript_name, SubdomainCreateParams**kwargs) -> SubdomainCreateResponse`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Enable or disable the Worker on the workers.dev subdomain.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `enabled: bool`
Whether the Worker should be available on the workers.dev subdomain.
- `previews_enabled: Optional[bool]`
Whether the Worker's Preview URLs should be available on the workers.dev subdomain.
### Returns
- `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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
subdomain = client.workers.scripts.subdomain.create(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
enabled=True,
)
print(subdomain.enabled)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Delete Worker subdomain
`workers.scripts.subdomain.delete(strscript_name, SubdomainDeleteParams**kwargs) -> SubdomainDeleteResponse`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Disable all workers.dev subdomains for a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
subdomain = client.workers.scripts.subdomain.delete(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(subdomain.enabled)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Domain Types
### Subdomain Get Response
- `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.
### Subdomain Create Response
- `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.
### Subdomain Delete Response
- `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.
# Schedules
## Get Cron Triggers
`workers.scripts.schedules.get(strscript_name, ScheduleGetParams**kwargs) -> ScheduleGetResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/schedules`
Fetches Cron Triggers for a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `class ScheduleGetResponse: …`
- `schedules: List[Schedule]`
- `cron: str`
- `created_on: Optional[str]`
- `modified_on: Optional[str]`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
schedule = client.workers.scripts.schedules.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(schedule.schedules)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"schedules": [
{
"cron": "*/30 * * * *",
"created_on": "created_on",
"modified_on": "modified_on"
}
]
},
"success": true
}
```
## Update Cron Triggers
`workers.scripts.schedules.update(strscript_name, ScheduleUpdateParams**kwargs) -> ScheduleUpdateResponse`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/schedules`
Updates Cron Triggers for a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `body: Iterable[Body]`
- `cron: str`
- `created_on: Optional[str]`
- `modified_on: Optional[str]`
### Returns
- `class ScheduleUpdateResponse: …`
- `schedules: List[Schedule]`
- `cron: str`
- `created_on: Optional[str]`
- `modified_on: Optional[str]`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
schedule = client.workers.scripts.schedules.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{
"cron": "*/30 * * * *"
}],
)
print(schedule.schedules)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"schedules": [
{
"cron": "*/30 * * * *",
"created_on": "created_on",
"modified_on": "modified_on"
}
]
},
"success": true
}
```
## Domain Types
### Schedule Get Response
- `class ScheduleGetResponse: …`
- `schedules: List[Schedule]`
- `cron: str`
- `created_on: Optional[str]`
- `modified_on: Optional[str]`
### Schedule Update Response
- `class ScheduleUpdateResponse: …`
- `schedules: List[Schedule]`
- `cron: str`
- `created_on: Optional[str]`
- `modified_on: Optional[str]`
# Tail
## List Tails
`workers.scripts.tail.get(strscript_name, TailGetParams**kwargs) -> TailGetResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/tails`
Get list of tails currently deployed on a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `class TailGetResponse: …`
- `id: str`
Identifier.
- `expires_at: str`
- `url: str`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
tail = client.workers.scripts.tail.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(tail.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"expires_at": "expires_at",
"url": "url"
},
"success": true
}
```
## Start Tail
`workers.scripts.tail.create(strscript_name, TailCreateParams**kwargs) -> TailCreateResponse`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/tails`
Starts a tail that receives logs and exception from a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `body: object`
### Returns
- `class TailCreateResponse: …`
- `id: str`
Identifier.
- `expires_at: str`
- `url: str`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
tail = client.workers.scripts.tail.create(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={},
)
print(tail.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"expires_at": "expires_at",
"url": "url"
},
"success": true
}
```
## Delete Tail
`workers.scripts.tail.delete(strid, TailDeleteParams**kwargs) -> TailDeleteResponse`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}`
Deletes a tail from a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `id: str`
Identifier.
### Returns
- `class TailDeleteResponse: …`
- `errors: List[Error]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[ErrorSource]`
- `pointer: Optional[str]`
- `messages: List[Message]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[MessageSource]`
- `pointer: Optional[str]`
- `success: Literal[true]`
Whether the API call was successful.
- `true`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
tail = client.workers.scripts.tail.delete(
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
print(tail.errors)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true
}
```
## Domain Types
### Consumer Script
- `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.
### Tail Get Response
- `class TailGetResponse: …`
- `id: str`
Identifier.
- `expires_at: str`
- `url: str`
### Tail Create Response
- `class TailCreateResponse: …`
- `id: str`
Identifier.
- `expires_at: str`
- `url: str`
### Tail Delete Response
- `class TailDeleteResponse: …`
- `errors: List[Error]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[ErrorSource]`
- `pointer: Optional[str]`
- `messages: List[Message]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[MessageSource]`
- `pointer: Optional[str]`
- `success: Literal[true]`
Whether the API call was successful.
- `true`
# Content
## Get script content
`workers.scripts.content.get(strscript_name, ContentGetParams**kwargs) -> BinaryResponseContent`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/content/v2`
Fetch script content only.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `BinaryResponseContent`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
content = client.workers.scripts.content.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(content)
data = content.read()
print(data)
```
## Put script content
`workers.scripts.content.update(strscript_name, ContentUpdateParams**kwargs) -> Script`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/content`
Put script content without touching config or metadata.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `metadata: Metadata`
JSON-encoded metadata about the uploaded parts and Worker configuration.
- `body_part: Optional[str]`
Name of the uploaded file that contains the Worker 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 uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
- `files: Optional[SequenceNotStr[FileTypes]]`
An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
- `cf_worker_body_part: Optional[str]`
- `cf_worker_main_module_part: Optional[str]`
### Returns
- `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.
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementUnionMember0: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `last_analyzed_at: Optional[datetime]`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"SUCCESS"`
- `"UNSUPPORTED_APPLICATION"`
- `"INSUFFICIENT_INVOCATIONS"`
- `placement_mode: Optional[Literal["smart", "targeted"]]`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `"smart"`
- `"targeted"`
- `placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]]`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script = client.workers.scripts.content.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={},
)
print(script.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "my-workers-script",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2017-01-01T00:00:00Z",
"etag": "ea95132c15732412d22c1476fa83f27a",
"handlers": [
"fetch",
"scheduled"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2017-01-01T00:00:00Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
# Settings
## Get Script Settings
`workers.scripts.settings.get(strscript_name, SettingGetParams**kwargs) -> ScriptSetting`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/script-settings`
Get script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Includes Logpush and Tail Consumers.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script_setting = client.workers.scripts.settings.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(script_setting.logpush)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
]
},
"success": true
}
```
## Patch Script Settings
`workers.scripts.settings.edit(strscript_name, SettingEditParams**kwargs) -> ScriptSetting`
**patch** `/accounts/{account_id}/workers/scripts/{script_name}/script-settings`
Patch script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Including but not limited to Logpush and Tail Consumers.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `destinations: Optional[SequenceNotStr[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[SequenceNotStr[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[SequenceNotStr[str]]`
Tags associated with the Worker.
- `tail_consumers: Optional[Iterable[ConsumerScriptParam]]`
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.
### Returns
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script_setting = client.workers.scripts.settings.edit(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(script_setting.logpush)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
]
},
"success": true
}
```
# Deployments
## List Deployments
`workers.scripts.deployments.list(strscript_name, DeploymentListParams**kwargs) -> DeploymentListResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/deployments`
List of Worker Deployments. The first deployment in the list is the latest deployment actively serving traffic.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `class DeploymentListResponse: …`
- `deployments: List[Deployment]`
- `id: str`
- `created_on: datetime`
- `source: str`
- `strategy: Literal["percentage"]`
- `"percentage"`
- `versions: List[Version]`
- `percentage: float`
- `version_id: str`
- `annotations: Optional[Annotations]`
- `workers_message: Optional[str]`
Human-readable message about the deployment. Truncated to 100 bytes.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the deployment.
- `author_email: Optional[str]`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
deployments = client.workers.scripts.deployments.list(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(deployments.deployments)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"deployments": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
}
]
},
"success": true
}
```
## Create Deployment
`workers.scripts.deployments.create(strscript_name, DeploymentCreateParams**kwargs) -> Deployment`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/deployments`
Deployments configure how [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) are deployed to traffic. A deployment can consist of one or two versions of a Worker.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `strategy: Literal["percentage"]`
- `"percentage"`
- `versions: Iterable[Version]`
- `percentage: float`
- `version_id: str`
- `force: Optional[bool]`
If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed.
- `annotations: Optional[Annotations]`
- `workers_message: Optional[str]`
Human-readable message about the deployment. Truncated to 100 bytes.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the deployment.
### Returns
- `class Deployment: …`
- `id: str`
- `created_on: datetime`
- `source: str`
- `strategy: Literal["percentage"]`
- `"percentage"`
- `versions: List[Version]`
- `percentage: float`
- `version_id: str`
- `annotations: Optional[Annotations]`
- `workers_message: Optional[str]`
Human-readable message about the deployment. Truncated to 100 bytes.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the deployment.
- `author_email: Optional[str]`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
deployment = client.workers.scripts.deployments.create(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
strategy="percentage",
versions=[{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
}],
)
print(deployment.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
},
"success": true
}
```
## Get Deployment
`workers.scripts.deployments.get(strdeployment_id, DeploymentGetParams**kwargs) -> Deployment`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}`
Get information about a Worker Deployment.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `deployment_id: str`
### Returns
- `class Deployment: …`
- `id: str`
- `created_on: datetime`
- `source: str`
- `strategy: Literal["percentage"]`
- `"percentage"`
- `versions: List[Version]`
- `percentage: float`
- `version_id: str`
- `annotations: Optional[Annotations]`
- `workers_message: Optional[str]`
Human-readable message about the deployment. Truncated to 100 bytes.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the deployment.
- `author_email: Optional[str]`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
deployment = client.workers.scripts.deployments.get(
deployment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
print(deployment.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
},
"success": true
}
```
## Delete Deployment
`workers.scripts.deployments.delete(strdeployment_id, DeploymentDeleteParams**kwargs) -> DeploymentDeleteResponse`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}`
Delete a Worker Deployment. The latest deployment, which is actively serving traffic, cannot be deleted. All other deployments can be deleted.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `deployment_id: str`
### Returns
- `class DeploymentDeleteResponse: …`
- `errors: List[Error]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[ErrorSource]`
- `pointer: Optional[str]`
- `messages: List[Message]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[MessageSource]`
- `pointer: Optional[str]`
- `success: Literal[true]`
Whether the API call was successful.
- `true`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
deployment = client.workers.scripts.deployments.delete(
deployment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
print(deployment.errors)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true
}
```
## Domain Types
### Deployment
- `class Deployment: …`
- `id: str`
- `created_on: datetime`
- `source: str`
- `strategy: Literal["percentage"]`
- `"percentage"`
- `versions: List[Version]`
- `percentage: float`
- `version_id: str`
- `annotations: Optional[Annotations]`
- `workers_message: Optional[str]`
Human-readable message about the deployment. Truncated to 100 bytes.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the deployment.
- `author_email: Optional[str]`
### Deployment List Response
- `class DeploymentListResponse: …`
- `deployments: List[Deployment]`
- `id: str`
- `created_on: datetime`
- `source: str`
- `strategy: Literal["percentage"]`
- `"percentage"`
- `versions: List[Version]`
- `percentage: float`
- `version_id: str`
- `annotations: Optional[Annotations]`
- `workers_message: Optional[str]`
Human-readable message about the deployment. Truncated to 100 bytes.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the deployment.
- `author_email: Optional[str]`
### Deployment Delete Response
- `class DeploymentDeleteResponse: …`
- `errors: List[Error]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[ErrorSource]`
- `pointer: Optional[str]`
- `messages: List[Message]`
- `code: int`
- `message: str`
- `documentation_url: Optional[str]`
- `source: Optional[MessageSource]`
- `pointer: Optional[str]`
- `success: Literal[true]`
Whether the API call was successful.
- `true`
# Versions
## List Versions
`workers.scripts.versions.list(strscript_name, VersionListParams**kwargs) -> SyncV4PagePagination[VersionListResponse]`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/versions`
List of Worker Versions. The first version in the list is the latest version.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script.
- `deployable: Optional[bool]`
Only return versions that can be used in a deployment. Ignores pagination.
- `page: Optional[int]`
Current page.
- `per_page: Optional[int]`
Items per-page.
### Returns
- `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.
- `"unknown"`
- `"api"`
- `"wrangler"`
- `"terraform"`
- `"dash"`
- `"dash_template"`
- `"integration"`
- `"quick_editor"`
- `"playground"`
- `"workersci"`
- `number: Optional[float]`
Sequential version number.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
page = client.workers.scripts.versions.list(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result.items[0]
print(page.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"items": [
{
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1
}
]
},
"success": true
}
```
## Get Version Detail
`workers.scripts.versions.get(strversion_id, VersionGetParams**kwargs) -> VersionGetResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}`
Retrieves detailed information about a specific version of a Workers script.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script.
- `version_id: str`
### Returns
- `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.
- `class ResourcesBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class ResourcesBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class ResourcesBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class ResourcesBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class ResourcesBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class ResourcesBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class ResourcesBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class ResourcesBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class ResourcesBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class ResourcesBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `"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.
- `"unknown"`
- `"api"`
- `"wrangler"`
- `"terraform"`
- `"dash"`
- `"dash_template"`
- `"integration"`
- `"quick_editor"`
- `"playground"`
- `"workersci"`
- `number: Optional[float]`
Sequential version number.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
version = client.workers.scripts.versions.get(
version_id="bcf48806-b317-4351-9ee7-36e7d557d4de",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
print(version.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"resources": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"script": {
"etag": "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794",
"handlers": [
"fetch"
],
"last_deployed_from": "api",
"named_handlers": [
{
"handlers": [
"fetch"
],
"name": "MyClass"
}
]
},
"script_runtime": {
"compatibility_date": "2022-11-08",
"compatibility_flags": [
"x"
],
"limits": {
"cpu_ms": 50
},
"migration_tag": "v1",
"usage_model": "standard"
}
},
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1
},
"success": true
}
```
## Upload Version
`workers.scripts.versions.create(strscript_name, VersionCreateParams**kwargs) -> VersionCreateResponse`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/versions`
Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script.
- `metadata: Metadata`
JSON-encoded metadata about the uploaded parts and Worker configuration.
- `main_module: str`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker, which is required for Version Upload.
- `annotations: Optional[MetadataAnnotations]`
- `workers_alias: Optional[str]`
Associated alias for a version.
- `workers_message: Optional[str]`
Human-readable message about the version. Truncated to 100 bytes.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `bindings: Optional[Iterable[MetadataBinding]]`
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.
- `class MetadataBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `class MetadataBindingWorkersBindingKindAISearch: …`
- `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.
- `"ai_search"`
- `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 MetadataBindingWorkersBindingKindAISearchNamespace: …`
- `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.
- `"ai_search_namespace"`
- `class MetadataBindingWorkersBindingKindAnalyticsEngine: …`
- `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.
- `"analytics_engine"`
- `class MetadataBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class MetadataBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `class MetadataBindingWorkersBindingKindD1: …`
- `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.
- `"d1"`
- `class MetadataBindingWorkersBindingKindDataBlob: …`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `class MetadataBindingWorkersBindingKindDispatchNamespace: …`
- `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.
- `"dispatch_namespace"`
- `outbound: Optional[MetadataBindingWorkersBindingKindDispatchNamespaceOutbound]`
Outbound worker.
- `params: Optional[Iterable[MetadataBindingWorkersBindingKindDispatchNamespaceOutboundParam]]`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `name: str`
Name of the parameter.
- `worker: Optional[MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker]`
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 MetadataBindingWorkersBindingKindDurableObjectNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["durable_object_namespace"]`
The kind of resource that the binding provides.
- `"durable_object_namespace"`
- `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.
- `script_name: Optional[str]`
The script where the Durable Object is defined, if it is external to this Worker.
- `class MetadataBindingWorkersBindingKindHyperdrive: …`
- `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.
- `"hyperdrive"`
- `class MetadataBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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 MetadataBindingWorkersBindingKindImages: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["images"]`
The kind of resource that the binding provides.
- `"images"`
- `class MetadataBindingWorkersBindingKindJson: …`
- `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.
- `"json"`
- `class MetadataBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class MetadataBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `class MetadataBindingWorkersBindingKindMTLSCertificate: …`
- `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.
- `"mtls_certificate"`
- `class MetadataBindingWorkersBindingKindPlainText: …`
- `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.
- `"plain_text"`
- `class MetadataBindingWorkersBindingKindPipelines: …`
- `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.
- `"pipelines"`
- `class MetadataBindingWorkersBindingKindQueue: …`
- `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.
- `"queue"`
- `class MetadataBindingWorkersBindingKindRatelimit: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Identifier of the rate limit namespace to bind to.
- `simple: MetadataBindingWorkersBindingKindRatelimitSimple`
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.
- `"ratelimit"`
- `class MetadataBindingWorkersBindingKindR2Bucket: …`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"eu"`
- `"fedramp"`
- `"fedramp-high"`
- `class MetadataBindingWorkersBindingKindSecretText: …`
- `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.
- `"secret_text"`
- `class MetadataBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `allowed_destination_addresses: Optional[SequenceNotStr[str]]`
List of allowed destination addresses.
- `allowed_sender_addresses: Optional[SequenceNotStr[str]]`
List of allowed sender addresses.
- `destination_address: Optional[str]`
Destination address for the email.
- `class MetadataBindingWorkersBindingKindService: …`
- `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.
- `"service"`
- `entrypoint: Optional[str]`
Entrypoint to invoke on the target Worker.
- `environment: Optional[str]`
Optional environment if the Worker utilizes one.
- `class MetadataBindingWorkersBindingKindTextBlob: …`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `class MetadataBindingWorkersBindingKindVectorize: …`
- `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.
- `"vectorize"`
- `class MetadataBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `class MetadataBindingWorkersBindingKindSecretsStoreSecret: …`
- `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.
- `"secrets_store_secret"`
- `class MetadataBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `class MetadataBindingWorkersBindingKindWorkflow: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["workflow"]`
The kind of resource that the binding provides.
- `"workflow"`
- `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 MetadataBindingWorkersBindingKindWasmModule: …`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `class MetadataBindingWorkersBindingKindVPCService: …`
- `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.
- `"vpc_service"`
- `class MetadataBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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[SequenceNotStr[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`.
- `keep_bindings: Optional[SequenceNotStr[str]]`
List of binding types to keep from previous_upload.
- `usage_model: Optional[Literal["standard", "bundled", "unbound"]]`
Usage model for the Worker invocations.
- `"standard"`
- `"bundled"`
- `"unbound"`
- `bindings_inherit: Optional[Literal["strict"]]`
When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.
- `"strict"`
- `files: Optional[SequenceNotStr[FileTypes]]`
An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
### Returns
- `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.
- `class ResourcesBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class ResourcesBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class ResourcesBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class ResourcesBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class ResourcesBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class ResourcesBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class ResourcesBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class ResourcesBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class ResourcesBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class ResourcesBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `"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.
- `"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](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time).
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
version = client.workers.scripts.versions.create(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={
"main_module": "worker.js"
},
)
print(version.id)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"resources": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"script": {
"etag": "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794",
"handlers": [
"fetch"
],
"last_deployed_from": "api",
"named_handlers": [
{
"handlers": [
"fetch"
],
"name": "MyClass"
}
]
},
"script_runtime": {
"compatibility_date": "2022-11-08",
"compatibility_flags": [
"x"
],
"limits": {
"cpu_ms": 50
},
"migration_tag": "v1",
"usage_model": "standard"
}
},
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1,
"startup_time_ms": 10
},
"success": true
}
```
## Domain Types
### Version List Response
- `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.
- `"unknown"`
- `"api"`
- `"wrangler"`
- `"terraform"`
- `"dash"`
- `"dash_template"`
- `"integration"`
- `"quick_editor"`
- `"playground"`
- `"workersci"`
- `number: Optional[float]`
Sequential version number.
### Version Get Response
- `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.
- `class ResourcesBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class ResourcesBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class ResourcesBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class ResourcesBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class ResourcesBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class ResourcesBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class ResourcesBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class ResourcesBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class ResourcesBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class ResourcesBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `"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.
- `"unknown"`
- `"api"`
- `"wrangler"`
- `"terraform"`
- `"dash"`
- `"dash_template"`
- `"integration"`
- `"quick_editor"`
- `"playground"`
- `"workersci"`
- `number: Optional[float]`
Sequential version number.
### Version Create Response
- `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.
- `class ResourcesBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class ResourcesBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class ResourcesBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class ResourcesBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class ResourcesBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class ResourcesBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class ResourcesBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class ResourcesBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class ResourcesBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class ResourcesBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `"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.
- `"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](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time).
# Secrets
## List script secrets
`workers.scripts.secrets.list(strscript_name, SecretListParams**kwargs) -> SyncSinglePage[SecretListResponse]`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/secrets`
List secrets bound to a script.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `SecretListResponse`
A secret value accessible through a binding.
- `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.
- `"secret_text"`
- `class WorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
page = client.workers.scripts.secrets.list(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": [
{
"name": "myBinding",
"type": "secret_text"
}
]
}
```
## Get secret binding
`workers.scripts.secrets.get(strsecret_name, SecretGetParams**kwargs) -> SecretGetResponse`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}`
Get a given secret binding (value omitted) on a script.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `secret_name: str`
A JavaScript variable name for the secret binding.
- `url_encoded: Optional[bool]`
Flag that indicates whether the secret name is URL encoded.
### Returns
- `SecretGetResponse`
A secret value accessible through a binding.
- `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.
- `"secret_text"`
- `class WorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
secret = client.workers.scripts.secrets.get(
secret_name="mySecret",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
print(secret)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"name": "myBinding",
"type": "secret_text"
}
}
```
## Add script secret
`workers.scripts.secrets.update(strscript_name, SecretUpdateParams**kwargs) -> SecretUpdateResponse`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/secrets`
Add a secret to a script.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `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.
- `"secret_text"`
### Returns
- `SecretUpdateResponse`
A secret value accessible through a binding.
- `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.
- `"secret_text"`
- `class WorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
secret = client.workers.scripts.secrets.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
name="myBinding",
text="My secret.",
type="secret_text",
)
print(secret)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"name": "myBinding",
"type": "secret_text"
}
}
```
## Delete script secret
`workers.scripts.secrets.delete(strsecret_name, SecretDeleteParams**kwargs) -> object`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}`
Remove a secret from a script.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `secret_name: str`
A JavaScript variable name for the secret binding.
- `url_encoded: Optional[bool]`
Flag that indicates whether the secret name is URL encoded.
### Returns
- `object`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
secret = client.workers.scripts.secrets.delete(
secret_name="mySecret",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
print(secret)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {}
}
```
## Domain Types
### Secret List Response
- `SecretListResponse`
A secret value accessible through a binding.
- `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.
- `"secret_text"`
- `class WorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Secret Get Response
- `SecretGetResponse`
A secret value accessible through a binding.
- `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.
- `"secret_text"`
- `class WorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Secret Update Response
- `SecretUpdateResponse`
A secret value accessible through a binding.
- `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.
- `"secret_text"`
- `class WorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
# Script 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`
Get metadata and config, such as bindings or usage model.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
### Returns
- `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.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `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.
- `class BindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class BindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class BindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class BindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class BindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class BindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class BindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class BindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class BindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class BindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementMode: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `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.
- `"targeted"`
- `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.
- `"targeted"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script_and_version_setting = client.workers.scripts.script_and_version_settings.get(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(script_and_version_setting.annotations)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## Patch Settings
`workers.scripts.script_and_version_settings.edit(strscript_name, ScriptAndVersionSettingEditParams**kwargs) -> ScriptAndVersionSettingEditResponse`
**patch** `/accounts/{account_id}/workers/scripts/{script_name}/settings`
Patch metadata or config, such as bindings or usage model.
### Parameters
- `account_id: str`
Identifier.
- `script_name: str`
Name of the script, used in URLs and route configuration.
- `settings: Optional[Settings]`
- `annotations: Optional[SettingsAnnotations]`
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.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `workers_triggered_by: Optional[str]`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `bindings: Optional[Iterable[SettingsBinding]]`
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.
- `class SettingsBindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `class SettingsBindingWorkersBindingKindAISearch: …`
- `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.
- `"ai_search"`
- `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 SettingsBindingWorkersBindingKindAISearchNamespace: …`
- `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.
- `"ai_search_namespace"`
- `class SettingsBindingWorkersBindingKindAnalyticsEngine: …`
- `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.
- `"analytics_engine"`
- `class SettingsBindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class SettingsBindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `class SettingsBindingWorkersBindingKindD1: …`
- `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.
- `"d1"`
- `class SettingsBindingWorkersBindingKindDataBlob: …`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `class SettingsBindingWorkersBindingKindDispatchNamespace: …`
- `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.
- `"dispatch_namespace"`
- `outbound: Optional[SettingsBindingWorkersBindingKindDispatchNamespaceOutbound]`
Outbound worker.
- `params: Optional[Iterable[SettingsBindingWorkersBindingKindDispatchNamespaceOutboundParam]]`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `name: str`
Name of the parameter.
- `worker: Optional[SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker]`
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 SettingsBindingWorkersBindingKindDurableObjectNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["durable_object_namespace"]`
The kind of resource that the binding provides.
- `"durable_object_namespace"`
- `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.
- `script_name: Optional[str]`
The script where the Durable Object is defined, if it is external to this Worker.
- `class SettingsBindingWorkersBindingKindHyperdrive: …`
- `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.
- `"hyperdrive"`
- `class SettingsBindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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 SettingsBindingWorkersBindingKindImages: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["images"]`
The kind of resource that the binding provides.
- `"images"`
- `class SettingsBindingWorkersBindingKindJson: …`
- `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.
- `"json"`
- `class SettingsBindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class SettingsBindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `class SettingsBindingWorkersBindingKindMTLSCertificate: …`
- `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.
- `"mtls_certificate"`
- `class SettingsBindingWorkersBindingKindPlainText: …`
- `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.
- `"plain_text"`
- `class SettingsBindingWorkersBindingKindPipelines: …`
- `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.
- `"pipelines"`
- `class SettingsBindingWorkersBindingKindQueue: …`
- `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.
- `"queue"`
- `class SettingsBindingWorkersBindingKindRatelimit: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Identifier of the rate limit namespace to bind to.
- `simple: SettingsBindingWorkersBindingKindRatelimitSimple`
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.
- `"ratelimit"`
- `class SettingsBindingWorkersBindingKindR2Bucket: …`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"eu"`
- `"fedramp"`
- `"fedramp-high"`
- `class SettingsBindingWorkersBindingKindSecretText: …`
- `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.
- `"secret_text"`
- `class SettingsBindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `allowed_destination_addresses: Optional[SequenceNotStr[str]]`
List of allowed destination addresses.
- `allowed_sender_addresses: Optional[SequenceNotStr[str]]`
List of allowed sender addresses.
- `destination_address: Optional[str]`
Destination address for the email.
- `class SettingsBindingWorkersBindingKindService: …`
- `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.
- `"service"`
- `entrypoint: Optional[str]`
Entrypoint to invoke on the target Worker.
- `environment: Optional[str]`
Optional environment if the Worker utilizes one.
- `class SettingsBindingWorkersBindingKindTextBlob: …`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `class SettingsBindingWorkersBindingKindVectorize: …`
- `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.
- `"vectorize"`
- `class SettingsBindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `class SettingsBindingWorkersBindingKindSecretsStoreSecret: …`
- `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.
- `"secrets_store_secret"`
- `class SettingsBindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `class SettingsBindingWorkersBindingKindWorkflow: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["workflow"]`
The kind of resource that the binding provides.
- `"workflow"`
- `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 SettingsBindingWorkersBindingKindWasmModule: …`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `class SettingsBindingWorkersBindingKindVPCService: …`
- `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.
- `"vpc_service"`
- `class SettingsBindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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[SequenceNotStr[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[SettingsLimits]`
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[SettingsMigrations]`
Migrations to apply for Durable Objects associated with this Worker.
- `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 SettingsMigrationsWorkersMultipleStepMigrations: …`
- `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[Iterable[MigrationStepParam]]`
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[SettingsObservability]`
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[SettingsObservabilityLogs]`
Log settings for the Worker.
- `enabled: bool`
Whether logs are enabled for the Worker.
- `invocation_logs: bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `destinations: Optional[SequenceNotStr[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[SettingsObservabilityTraces]`
Trace settings for the Worker.
- `destinations: Optional[SequenceNotStr[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[SettingsPlacement]`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class SettingsPlacementMode: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `class SettingsPlacementRegion: …`
- `region: str`
Cloud region for targeted placement in format 'provider:region'.
- `class SettingsPlacementHostname: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `class SettingsPlacementHost: …`
- `host: str`
TCP host and port for targeted placement.
- `class SettingsPlacementUnionMember4: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `region: str`
Cloud region for targeted placement in format 'provider:region'.
- `class SettingsPlacementUnionMember5: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `class SettingsPlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `class SettingsPlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: Iterable[SettingsPlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `class SettingsPlacementUnionMember7TargetRegion: …`
- `region: str`
Cloud region in format 'provider:region'.
- `class SettingsPlacementUnionMember7TargetHostname: …`
- `hostname: str`
HTTP hostname for targeted placement.
- `class SettingsPlacementUnionMember7TargetHost: …`
- `host: str`
TCP host:port for targeted placement.
- `tags: Optional[SequenceNotStr[str]]`
Tags associated with the Worker.
- `tail_consumers: Optional[Iterable[ConsumerScriptParam]]`
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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Returns
- `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.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `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.
- `class BindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class BindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class BindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class BindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class BindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class BindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class BindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class BindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class BindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class BindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementMode: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `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.
- `"targeted"`
- `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.
- `"targeted"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
response = client.workers.scripts.script_and_version_settings.edit(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(response.annotations)
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## Domain Types
### Script And Version Setting Get Response
- `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.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `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.
- `class BindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class BindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class BindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class BindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class BindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class BindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class BindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class BindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class BindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class BindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementMode: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `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.
- `"targeted"`
- `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.
- `"targeted"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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.
- `"standard"`
- `"bundled"`
- `"unbound"`
### Script And Version Setting Edit Response
- `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.
- `workers_tag: Optional[str]`
User-provided identifier for the version.
- `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.
- `class BindingWorkersBindingKindAI: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["ai"]`
The kind of resource that the binding provides.
- `"ai"`
- `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.
- `"ai_search"`
- `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.
- `"ai_search_namespace"`
- `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.
- `"analytics_engine"`
- `class BindingWorkersBindingKindAssets: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["assets"]`
The kind of resource that the binding provides.
- `"assets"`
- `class BindingWorkersBindingKindBrowser: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["browser"]`
The kind of resource that the binding provides.
- `"browser"`
- `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.
- `"d1"`
- `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.
- `type: Literal["data_blob"]`
The kind of resource that the binding provides.
- `"data_blob"`
- `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.
- `"dispatch_namespace"`
- `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.
- `"durable_object_namespace"`
- `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.
- `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.
- `"hyperdrive"`
- `class BindingWorkersBindingKindInherit: …`
- `name: str`
The name of the inherited binding.
- `type: Literal["inherit"]`
The kind of resource that the binding provides.
- `"inherit"`
- `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.
- `"images"`
- `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.
- `"json"`
- `class BindingWorkersBindingKindKVNamespace: …`
- `name: str`
A JavaScript variable name for the binding.
- `namespace_id: str`
Namespace identifier tag.
- `type: Literal["kv_namespace"]`
The kind of resource that the binding provides.
- `"kv_namespace"`
- `class BindingWorkersBindingKindMedia: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["media"]`
The kind of resource that the binding provides.
- `"media"`
- `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.
- `"mtls_certificate"`
- `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.
- `"plain_text"`
- `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.
- `"pipelines"`
- `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.
- `"queue"`
- `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.
- `"ratelimit"`
- `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.
- `"r2_bucket"`
- `jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `"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.
- `"secret_text"`
- `class BindingWorkersBindingKindSendEmail: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["send_email"]`
The kind of resource that the binding provides.
- `"send_email"`
- `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.
- `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.
- `"service"`
- `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.
- `type: Literal["text_blob"]`
The kind of resource that the binding provides.
- `"text_blob"`
- `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.
- `"vectorize"`
- `class BindingWorkersBindingKindVersionMetadata: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["version_metadata"]`
The kind of resource that the binding provides.
- `"version_metadata"`
- `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.
- `"secrets_store_secret"`
- `class BindingWorkersBindingKindSecretKey: …`
- `algorithm: object`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `format: Literal["raw", "pkcs8", "spki", "jwk"]`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `"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.
- `"secret_key"`
- `usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `"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](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#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"`
- `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.
- `type: Literal["wasm_module"]`
The kind of resource that the binding provides.
- `"wasm_module"`
- `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.
- `"vpc_service"`
- `class BindingWorkersBindingKindVPCNetwork: …`
- `name: str`
A JavaScript variable name for the binding.
- `type: Literal["vpc_network"]`
The kind of resource that the binding provides.
- `"vpc_network"`
- `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.
- `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](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#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](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `class PlacementMode: …`
- `mode: Literal["smart"]`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `"smart"`
- `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.
- `"targeted"`
- `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.
- `"targeted"`
- `class PlacementUnionMember6: …`
- `host: str`
TCP host and port for targeted placement.
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `class PlacementUnionMember7: …`
- `mode: Literal["targeted"]`
Targeted placement mode.
- `"targeted"`
- `target: List[PlacementUnionMember7Target]`
Array of placement targets (currently limited to single target).
- `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.
- `"standard"`
- `"bundled"`
- `"unbound"`