# Beta # Workers ## List Workers `workers.beta.workers.list(WorkerListParams**kwargs) -> SyncV4PagePaginationArray[Worker]` **get** `/accounts/{account_id}/workers/workers` List all Workers for an account. ### Parameters - `account_id: str` Identifier. - `order: Optional[Literal["asc", "desc"]]` Sort direction. - `"asc"` - `"desc"` - `order_by: Optional[Literal["deployed_on", "updated_on", "created_on", "name"]]` Property to sort results by. - `"deployed_on"` - `"updated_on"` - `"created_on"` - `"name"` - `page: Optional[int]` Current page. - `per_page: Optional[int]` Items per-page. ### Returns - `class Worker: …` - `id: str` Immutable ID of the Worker. - `created_on: datetime` When the Worker was created. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where traces will be exported to. - `enabled: Optional[bool]` Whether traces are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: str` ID of the dispatch namespace. - `namespace_name: str` Name of the dispatch namespace. - `worker_id: str` ID of the Worker using the dispatch namespace. - `worker_name: str` Name of the Worker using the dispatch namespace. - `domains: List[ReferencesDomain]` Custom domains connected to the Worker. - `id: str` ID of the custom domain. - `certificate_id: str` ID of the TLS certificate issued for the custom domain. - `hostname: str` Full hostname of the custom domain, including the zone name. - `zone_id: str` ID of the zone. - `zone_name: str` Name of the zone. - `durable_objects: List[ReferencesDurableObject]` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: str` ID of the Durable Object namespace being used. - `namespace_name: str` Name of the Durable Object namespace being used. - `worker_id: str` ID of the Worker using the Durable Object implementation. - `worker_name: str` Name of the Worker using the Durable Object implementation. - `queues: List[ReferencesQueue]` Queues that send messages to the Worker. - `queue_consumer_id: str` ID of the queue consumer configuration. - `queue_id: str` ID of the queue. - `queue_name: str` Name of the queue. - `workers: List[ReferencesWorker]` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: str` ID of the referencing Worker. - `name: str` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: List[str]` Tags associated with the Worker. - `tail_consumers: List[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. - `updated_on: datetime` When the Worker was most recently updated. - `deployed_on: Optional[datetime]` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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.beta.workers.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get Worker `workers.beta.workers.get(strworker_id, WorkerGetParams**kwargs) -> Worker` **get** `/accounts/{account_id}/workers/workers/{worker_id}` Get details about a specific Worker. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. ### Returns - `class Worker: …` - `id: str` Immutable ID of the Worker. - `created_on: datetime` When the Worker was created. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where traces will be exported to. - `enabled: Optional[bool]` Whether traces are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: str` ID of the dispatch namespace. - `namespace_name: str` Name of the dispatch namespace. - `worker_id: str` ID of the Worker using the dispatch namespace. - `worker_name: str` Name of the Worker using the dispatch namespace. - `domains: List[ReferencesDomain]` Custom domains connected to the Worker. - `id: str` ID of the custom domain. - `certificate_id: str` ID of the TLS certificate issued for the custom domain. - `hostname: str` Full hostname of the custom domain, including the zone name. - `zone_id: str` ID of the zone. - `zone_name: str` Name of the zone. - `durable_objects: List[ReferencesDurableObject]` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: str` ID of the Durable Object namespace being used. - `namespace_name: str` Name of the Durable Object namespace being used. - `worker_id: str` ID of the Worker using the Durable Object implementation. - `worker_name: str` Name of the Worker using the Durable Object implementation. - `queues: List[ReferencesQueue]` Queues that send messages to the Worker. - `queue_consumer_id: str` ID of the queue consumer configuration. - `queue_id: str` ID of the queue. - `queue_name: str` Name of the queue. - `workers: List[ReferencesWorker]` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: str` ID of the referencing Worker. - `name: str` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: List[str]` Tags associated with the Worker. - `tail_consumers: List[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. - `updated_on: datetime` When the Worker was most recently updated. - `deployed_on: Optional[datetime]` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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 ) worker = client.workers.beta.workers.get( worker_id="worker_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Create Worker `workers.beta.workers.create(WorkerCreateParams**kwargs) -> Worker` **post** `/accounts/{account_id}/workers/workers` Create a new Worker. ### Parameters - `account_id: str` Identifier. - `name: str` Name of the Worker. - `logpush: Optional[bool]` Whether logpush is enabled for the Worker. - `observability: Optional[Observability]` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[SequenceNotStr[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[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%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `subdomain: Optional[Subdomain]` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Optional[SequenceNotStr[str]]` Tags associated with the Worker. - `tail_consumers: Optional[Iterable[TailConsumer]]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. ### Returns - `class Worker: …` - `id: str` Immutable ID of the Worker. - `created_on: datetime` When the Worker was created. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where traces will be exported to. - `enabled: Optional[bool]` Whether traces are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: str` ID of the dispatch namespace. - `namespace_name: str` Name of the dispatch namespace. - `worker_id: str` ID of the Worker using the dispatch namespace. - `worker_name: str` Name of the Worker using the dispatch namespace. - `domains: List[ReferencesDomain]` Custom domains connected to the Worker. - `id: str` ID of the custom domain. - `certificate_id: str` ID of the TLS certificate issued for the custom domain. - `hostname: str` Full hostname of the custom domain, including the zone name. - `zone_id: str` ID of the zone. - `zone_name: str` Name of the zone. - `durable_objects: List[ReferencesDurableObject]` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: str` ID of the Durable Object namespace being used. - `namespace_name: str` Name of the Durable Object namespace being used. - `worker_id: str` ID of the Worker using the Durable Object implementation. - `worker_name: str` Name of the Worker using the Durable Object implementation. - `queues: List[ReferencesQueue]` Queues that send messages to the Worker. - `queue_consumer_id: str` ID of the queue consumer configuration. - `queue_id: str` ID of the queue. - `queue_name: str` Name of the queue. - `workers: List[ReferencesWorker]` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: str` ID of the referencing Worker. - `name: str` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: List[str]` Tags associated with the Worker. - `tail_consumers: List[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. - `updated_on: datetime` When the Worker was most recently updated. - `deployed_on: Optional[datetime]` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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 ) worker = client.workers.beta.workers.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-worker", ) print(worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Update Worker `workers.beta.workers.update(strworker_id, WorkerUpdateParams**kwargs) -> Worker` **put** `/accounts/{account_id}/workers/workers/{worker_id}` Perform a complete replacement of a Worker, where omitted properties are set to their default values. This is the exact same as the Create Worker endpoint, but operates on an existing Worker. To perform a partial update instead, use the Edit Worker endpoint. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. - `name: str` Name of the Worker. - `logpush: Optional[bool]` Whether logpush is enabled for the Worker. - `observability: Optional[Observability]` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[SequenceNotStr[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[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%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `subdomain: Optional[Subdomain]` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Optional[SequenceNotStr[str]]` Tags associated with the Worker. - `tail_consumers: Optional[Iterable[TailConsumer]]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. ### Returns - `class Worker: …` - `id: str` Immutable ID of the Worker. - `created_on: datetime` When the Worker was created. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where traces will be exported to. - `enabled: Optional[bool]` Whether traces are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: str` ID of the dispatch namespace. - `namespace_name: str` Name of the dispatch namespace. - `worker_id: str` ID of the Worker using the dispatch namespace. - `worker_name: str` Name of the Worker using the dispatch namespace. - `domains: List[ReferencesDomain]` Custom domains connected to the Worker. - `id: str` ID of the custom domain. - `certificate_id: str` ID of the TLS certificate issued for the custom domain. - `hostname: str` Full hostname of the custom domain, including the zone name. - `zone_id: str` ID of the zone. - `zone_name: str` Name of the zone. - `durable_objects: List[ReferencesDurableObject]` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: str` ID of the Durable Object namespace being used. - `namespace_name: str` Name of the Durable Object namespace being used. - `worker_id: str` ID of the Worker using the Durable Object implementation. - `worker_name: str` Name of the Worker using the Durable Object implementation. - `queues: List[ReferencesQueue]` Queues that send messages to the Worker. - `queue_consumer_id: str` ID of the queue consumer configuration. - `queue_id: str` ID of the queue. - `queue_name: str` Name of the queue. - `workers: List[ReferencesWorker]` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: str` ID of the referencing Worker. - `name: str` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: List[str]` Tags associated with the Worker. - `tail_consumers: List[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. - `updated_on: datetime` When the Worker was most recently updated. - `deployed_on: Optional[datetime]` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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 ) worker = client.workers.beta.workers.update( worker_id="worker_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-worker", ) print(worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Edit Worker `workers.beta.workers.edit(strworker_id, WorkerEditParams**kwargs) -> Worker` **patch** `/accounts/{account_id}/workers/workers/{worker_id}` Perform a partial update on a Worker, where omitted properties are left unchanged from their current values. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[SequenceNotStr[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[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%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: SequenceNotStr[str]` Tags associated with the Worker. - `tail_consumers: Iterable[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. ### Returns - `class Worker: …` - `id: str` Immutable ID of the Worker. - `created_on: datetime` When the Worker was created. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where traces will be exported to. - `enabled: Optional[bool]` Whether traces are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: str` ID of the dispatch namespace. - `namespace_name: str` Name of the dispatch namespace. - `worker_id: str` ID of the Worker using the dispatch namespace. - `worker_name: str` Name of the Worker using the dispatch namespace. - `domains: List[ReferencesDomain]` Custom domains connected to the Worker. - `id: str` ID of the custom domain. - `certificate_id: str` ID of the TLS certificate issued for the custom domain. - `hostname: str` Full hostname of the custom domain, including the zone name. - `zone_id: str` ID of the zone. - `zone_name: str` Name of the zone. - `durable_objects: List[ReferencesDurableObject]` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: str` ID of the Durable Object namespace being used. - `namespace_name: str` Name of the Durable Object namespace being used. - `worker_id: str` ID of the Worker using the Durable Object implementation. - `worker_name: str` Name of the Worker using the Durable Object implementation. - `queues: List[ReferencesQueue]` Queues that send messages to the Worker. - `queue_consumer_id: str` ID of the queue consumer configuration. - `queue_id: str` ID of the queue. - `queue_name: str` Name of the queue. - `workers: List[ReferencesWorker]` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: str` ID of the referencing Worker. - `name: str` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: List[str]` Tags associated with the Worker. - `tail_consumers: List[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. - `updated_on: datetime` When the Worker was most recently updated. - `deployed_on: Optional[datetime]` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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 ) worker = client.workers.beta.workers.edit( worker_id="worker_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", logpush=True, name="my-worker", observability={}, subdomain={}, tags=["my-team", "my-public-api"], tail_consumers=[{ "name": "my-tail-consumer" }], ) print(worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Delete Worker `workers.beta.workers.delete(strworker_id, WorkerDeleteParams**kwargs) -> WorkerDeleteResponse` **delete** `/accounts/{account_id}/workers/workers/{worker_id}` Delete a Worker and all its associated resources (versions, deployments, etc.). ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. ### Returns - `class WorkerDeleteResponse: …` - `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 ) worker = client.workers.beta.workers.delete( worker_id="worker_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(worker.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 ### Worker - `class Worker: …` - `id: str` Immutable ID of the Worker. - `created_on: datetime` When the Worker was created. - `logpush: bool` Whether logpush is enabled for the Worker. - `name: str` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled: Optional[bool]` Whether observability is enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs: Optional[ObservabilityLogs]` Log settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where logs will be exported to. - `enabled: Optional[bool]` Whether logs are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs: Optional[bool]` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist: Optional[bool]` Whether log persistence is enabled for the Worker. - `traces: Optional[ObservabilityTraces]` Trace settings for the Worker. - `destinations: Optional[List[str]]` A list of destinations where traces will be exported to. - `enabled: Optional[bool]` Whether traces are enabled for the Worker. - `head_sampling_rate: Optional[float]` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist: Optional[bool]` Whether trace persistence is enabled for the Worker. - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: List[ReferencesDispatchNamespaceOutbound]` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: str` ID of the dispatch namespace. - `namespace_name: str` Name of the dispatch namespace. - `worker_id: str` ID of the Worker using the dispatch namespace. - `worker_name: str` Name of the Worker using the dispatch namespace. - `domains: List[ReferencesDomain]` Custom domains connected to the Worker. - `id: str` ID of the custom domain. - `certificate_id: str` ID of the TLS certificate issued for the custom domain. - `hostname: str` Full hostname of the custom domain, including the zone name. - `zone_id: str` ID of the zone. - `zone_name: str` Name of the zone. - `durable_objects: List[ReferencesDurableObject]` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: str` ID of the Durable Object namespace being used. - `namespace_name: str` Name of the Durable Object namespace being used. - `worker_id: str` ID of the Worker using the Durable Object implementation. - `worker_name: str` Name of the Worker using the Durable Object implementation. - `queues: List[ReferencesQueue]` Queues that send messages to the Worker. - `queue_consumer_id: str` ID of the queue consumer configuration. - `queue_id: str` ID of the queue. - `queue_name: str` Name of the queue. - `workers: List[ReferencesWorker]` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: str` ID of the referencing Worker. - `name: str` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled: Optional[bool]` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled: Optional[bool]` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: List[str]` Tags associated with the Worker. - `tail_consumers: List[TailConsumer]` Other Workers that should consume logs from the Worker. - `name: str` Name of the consumer Worker. - `updated_on: datetime` When the Worker was most recently updated. - `deployed_on: Optional[datetime]` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Worker Delete Response - `class WorkerDeleteResponse: …` - `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.beta.workers.versions.list(strworker_id, VersionListParams**kwargs) -> SyncV4PagePaginationArray[Version]` **get** `/accounts/{account_id}/workers/workers/{worker_id}/versions` List all versions for a Worker. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. - `page: Optional[int]` Current page. - `per_page: Optional[int]` Items per-page. ### Returns - `class Version: …` - `id: str` Version identifier. - `created_on: datetime` When the version was created. - `number: int` The integer version number, starting from one. - `urls: List[str]` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `annotations: Optional[Annotations]` Metadata about the version. - `workers_message: Optional[str]` Human-readable message about the version. - `workers_tag: Optional[str]` User-provided identifier for the version. - `workers_triggered_by: Optional[str]` Operation that triggered the creation of the version. - `assets: Optional[Assets]` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `config: Optional[AssetsConfig]` Configuration for assets within a Worker. - `html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]` Determines the redirects and rewrites of requests for HTML content. - `"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[List[str], bool, null]]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `List[str]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `bool` Enables routing to always invoke the Worker script ahead of all requests. When true, this is equivalent to `["/*"]` in the string array version of this field. - `jwt: Optional[str]` Token provided upon successful upload of all files from a registered manifest. - `bindings: Optional[List[Binding]]` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `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]` Resource limits enforced at runtime. - `cpu_ms: int` CPU time limit in milliseconds. - `main_module: Optional[str]` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migrations: Optional[Migrations]` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `class SingleStepMigration: …` A single set of migrations to apply. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `class MigrationsWorkersMultipleStepMigrations: …` - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps: Optional[List[MigrationStep]]` Migrations to apply in order. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `modules: Optional[List[Module]]` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `content_base64: str` The base64-encoded module content. - `content_type: str` The content type of the module. - `name: str` The name of the module. - `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. - `source: Optional[str]` The client used to create the version. - `startup_time_ms: Optional[int]` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model: Optional[Literal["standard", "bundled", "unbound"]]` Usage model for the version. - `"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.beta.workers.versions.list( worker_id="worker_id", 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": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_on": "2019-12-27T18:11:19.117Z", "number": 0, "urls": [ "https://9387e76d-my-worker.my-subdomain.workers.dev" ], "annotations": { "workers/message": "Fixed bug.", "workers/tag": "v1.0.1", "workers/triggered_by": "upload" }, "assets": { "config": { "html_handling": "auto-trailing-slash", "not_found_handling": "404-page", "run_worker_first": [ "string" ] }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "main_module": "index.js", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get Version `workers.beta.workers.versions.get(strversion_id, VersionGetParams**kwargs) -> Version` **get** `/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}` Get details about a specific version. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. - `version_id: str` Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version. - `include: Optional[Literal["modules"]]` Whether to include the `modules` property of the version in the response, which contains code and sourcemap content and may add several megabytes to the response size. - `"modules"` ### Returns - `class Version: …` - `id: str` Version identifier. - `created_on: datetime` When the version was created. - `number: int` The integer version number, starting from one. - `urls: List[str]` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `annotations: Optional[Annotations]` Metadata about the version. - `workers_message: Optional[str]` Human-readable message about the version. - `workers_tag: Optional[str]` User-provided identifier for the version. - `workers_triggered_by: Optional[str]` Operation that triggered the creation of the version. - `assets: Optional[Assets]` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `config: Optional[AssetsConfig]` Configuration for assets within a Worker. - `html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]` Determines the redirects and rewrites of requests for HTML content. - `"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[List[str], bool, null]]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `List[str]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `bool` Enables routing to always invoke the Worker script ahead of all requests. When true, this is equivalent to `["/*"]` in the string array version of this field. - `jwt: Optional[str]` Token provided upon successful upload of all files from a registered manifest. - `bindings: Optional[List[Binding]]` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `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]` Resource limits enforced at runtime. - `cpu_ms: int` CPU time limit in milliseconds. - `main_module: Optional[str]` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migrations: Optional[Migrations]` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `class SingleStepMigration: …` A single set of migrations to apply. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `class MigrationsWorkersMultipleStepMigrations: …` - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps: Optional[List[MigrationStep]]` Migrations to apply in order. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `modules: Optional[List[Module]]` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `content_base64: str` The base64-encoded module content. - `content_type: str` The content type of the module. - `name: str` The name of the module. - `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. - `source: Optional[str]` The client used to create the version. - `startup_time_ms: Optional[int]` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model: Optional[Literal["standard", "bundled", "unbound"]]` Usage model for the version. - `"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 ) version = client.workers.beta.workers.versions.get( version_id="version_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", worker_id="worker_id", ) 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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_on": "2019-12-27T18:11:19.117Z", "number": 0, "urls": [ "https://9387e76d-my-worker.my-subdomain.workers.dev" ], "annotations": { "workers/message": "Fixed bug.", "workers/tag": "v1.0.1", "workers/triggered_by": "upload" }, "assets": { "config": { "html_handling": "auto-trailing-slash", "not_found_handling": "404-page", "run_worker_first": [ "string" ] }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "main_module": "index.js", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" }, "success": true } ``` ## Create Version `workers.beta.workers.versions.create(strworker_id, VersionCreateParams**kwargs) -> Version` **post** `/accounts/{account_id}/workers/workers/{worker_id}/versions` Create a new version. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. - `deploy: Optional[bool]` If true, a deployment will be created that sends 100% of traffic to the new version. - `annotations: Optional[Annotations]` Metadata about the version. - `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. - `assets: Optional[Assets]` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `config: Optional[AssetsConfig]` Configuration for assets within a Worker. - `html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]` Determines the redirects and rewrites of requests for HTML content. - `"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. - `jwt: Optional[str]` Token provided upon successful upload of all files from a registered manifest. - `bindings: Optional[Iterable[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[Iterable[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[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 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[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[Limits]` Resource limits enforced at runtime. - `cpu_ms: int` CPU time limit in milliseconds. - `main_module: Optional[str]` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migrations: Optional[Migrations]` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `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[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]` - `modules: Optional[Iterable[Module]]` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `content_base64: Union[str, Base64FileInput]` The base64-encoded module content. - `content_type: str` The content type of the module. - `name: str` The name of the module. - `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: Iterable[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. - `usage_model: Optional[Literal["standard", "bundled", "unbound"]]` Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Returns - `class Version: …` - `id: str` Version identifier. - `created_on: datetime` When the version was created. - `number: int` The integer version number, starting from one. - `urls: List[str]` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `annotations: Optional[Annotations]` Metadata about the version. - `workers_message: Optional[str]` Human-readable message about the version. - `workers_tag: Optional[str]` User-provided identifier for the version. - `workers_triggered_by: Optional[str]` Operation that triggered the creation of the version. - `assets: Optional[Assets]` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `config: Optional[AssetsConfig]` Configuration for assets within a Worker. - `html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]` Determines the redirects and rewrites of requests for HTML content. - `"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[List[str], bool, null]]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `List[str]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `bool` Enables routing to always invoke the Worker script ahead of all requests. When true, this is equivalent to `["/*"]` in the string array version of this field. - `jwt: Optional[str]` Token provided upon successful upload of all files from a registered manifest. - `bindings: Optional[List[Binding]]` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `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]` Resource limits enforced at runtime. - `cpu_ms: int` CPU time limit in milliseconds. - `main_module: Optional[str]` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migrations: Optional[Migrations]` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `class SingleStepMigration: …` A single set of migrations to apply. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `class MigrationsWorkersMultipleStepMigrations: …` - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps: Optional[List[MigrationStep]]` Migrations to apply in order. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `modules: Optional[List[Module]]` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `content_base64: str` The base64-encoded module content. - `content_type: str` The content type of the module. - `name: str` The name of the module. - `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. - `source: Optional[str]` The client used to create the version. - `startup_time_ms: Optional[int]` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model: Optional[Literal["standard", "bundled", "unbound"]]` Usage model for the version. - `"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 ) version = client.workers.beta.workers.versions.create( worker_id="worker_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) 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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_on": "2019-12-27T18:11:19.117Z", "number": 0, "urls": [ "https://9387e76d-my-worker.my-subdomain.workers.dev" ], "annotations": { "workers/message": "Fixed bug.", "workers/tag": "v1.0.1", "workers/triggered_by": "upload" }, "assets": { "config": { "html_handling": "auto-trailing-slash", "not_found_handling": "404-page", "run_worker_first": [ "string" ] }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "main_module": "index.js", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" }, "success": true } ``` ## Delete Version `workers.beta.workers.versions.delete(strversion_id, VersionDeleteParams**kwargs) -> VersionDeleteResponse` **delete** `/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}` Delete a version. ### Parameters - `account_id: str` Identifier. - `worker_id: str` Identifier for the Worker, which can be ID or name. - `version_id: str` Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version. ### Returns - `class VersionDeleteResponse: …` - `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 ) version = client.workers.beta.workers.versions.delete( version_id="version_id", account_id="023e105f4ecef8ad9ca31a8372d0c353", worker_id="worker_id", ) print(version.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 ### Version - `class Version: …` - `id: str` Version identifier. - `created_on: datetime` When the version was created. - `number: int` The integer version number, starting from one. - `urls: List[str]` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `annotations: Optional[Annotations]` Metadata about the version. - `workers_message: Optional[str]` Human-readable message about the version. - `workers_tag: Optional[str]` User-provided identifier for the version. - `workers_triggered_by: Optional[str]` Operation that triggered the creation of the version. - `assets: Optional[Assets]` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `config: Optional[AssetsConfig]` Configuration for assets within a Worker. - `html_handling: Optional[Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]]` Determines the redirects and rewrites of requests for HTML content. - `"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[List[str], bool, null]]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `List[str]` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `bool` Enables routing to always invoke the Worker script ahead of all requests. When true, this is equivalent to `["/*"]` in the string array version of this field. - `jwt: Optional[str]` Token provided upon successful upload of all files from a registered manifest. - `bindings: Optional[List[Binding]]` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `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]` Resource limits enforced at runtime. - `cpu_ms: int` CPU time limit in milliseconds. - `main_module: Optional[str]` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migrations: Optional[Migrations]` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `class SingleStepMigration: …` A single set of migrations to apply. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `class MigrationsWorkersMultipleStepMigrations: …` - `new_tag: Optional[str]` Tag to set as the latest migration tag. - `old_tag: Optional[str]` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps: Optional[List[MigrationStep]]` Migrations to apply in order. - `deleted_classes: Optional[List[str]]` A list of classes to delete Durable Object namespaces from. - `new_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes: Optional[List[str]]` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes: Optional[List[RenamedClass]]` A list of classes with Durable Object namespaces that were renamed. - `from_: Optional[str]` - `to: Optional[str]` - `transferred_classes: Optional[List[TransferredClass]]` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from_: Optional[str]` - `from_script: Optional[str]` - `to: Optional[str]` - `modules: Optional[List[Module]]` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `content_base64: str` The base64-encoded module content. - `content_type: str` The content type of the module. - `name: str` The name of the module. - `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. - `source: Optional[str]` The client used to create the version. - `startup_time_ms: Optional[int]` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model: Optional[Literal["standard", "bundled", "unbound"]]` Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Version Delete Response - `class VersionDeleteResponse: …` - `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`