# Beta # Workers ## List Workers `client.workers.beta.workers.list(WorkerListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/workers/workers` List all Workers for an account. ### Parameters - `params: WorkerListParams` - `account_id: string` Path param: Identifier. - `order?: "asc" | "desc"` Query param: Sort direction. - `"asc"` - `"desc"` - `order_by?: "deployed_on" | "updated_on" | "created_on" | "name"` Query param: Property to sort results by. - `"deployed_on"` - `"updated_on"` - `"created_on"` - `"name"` - `page?: number` Query param: Current page. - `per_page?: number` Query param: Items per-page. ### Returns - `Worker` - `id: string` Immutable ID of the Worker. - `created_on: string` When the Worker was created. - `logpush: boolean` Whether logpush is enabled for the Worker. - `name: string` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: Array` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: string` ID of the dispatch namespace. - `namespace_name: string` Name of the dispatch namespace. - `worker_id: string` ID of the Worker using the dispatch namespace. - `worker_name: string` Name of the Worker using the dispatch namespace. - `domains: Array` Custom domains connected to the Worker. - `id: string` ID of the custom domain. - `certificate_id: string` ID of the TLS certificate issued for the custom domain. - `hostname: string` Full hostname of the custom domain, including the zone name. - `zone_id: string` ID of the zone. - `zone_name: string` Name of the zone. - `durable_objects: Array` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: string` ID of the Durable Object namespace being used. - `namespace_name: string` Name of the Durable Object namespace being used. - `worker_id: string` ID of the Worker using the Durable Object implementation. - `worker_name: string` Name of the Worker using the Durable Object implementation. - `queues: Array` Queues that send messages to the Worker. - `queue_consumer_id: string` ID of the queue consumer configuration. - `queue_id: string` ID of the queue. - `queue_name: string` Name of the queue. - `workers: Array` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: string` ID of the referencing Worker. - `name: string` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Tags associated with the Worker. - `tail_consumers: Array` Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. - `updated_on: string` When the Worker was most recently updated. - `deployed_on?: string | null` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const worker of client.workers.beta.workers.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(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, "propagation_policy": "authenticated" } }, "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 `client.workers.beta.workers.get(stringworkerID, WorkerGetParamsparams, RequestOptionsoptions?): Worker` **get** `/accounts/{account_id}/workers/workers/{worker_id}` Get details about a specific Worker. ### Parameters - `workerID: string` Identifier for the Worker, which can be ID or name. - `params: WorkerGetParams` - `account_id: string` Identifier. ### Returns - `Worker` - `id: string` Immutable ID of the Worker. - `created_on: string` When the Worker was created. - `logpush: boolean` Whether logpush is enabled for the Worker. - `name: string` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: Array` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: string` ID of the dispatch namespace. - `namespace_name: string` Name of the dispatch namespace. - `worker_id: string` ID of the Worker using the dispatch namespace. - `worker_name: string` Name of the Worker using the dispatch namespace. - `domains: Array` Custom domains connected to the Worker. - `id: string` ID of the custom domain. - `certificate_id: string` ID of the TLS certificate issued for the custom domain. - `hostname: string` Full hostname of the custom domain, including the zone name. - `zone_id: string` ID of the zone. - `zone_name: string` Name of the zone. - `durable_objects: Array` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: string` ID of the Durable Object namespace being used. - `namespace_name: string` Name of the Durable Object namespace being used. - `worker_id: string` ID of the Worker using the Durable Object implementation. - `worker_name: string` Name of the Worker using the Durable Object implementation. - `queues: Array` Queues that send messages to the Worker. - `queue_consumer_id: string` ID of the queue consumer configuration. - `queue_id: string` ID of the queue. - `queue_name: string` Name of the queue. - `workers: Array` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: string` ID of the referencing Worker. - `name: string` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Tags associated with the Worker. - `tail_consumers: Array` Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. - `updated_on: string` When the Worker was most recently updated. - `deployed_on?: string | null` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const worker = await client.workers.beta.workers.get('worker_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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, "propagation_policy": "authenticated" } }, "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 `client.workers.beta.workers.create(WorkerCreateParamsparams, RequestOptionsoptions?): Worker` **post** `/accounts/{account_id}/workers/workers` Create a new Worker. ### Parameters - `params: WorkerCreateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: Name of the Worker. - `logpush?: boolean` Body param: Whether logpush is enabled for the Worker. - `observability?: Observability` Body param: Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `subdomain?: Subdomain` Body param: Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags?: Array` Body param: Tags associated with the Worker. - `tail_consumers?: Array` Body param: Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. ### Returns - `Worker` - `id: string` Immutable ID of the Worker. - `created_on: string` When the Worker was created. - `logpush: boolean` Whether logpush is enabled for the Worker. - `name: string` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: Array` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: string` ID of the dispatch namespace. - `namespace_name: string` Name of the dispatch namespace. - `worker_id: string` ID of the Worker using the dispatch namespace. - `worker_name: string` Name of the Worker using the dispatch namespace. - `domains: Array` Custom domains connected to the Worker. - `id: string` ID of the custom domain. - `certificate_id: string` ID of the TLS certificate issued for the custom domain. - `hostname: string` Full hostname of the custom domain, including the zone name. - `zone_id: string` ID of the zone. - `zone_name: string` Name of the zone. - `durable_objects: Array` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: string` ID of the Durable Object namespace being used. - `namespace_name: string` Name of the Durable Object namespace being used. - `worker_id: string` ID of the Worker using the Durable Object implementation. - `worker_name: string` Name of the Worker using the Durable Object implementation. - `queues: Array` Queues that send messages to the Worker. - `queue_consumer_id: string` ID of the queue consumer configuration. - `queue_id: string` ID of the queue. - `queue_name: string` Name of the queue. - `workers: Array` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: string` ID of the referencing Worker. - `name: string` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Tags associated with the Worker. - `tail_consumers: Array` Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. - `updated_on: string` When the Worker was most recently updated. - `deployed_on?: string | null` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const worker = await client.workers.beta.workers.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'my-worker', }); console.log(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, "propagation_policy": "authenticated" } }, "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 `client.workers.beta.workers.update(stringworkerID, WorkerUpdateParamsparams, RequestOptionsoptions?): 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 - `workerID: string` Identifier for the Worker, which can be ID or name. - `params: WorkerUpdateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: Name of the Worker. - `logpush?: boolean` Body param: Whether logpush is enabled for the Worker. - `observability?: Observability` Body param: Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `subdomain?: Subdomain` Body param: Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags?: Array` Body param: Tags associated with the Worker. - `tail_consumers?: Array` Body param: Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. ### Returns - `Worker` - `id: string` Immutable ID of the Worker. - `created_on: string` When the Worker was created. - `logpush: boolean` Whether logpush is enabled for the Worker. - `name: string` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: Array` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: string` ID of the dispatch namespace. - `namespace_name: string` Name of the dispatch namespace. - `worker_id: string` ID of the Worker using the dispatch namespace. - `worker_name: string` Name of the Worker using the dispatch namespace. - `domains: Array` Custom domains connected to the Worker. - `id: string` ID of the custom domain. - `certificate_id: string` ID of the TLS certificate issued for the custom domain. - `hostname: string` Full hostname of the custom domain, including the zone name. - `zone_id: string` ID of the zone. - `zone_name: string` Name of the zone. - `durable_objects: Array` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: string` ID of the Durable Object namespace being used. - `namespace_name: string` Name of the Durable Object namespace being used. - `worker_id: string` ID of the Worker using the Durable Object implementation. - `worker_name: string` Name of the Worker using the Durable Object implementation. - `queues: Array` Queues that send messages to the Worker. - `queue_consumer_id: string` ID of the queue consumer configuration. - `queue_id: string` ID of the queue. - `queue_name: string` Name of the queue. - `workers: Array` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: string` ID of the referencing Worker. - `name: string` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Tags associated with the Worker. - `tail_consumers: Array` Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. - `updated_on: string` When the Worker was most recently updated. - `deployed_on?: string | null` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const worker = await client.workers.beta.workers.update('worker_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'my-worker', }); console.log(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, "propagation_policy": "authenticated" } }, "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 `client.workers.beta.workers.edit(stringworkerID, WorkerEditParamsparams, RequestOptionsoptions?): 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 - `workerID: string` Identifier for the Worker, which can be ID or name. - `params: WorkerEditParams` - `account_id: string` Path param: Identifier. - `logpush: boolean` Body param: Whether logpush is enabled for the Worker. - `name: string` Body param: Name of the Worker. - `observability: Observability` Body param: Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `subdomain: Subdomain` Body param: Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Body param: Tags associated with the Worker. - `tail_consumers: Array` Body param: Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. ### Returns - `Worker` - `id: string` Immutable ID of the Worker. - `created_on: string` When the Worker was created. - `logpush: boolean` Whether logpush is enabled for the Worker. - `name: string` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: Array` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: string` ID of the dispatch namespace. - `namespace_name: string` Name of the dispatch namespace. - `worker_id: string` ID of the Worker using the dispatch namespace. - `worker_name: string` Name of the Worker using the dispatch namespace. - `domains: Array` Custom domains connected to the Worker. - `id: string` ID of the custom domain. - `certificate_id: string` ID of the TLS certificate issued for the custom domain. - `hostname: string` Full hostname of the custom domain, including the zone name. - `zone_id: string` ID of the zone. - `zone_name: string` Name of the zone. - `durable_objects: Array` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: string` ID of the Durable Object namespace being used. - `namespace_name: string` Name of the Durable Object namespace being used. - `worker_id: string` ID of the Worker using the Durable Object implementation. - `worker_name: string` Name of the Worker using the Durable Object implementation. - `queues: Array` Queues that send messages to the Worker. - `queue_consumer_id: string` ID of the queue consumer configuration. - `queue_id: string` ID of the queue. - `queue_name: string` Name of the queue. - `workers: Array` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: string` ID of the referencing Worker. - `name: string` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Tags associated with the Worker. - `tail_consumers: Array` Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. - `updated_on: string` When the Worker was most recently updated. - `deployed_on?: string | null` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const worker = await client.workers.beta.workers.edit('worker_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', logpush: true, name: 'my-worker', observability: {}, subdomain: {}, tags: ['my-team', 'my-public-api'], tail_consumers: [{ name: 'my-tail-consumer' }], }); console.log(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, "propagation_policy": "authenticated" } }, "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 `client.workers.beta.workers.delete(stringworkerID, WorkerDeleteParamsparams, RequestOptionsoptions?): WorkerDeleteResponse` **delete** `/accounts/{account_id}/workers/workers/{worker_id}` Delete a Worker and all its associated resources (versions, deployments, etc.). ### Parameters - `workerID: string` Identifier for the Worker, which can be ID or name. - `params: WorkerDeleteParams` - `account_id: string` Identifier. ### Returns - `WorkerDeleteResponse` - `errors: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `success: true` Whether the API call was successful. - `true` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const worker = await client.workers.beta.workers.delete('worker_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 - `Worker` - `id: string` Immutable ID of the Worker. - `created_on: string` When the Worker was created. - `logpush: boolean` Whether logpush is enabled for the Worker. - `name: string` Name of the Worker. - `observability: Observability` Observability settings for the Worker. - `enabled?: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `logs?: Logs` Log settings for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `enabled?: boolean` Whether logs are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `invocation_logs?: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces` Trace settings for the Worker. - `destinations?: Array` A list of destinations where traces will be exported to. - `enabled?: boolean` Whether traces are enabled for the Worker. - `head_sampling_rate?: number` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `propagation_policy?: "authenticated" | "accept"` Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. "authenticated" (default) honors inbound trace context only when accompanied by a valid trace auth token. "accept" unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled. - `"authenticated"` - `"accept"` - `references: References` Other resources that reference the Worker and depend on it existing. - `dispatch_namespace_outbounds: Array` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `namespace_id: string` ID of the dispatch namespace. - `namespace_name: string` Name of the dispatch namespace. - `worker_id: string` ID of the Worker using the dispatch namespace. - `worker_name: string` Name of the Worker using the dispatch namespace. - `domains: Array` Custom domains connected to the Worker. - `id: string` ID of the custom domain. - `certificate_id: string` ID of the TLS certificate issued for the custom domain. - `hostname: string` Full hostname of the custom domain, including the zone name. - `zone_id: string` ID of the zone. - `zone_name: string` Name of the zone. - `durable_objects: Array` Other Workers that reference Durable Object classes implemented by the Worker. - `namespace_id: string` ID of the Durable Object namespace being used. - `namespace_name: string` Name of the Durable Object namespace being used. - `worker_id: string` ID of the Worker using the Durable Object implementation. - `worker_name: string` Name of the Worker using the Durable Object implementation. - `queues: Array` Queues that send messages to the Worker. - `queue_consumer_id: string` ID of the queue consumer configuration. - `queue_id: string` ID of the queue. - `queue_name: string` Name of the queue. - `workers: Array` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `id: string` ID of the referencing Worker. - `name: string` Name of the referencing Worker. - `subdomain: Subdomain` Subdomain settings for the Worker. - `enabled?: boolean` Whether the *.workers.dev subdomain is enabled for the Worker. - `previews_enabled?: boolean` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `tags: Array` Tags associated with the Worker. - `tail_consumers: Array` Other Workers that should consume logs from the Worker. - `name: string` Name of the consumer Worker. - `updated_on: string` When the Worker was most recently updated. - `deployed_on?: string | null` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### Worker Delete Response - `WorkerDeleteResponse` - `errors: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `success: true` Whether the API call was successful. - `true` # Versions ## List Versions `client.workers.beta.workers.versions.list(stringworkerID, VersionListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/workers/workers/{worker_id}/versions` List all versions for a Worker. ### Parameters - `workerID: string` Identifier for the Worker, which can be ID or name. - `params: VersionListParams` - `account_id: string` Path param: Identifier. - `page?: number` Query param: Current page. - `per_page?: number` Query param: Items per-page. ### Returns - `Version` - `id: string` Version identifier. - `created_on: string` When the version was created. - `number: number` The integer version number, starting from one. - `urls: Array` 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?: Annotations` Metadata about the version. - `"workers/message"?: string` Human-readable message about the version. Truncated to 1000 bytes if longer. - `"workers/tag"?: string` User-provided identifier for the version. Maximum 100 bytes. - `"workers/triggered_by"?: string` Operation that triggered the creation of the version. - `assets?: 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?: Config` Configuration for assets within a Worker. - `html_handling?: "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?: "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?: Array | boolean` 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. - `Array` - `boolean` - `jwt?: string` Token provided upon successful upload of all files from a registered manifest. - `bindings?: Array` 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. - `WorkersBindingKindAI` - `name: string` A JavaScript variable name for the binding. - `type: "ai"` The kind of resource that the binding provides. - `"ai"` - `WorkersBindingKindAISearch` - `instance_name: string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `name: string` A JavaScript variable name for the binding. - `type: "ai_search"` The kind of resource that the binding provides. - `"ai_search"` - `namespace?: string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `WorkersBindingKindAISearchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` 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: "ai_search_namespace"` The kind of resource that the binding provides. - `"ai_search_namespace"` - `WorkersBindingKindMessaging` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The Messaging namespace to bind to. - `type: "messaging"` The kind of resource that the binding provides. - `"messaging"` - `WorkersBindingKindAnalyticsEngine` - `dataset: string` The name of the dataset to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "analytics_engine"` The kind of resource that the binding provides. - `"analytics_engine"` - `WorkersBindingKindAssets` - `name: string` A JavaScript variable name for the binding. - `type: "assets"` The kind of resource that the binding provides. - `"assets"` - `WorkersBindingKindBrowser` - `name: string` A JavaScript variable name for the binding. - `type: "browser"` The kind of resource that the binding provides. - `"browser"` - `WorkersBindingKindD1` - `database_id: string` Identifier of the D1 database to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "d1"` The kind of resource that the binding provides. - `"d1"` - `id?: string` Identifier of the D1 database to bind to. - `WorkersBindingKindDataBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `type: "data_blob"` The kind of resource that the binding provides. - `"data_blob"` - `WorkersBindingKindDispatchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The name of the dispatch namespace. - `type: "dispatch_namespace"` The kind of resource that the binding provides. - `"dispatch_namespace"` - `outbound?: Outbound` Outbound worker. - `params?: Array` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `name: string` Name of the parameter. - `worker?: Worker` Outbound worker. - `entrypoint?: string` Entrypoint to invoke on the outbound worker. - `environment?: string` Environment of the outbound worker. - `service?: string` Name of the outbound worker. - `WorkersBindingKindDurableObjectNamespace` - `name: string` A JavaScript variable name for the binding. - `type: "durable_object_namespace"` The kind of resource that the binding provides. - `"durable_object_namespace"` - `class_name?: string` The exported class name of the Durable Object. - `dispatch_namespace?: string` The dispatch namespace the Durable Object script belongs to. - `environment?: string` The environment of the script_name to bind to. - `namespace_id?: string` Namespace identifier tag. - `script_name?: string` The script where the Durable Object is defined, if it is external to this Worker. - `WorkersBindingKindHyperdrive` - `id: string` Identifier of the Hyperdrive connection to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "hyperdrive"` The kind of resource that the binding provides. - `"hyperdrive"` - `WorkersBindingKindInherit` - `name: string` The name of the inherited binding. - `type: "inherit"` The kind of resource that the binding provides. - `"inherit"` - `old_name?: string` 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?: string` 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. - `WorkersBindingKindImages` - `name: string` A JavaScript variable name for the binding. - `type: "images"` The kind of resource that the binding provides. - `"images"` - `WorkersBindingKindJson` - `json: unknown` JSON data to use. - `name: string` A JavaScript variable name for the binding. - `type: "json"` The kind of resource that the binding provides. - `"json"` - `WorkersBindingKindKVNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Namespace identifier tag. - `type: "kv_namespace"` The kind of resource that the binding provides. - `"kv_namespace"` - `WorkersBindingKindMedia` - `name: string` A JavaScript variable name for the binding. - `type: "media"` The kind of resource that the binding provides. - `"media"` - `WorkersBindingKindMTLSCertificate` - `certificate_id: string` Identifier of the certificate to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "mtls_certificate"` The kind of resource that the binding provides. - `"mtls_certificate"` - `WorkersBindingKindPlainText` - `name: string` A JavaScript variable name for the binding. - `text: string` The text value to use. - `type: "plain_text"` The kind of resource that the binding provides. - `"plain_text"` - `WorkersBindingKindPipelines` - `name: string` A JavaScript variable name for the binding. - `pipeline: string` Name of the Pipeline to bind to. - `type: "pipelines"` The kind of resource that the binding provides. - `"pipelines"` - `WorkersBindingKindQueue` - `name: string` A JavaScript variable name for the binding. - `queue_name: string` Name of the Queue to bind to. - `type: "queue"` The kind of resource that the binding provides. - `"queue"` - `WorkersBindingKindRatelimit` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Identifier of the rate limit namespace to bind to. - `simple: Simple` The rate limit configuration. - `limit: number` The limit (requests per period). - `period: number` The period in seconds. - `mitigation_timeout?: number` Duration in seconds to apply the mitigation action after the rate limit is exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400. Must be greater than or equal to the period when non-zero. - `type: "ratelimit"` The kind of resource that the binding provides. - `"ratelimit"` - `WorkersBindingKindR2Bucket` - `bucket_name: string` R2 bucket to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "r2_bucket"` The kind of resource that the binding provides. - `"r2_bucket"` - `jurisdiction?: "eu" | "fedramp" | "fedramp-high"` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `"eu"` - `"fedramp"` - `"fedramp-high"` - `WorkersBindingKindSecretText` - `name: string` A JavaScript variable name for the binding. - `text: string` The secret value to use. - `type: "secret_text"` The kind of resource that the binding provides. - `"secret_text"` - `WorkersBindingKindSendEmail` - `name: string` A JavaScript variable name for the binding. - `type: "send_email"` The kind of resource that the binding provides. - `"send_email"` - `allowed_destination_addresses?: Array` List of allowed destination addresses. - `allowed_sender_addresses?: Array` List of allowed sender addresses. - `destination_address?: string` Destination address for the email. - `WorkersBindingKindService` - `name: string` A JavaScript variable name for the binding. - `service: string` Name of Worker to bind to. - `type: "service"` The kind of resource that the binding provides. - `"service"` - `entrypoint?: string` Entrypoint to invoke on the target Worker. - `environment?: string` Optional environment if the Worker utilizes one. - `WorkersBindingKindTextBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `type: "text_blob"` The kind of resource that the binding provides. - `"text_blob"` - `WorkersBindingKindVectorize` - `index_name: string` Name of the Vectorize index to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "vectorize"` The kind of resource that the binding provides. - `"vectorize"` - `WorkersBindingKindVersionMetadata` - `name: string` A JavaScript variable name for the binding. - `type: "version_metadata"` The kind of resource that the binding provides. - `"version_metadata"` - `WorkersBindingKindSecretsStoreSecret` - `name: string` A JavaScript variable name for the binding. - `secret_name: string` Name of the secret in the store. - `store_id: string` ID of the store containing the secret. - `type: "secrets_store_secret"` The kind of resource that the binding provides. - `"secrets_store_secret"` - `WorkersBindingKindFlagship` - `app_id: string` ID of the Flagship app to bind to for feature flag evaluation. - `name: string` A JavaScript variable name for the binding. - `type: "flagship"` The kind of resource that the binding provides. - `"flagship"` - `WorkersBindingKindSecretKey` - `algorithm: unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `format: "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: string` A JavaScript variable name for the binding. - `type: "secret_key"` The kind of resource that the binding provides. - `"secret_key"` - `usages: Array<"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?: string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `key_jwk?: unknown` 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". - `WorkersBindingKindWorkflow` - `name: string` A JavaScript variable name for the binding. - `type: "workflow"` The kind of resource that the binding provides. - `"workflow"` - `workflow_name: string` Name of the Workflow to bind to. - `class_name?: string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `script_name?: string` Script name that contains the Workflow. If not provided, defaults to this script name. - `WorkersBindingKindWasmModule` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `type: "wasm_module"` The kind of resource that the binding provides. - `"wasm_module"` - `WorkersBindingKindVPCService` - `name: string` A JavaScript variable name for the binding. - `service_id: string` Identifier of the VPC service to bind to. - `type: "vpc_service"` The kind of resource that the binding provides. - `"vpc_service"` - `WorkersBindingKindVPCNetwork` - `name: string` A JavaScript variable name for the binding. - `type: "vpc_network"` The kind of resource that the binding provides. - `"vpc_network"` - `network_id?: string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `tunnel_id?: string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `cache_options?: CacheOptions` Global CacheW configuration for the Worker. When caching is on, the platform provisions a `cloudflare.app` zone for the Worker. A `type: worker` entry in the `exports` map can override this value for a single entrypoint. - `enabled: boolean` Whether caching is enabled for this Worker. - `cross_version_cache?: boolean` Whether cached responses are shared across Worker version uploads. This is independent of `enabled`. It can stay true while caching is off, so the preference survives turning caching off and back on. - `compatibility_date?: string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `compatibility_flags?: Array` 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`. - `containers?: Array` List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. - `class_name: string` Select which Durable Object class should get this container attached. - `exports?: Record` Declarative exports for the version, including Durable Object classes (with their `storage` backend) and named Worker entrypoints. On reads, tombstoned lifecycle entries are omitted, so only live exports (`created` and `expecting-transfer`) are returned. `exports` and `migrations` are mutually exclusive on upload. - `WorkersWorkerExport` A named Worker entrypoint export (`type: worker`). Worker entrypoints are always live (`state: created`) and carry no storage or lifecycle fields. The optional `cache` block overrides the Worker's global `cache_options.enabled` for this entrypoint. - `type: "worker"` Marks this entry as a Worker entrypoint export. - `"worker"` - `cache?: Cache` Cache override for this entrypoint. Overrides the Worker's global `cache_options.enabled` for this entrypoint only. - `enabled: boolean` Whether caching is enabled for this entrypoint. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectExport` A live Durable Object export (`state: created`, the default). The platform auto-provisions the namespace on first deploy, matches it on subsequent deploys, and never mutates or deletes it as a side effect of a code-only change. `storage` is required; `renamed_to`, `transferred_to` and `transfer_from` are not allowed on a live entry. - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object. When set, the namespace is container-enabled. Valid only on live entries. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectDeletedExport` A `deleted` tombstone: retires the provisioned namespace for this class and all of its data. The class must be absent from the uploaded code and no other Worker in the account may bind to the namespace, otherwise the deploy is rejected. No other fields are allowed. Deletion is irreversible. - `state: "deleted"` Tombstone that deletes the namespace. - `"deleted"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectRenamedExport` A `renamed` tombstone: rewrites the provisioned namespace's class name from this map key to `renamed_to`. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `transferred_to` and `transfer_from` are not allowed. - `renamed_to: string` The destination class name. Must differ from the source class (the map key) and must be declared as a live (`created`) entry in the same `exports` map. Write-only: never present in GET responses. - `state: "renamed"` Tombstone that renames the namespace's class. - `"renamed"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectTransferredExport` A `transferred` tombstone (source side of a two-phase transfer): hands ownership of the provisioned namespace to another script in the same account, named by `transferred_to`. The target must have already deployed a matching `expecting-transfer` entry. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `renamed_to` and `transfer_from` are not allowed. - `state: "transferred"` Tombstone that transfers the namespace to another script. - `"transferred"` - `transferred_to: string` The destination script name. Must be in the same account and the same dispatch-namespace context (or both non-dispatch). Cross-dispatch-namespace transfers are rejected. Write-only: never present in GET responses. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectExpectingTransferExport` The target side of a two-phase transfer (`state: expecting-transfer`). Declares that this script expects to receive a namespace for this class from the `transfer_from` script. This is a live entry, not a tombstone: bindings resolve through the source's namespace until the source commits with a `transferred` tombstone. `storage` and `transfer_from` are required; `renamed_to` and `transferred_to` are not allowed. - `state: "expecting-transfer"` Target side of a two-phase transfer. - `"expecting-transfer"` - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `transfer_from: string` The source script name to receive the namespace from. Must be in the same account and dispatch-namespace context. Present on reads for `expecting-transfer` entries. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object once the transfer settles. Valid only on live entries. - `exports_reconciliation?: ExportsReconciliation` Summary of the declarative exports reconciliation that ran on this upload. Populated only when the uploaded metadata included an `exports` block. Durable Object entries drive reconciliation; `type: worker` entries do not contribute to this summary. - `created: Array` Class names for which a new namespace was provisioned. - `deleted: Array` Class names whose namespace was deleted by a `deleted` tombstone. - `info: Array` Non-blocking info entries (stale tombstones, tombstone applied with class still in code). See `exports_reconciliation_info`. - `class: string` The class name the info entry is about. - `message: string` Human-readable explanation. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the entry relates to, when applicable. - `referencing_scripts?: Array` Other Workers in the account that still bind to the affected class. Advisory: while non-empty the tombstone is not yet safe to remove — redeploy these Workers with bindings re-pointed first. - `removable_entries: Array` Source class names whose tombstone entry is now stale and safe to delete from `exports` (no remaining referencing scripts). - `renamed: Array` Applied `renamed` tombstones. - `from: string` The original (source) class name. - `to: string` The new class name (`renamed_to`). - `transfer_pending: Array` Phase-1 transfer hints recorded on the target side. - `class: string` The target-side class name awaiting transfer. - `from: string` The source script the namespace will be transferred from. - `transferred: Array` Committed `transferred` tombstones (phase-2). - `class: string` The source class name that was transferred. - `phase: "committed"` The transfer phase. Currently always `committed`. - `"committed"` - `to: string` The destination script that now owns the namespace. - `updated: Array` Class names whose provisioned namespace was mutated in place. - `warnings: Array` Non-blocking warnings. See `exports_reconciliation_warning`. - `class: string` The class name the warning is about. - `message: string` Human-readable explanation of the warning. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the warning relates to, when applicable. - `limits?: Limits` Resource limits enforced at runtime. - `cpu_ms?: number` CPU time limit in milliseconds. - `subrequests?: number` Subrequest limit per request. - `main_module?: string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migration_tag?: string` Durable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `SingleStepMigration` A single set of migrations to apply. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `WorkersMultipleStepMigrations` - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps?: Array` Migrations to apply in order. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `modules?: Array` 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: string` The base64-encoded module content. - `content_type: string` The content type of the module. - `name: string` The name of the module. - `package_dependencies?: Array` The list of npm packages that were installed and used when this Worker version was built. - `installedVersion: string` The exact version that was resolved and installed by the package manager. - `name: string` The npm package name. - `packageJsonVersion: string` The version constraint as written in package.json. - `placement?: Mode | Region | Hostname | 5 more` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `Mode` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `Region` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host and port for targeted placement. - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember7` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `target: Array` Array of placement targets (currently limited to single target). - `Region` - `region: string` Cloud region in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host:port for targeted placement. - `source?: string` The client used to create the version. - `startup_time_ms?: number` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const version of client.workers.beta.workers.versions.list('worker_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(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": true }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "cache_options": { "enabled": true, "cross_version_cache": true }, "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "containers": [ { "class_name": "MyDurableObject" } ], "exports": { "Admin": { "type": "worker", "cache": { "enabled": true }, "state": "created" }, "Counter": { "storage": "sqlite", "type": "durable-object", "container": "my-container", "state": "created" }, "OldCounter": { "state": "renamed", "type": "durable-object" }, "default": { "type": "worker", "cache": { "enabled": false }, "state": "created" } }, "exports_reconciliation": { "created": [ "string" ], "deleted": [ "string" ], "info": [ { "class": "class", "message": "message", "scenario": "code_class_not_in_exports", "namespace_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "referencing_scripts": [ "string" ] } ], "removable_entries": [ "string" ], "renamed": [ { "from": "from", "to": "to" } ], "transfer_pending": [ { "class": "class", "from": "from" } ], "transferred": [ { "class": "class", "phase": "committed", "to": "to" } ], "updated": [ "string" ], "warnings": [ { "class": "class", "message": "message", "scenario": "code_class_not_in_exports", "namespace_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ] }, "limits": { "cpu_ms": 50, "subrequests": 1000 }, "main_module": "index.js", "migration_tag": "v1", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "package_dependencies": [ { "installedVersion": "4.17.22", "name": "lodash", "packageJsonVersion": "^4.17.21" } ], "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 `client.workers.beta.workers.versions.get(stringversionID, VersionGetParamsparams, RequestOptionsoptions?): Version` **get** `/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}` Get details about a specific version. ### Parameters - `versionID: string` 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. - `params: VersionGetParams` - `account_id: string` Path param: Identifier. - `worker_id: string` Path param: Identifier for the Worker, which can be ID or name. - `include?: "modules"` Query param: 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 - `Version` - `id: string` Version identifier. - `created_on: string` When the version was created. - `number: number` The integer version number, starting from one. - `urls: Array` 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?: Annotations` Metadata about the version. - `"workers/message"?: string` Human-readable message about the version. Truncated to 1000 bytes if longer. - `"workers/tag"?: string` User-provided identifier for the version. Maximum 100 bytes. - `"workers/triggered_by"?: string` Operation that triggered the creation of the version. - `assets?: 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?: Config` Configuration for assets within a Worker. - `html_handling?: "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?: "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?: Array | boolean` 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. - `Array` - `boolean` - `jwt?: string` Token provided upon successful upload of all files from a registered manifest. - `bindings?: Array` 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. - `WorkersBindingKindAI` - `name: string` A JavaScript variable name for the binding. - `type: "ai"` The kind of resource that the binding provides. - `"ai"` - `WorkersBindingKindAISearch` - `instance_name: string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `name: string` A JavaScript variable name for the binding. - `type: "ai_search"` The kind of resource that the binding provides. - `"ai_search"` - `namespace?: string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `WorkersBindingKindAISearchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` 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: "ai_search_namespace"` The kind of resource that the binding provides. - `"ai_search_namespace"` - `WorkersBindingKindMessaging` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The Messaging namespace to bind to. - `type: "messaging"` The kind of resource that the binding provides. - `"messaging"` - `WorkersBindingKindAnalyticsEngine` - `dataset: string` The name of the dataset to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "analytics_engine"` The kind of resource that the binding provides. - `"analytics_engine"` - `WorkersBindingKindAssets` - `name: string` A JavaScript variable name for the binding. - `type: "assets"` The kind of resource that the binding provides. - `"assets"` - `WorkersBindingKindBrowser` - `name: string` A JavaScript variable name for the binding. - `type: "browser"` The kind of resource that the binding provides. - `"browser"` - `WorkersBindingKindD1` - `database_id: string` Identifier of the D1 database to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "d1"` The kind of resource that the binding provides. - `"d1"` - `id?: string` Identifier of the D1 database to bind to. - `WorkersBindingKindDataBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `type: "data_blob"` The kind of resource that the binding provides. - `"data_blob"` - `WorkersBindingKindDispatchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The name of the dispatch namespace. - `type: "dispatch_namespace"` The kind of resource that the binding provides. - `"dispatch_namespace"` - `outbound?: Outbound` Outbound worker. - `params?: Array` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `name: string` Name of the parameter. - `worker?: Worker` Outbound worker. - `entrypoint?: string` Entrypoint to invoke on the outbound worker. - `environment?: string` Environment of the outbound worker. - `service?: string` Name of the outbound worker. - `WorkersBindingKindDurableObjectNamespace` - `name: string` A JavaScript variable name for the binding. - `type: "durable_object_namespace"` The kind of resource that the binding provides. - `"durable_object_namespace"` - `class_name?: string` The exported class name of the Durable Object. - `dispatch_namespace?: string` The dispatch namespace the Durable Object script belongs to. - `environment?: string` The environment of the script_name to bind to. - `namespace_id?: string` Namespace identifier tag. - `script_name?: string` The script where the Durable Object is defined, if it is external to this Worker. - `WorkersBindingKindHyperdrive` - `id: string` Identifier of the Hyperdrive connection to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "hyperdrive"` The kind of resource that the binding provides. - `"hyperdrive"` - `WorkersBindingKindInherit` - `name: string` The name of the inherited binding. - `type: "inherit"` The kind of resource that the binding provides. - `"inherit"` - `old_name?: string` 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?: string` 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. - `WorkersBindingKindImages` - `name: string` A JavaScript variable name for the binding. - `type: "images"` The kind of resource that the binding provides. - `"images"` - `WorkersBindingKindJson` - `json: unknown` JSON data to use. - `name: string` A JavaScript variable name for the binding. - `type: "json"` The kind of resource that the binding provides. - `"json"` - `WorkersBindingKindKVNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Namespace identifier tag. - `type: "kv_namespace"` The kind of resource that the binding provides. - `"kv_namespace"` - `WorkersBindingKindMedia` - `name: string` A JavaScript variable name for the binding. - `type: "media"` The kind of resource that the binding provides. - `"media"` - `WorkersBindingKindMTLSCertificate` - `certificate_id: string` Identifier of the certificate to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "mtls_certificate"` The kind of resource that the binding provides. - `"mtls_certificate"` - `WorkersBindingKindPlainText` - `name: string` A JavaScript variable name for the binding. - `text: string` The text value to use. - `type: "plain_text"` The kind of resource that the binding provides. - `"plain_text"` - `WorkersBindingKindPipelines` - `name: string` A JavaScript variable name for the binding. - `pipeline: string` Name of the Pipeline to bind to. - `type: "pipelines"` The kind of resource that the binding provides. - `"pipelines"` - `WorkersBindingKindQueue` - `name: string` A JavaScript variable name for the binding. - `queue_name: string` Name of the Queue to bind to. - `type: "queue"` The kind of resource that the binding provides. - `"queue"` - `WorkersBindingKindRatelimit` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Identifier of the rate limit namespace to bind to. - `simple: Simple` The rate limit configuration. - `limit: number` The limit (requests per period). - `period: number` The period in seconds. - `mitigation_timeout?: number` Duration in seconds to apply the mitigation action after the rate limit is exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400. Must be greater than or equal to the period when non-zero. - `type: "ratelimit"` The kind of resource that the binding provides. - `"ratelimit"` - `WorkersBindingKindR2Bucket` - `bucket_name: string` R2 bucket to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "r2_bucket"` The kind of resource that the binding provides. - `"r2_bucket"` - `jurisdiction?: "eu" | "fedramp" | "fedramp-high"` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `"eu"` - `"fedramp"` - `"fedramp-high"` - `WorkersBindingKindSecretText` - `name: string` A JavaScript variable name for the binding. - `text: string` The secret value to use. - `type: "secret_text"` The kind of resource that the binding provides. - `"secret_text"` - `WorkersBindingKindSendEmail` - `name: string` A JavaScript variable name for the binding. - `type: "send_email"` The kind of resource that the binding provides. - `"send_email"` - `allowed_destination_addresses?: Array` List of allowed destination addresses. - `allowed_sender_addresses?: Array` List of allowed sender addresses. - `destination_address?: string` Destination address for the email. - `WorkersBindingKindService` - `name: string` A JavaScript variable name for the binding. - `service: string` Name of Worker to bind to. - `type: "service"` The kind of resource that the binding provides. - `"service"` - `entrypoint?: string` Entrypoint to invoke on the target Worker. - `environment?: string` Optional environment if the Worker utilizes one. - `WorkersBindingKindTextBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `type: "text_blob"` The kind of resource that the binding provides. - `"text_blob"` - `WorkersBindingKindVectorize` - `index_name: string` Name of the Vectorize index to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "vectorize"` The kind of resource that the binding provides. - `"vectorize"` - `WorkersBindingKindVersionMetadata` - `name: string` A JavaScript variable name for the binding. - `type: "version_metadata"` The kind of resource that the binding provides. - `"version_metadata"` - `WorkersBindingKindSecretsStoreSecret` - `name: string` A JavaScript variable name for the binding. - `secret_name: string` Name of the secret in the store. - `store_id: string` ID of the store containing the secret. - `type: "secrets_store_secret"` The kind of resource that the binding provides. - `"secrets_store_secret"` - `WorkersBindingKindFlagship` - `app_id: string` ID of the Flagship app to bind to for feature flag evaluation. - `name: string` A JavaScript variable name for the binding. - `type: "flagship"` The kind of resource that the binding provides. - `"flagship"` - `WorkersBindingKindSecretKey` - `algorithm: unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `format: "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: string` A JavaScript variable name for the binding. - `type: "secret_key"` The kind of resource that the binding provides. - `"secret_key"` - `usages: Array<"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?: string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `key_jwk?: unknown` 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". - `WorkersBindingKindWorkflow` - `name: string` A JavaScript variable name for the binding. - `type: "workflow"` The kind of resource that the binding provides. - `"workflow"` - `workflow_name: string` Name of the Workflow to bind to. - `class_name?: string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `script_name?: string` Script name that contains the Workflow. If not provided, defaults to this script name. - `WorkersBindingKindWasmModule` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `type: "wasm_module"` The kind of resource that the binding provides. - `"wasm_module"` - `WorkersBindingKindVPCService` - `name: string` A JavaScript variable name for the binding. - `service_id: string` Identifier of the VPC service to bind to. - `type: "vpc_service"` The kind of resource that the binding provides. - `"vpc_service"` - `WorkersBindingKindVPCNetwork` - `name: string` A JavaScript variable name for the binding. - `type: "vpc_network"` The kind of resource that the binding provides. - `"vpc_network"` - `network_id?: string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `tunnel_id?: string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `cache_options?: CacheOptions` Global CacheW configuration for the Worker. When caching is on, the platform provisions a `cloudflare.app` zone for the Worker. A `type: worker` entry in the `exports` map can override this value for a single entrypoint. - `enabled: boolean` Whether caching is enabled for this Worker. - `cross_version_cache?: boolean` Whether cached responses are shared across Worker version uploads. This is independent of `enabled`. It can stay true while caching is off, so the preference survives turning caching off and back on. - `compatibility_date?: string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `compatibility_flags?: Array` 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`. - `containers?: Array` List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. - `class_name: string` Select which Durable Object class should get this container attached. - `exports?: Record` Declarative exports for the version, including Durable Object classes (with their `storage` backend) and named Worker entrypoints. On reads, tombstoned lifecycle entries are omitted, so only live exports (`created` and `expecting-transfer`) are returned. `exports` and `migrations` are mutually exclusive on upload. - `WorkersWorkerExport` A named Worker entrypoint export (`type: worker`). Worker entrypoints are always live (`state: created`) and carry no storage or lifecycle fields. The optional `cache` block overrides the Worker's global `cache_options.enabled` for this entrypoint. - `type: "worker"` Marks this entry as a Worker entrypoint export. - `"worker"` - `cache?: Cache` Cache override for this entrypoint. Overrides the Worker's global `cache_options.enabled` for this entrypoint only. - `enabled: boolean` Whether caching is enabled for this entrypoint. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectExport` A live Durable Object export (`state: created`, the default). The platform auto-provisions the namespace on first deploy, matches it on subsequent deploys, and never mutates or deletes it as a side effect of a code-only change. `storage` is required; `renamed_to`, `transferred_to` and `transfer_from` are not allowed on a live entry. - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object. When set, the namespace is container-enabled. Valid only on live entries. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectDeletedExport` A `deleted` tombstone: retires the provisioned namespace for this class and all of its data. The class must be absent from the uploaded code and no other Worker in the account may bind to the namespace, otherwise the deploy is rejected. No other fields are allowed. Deletion is irreversible. - `state: "deleted"` Tombstone that deletes the namespace. - `"deleted"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectRenamedExport` A `renamed` tombstone: rewrites the provisioned namespace's class name from this map key to `renamed_to`. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `transferred_to` and `transfer_from` are not allowed. - `renamed_to: string` The destination class name. Must differ from the source class (the map key) and must be declared as a live (`created`) entry in the same `exports` map. Write-only: never present in GET responses. - `state: "renamed"` Tombstone that renames the namespace's class. - `"renamed"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectTransferredExport` A `transferred` tombstone (source side of a two-phase transfer): hands ownership of the provisioned namespace to another script in the same account, named by `transferred_to`. The target must have already deployed a matching `expecting-transfer` entry. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `renamed_to` and `transfer_from` are not allowed. - `state: "transferred"` Tombstone that transfers the namespace to another script. - `"transferred"` - `transferred_to: string` The destination script name. Must be in the same account and the same dispatch-namespace context (or both non-dispatch). Cross-dispatch-namespace transfers are rejected. Write-only: never present in GET responses. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectExpectingTransferExport` The target side of a two-phase transfer (`state: expecting-transfer`). Declares that this script expects to receive a namespace for this class from the `transfer_from` script. This is a live entry, not a tombstone: bindings resolve through the source's namespace until the source commits with a `transferred` tombstone. `storage` and `transfer_from` are required; `renamed_to` and `transferred_to` are not allowed. - `state: "expecting-transfer"` Target side of a two-phase transfer. - `"expecting-transfer"` - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `transfer_from: string` The source script name to receive the namespace from. Must be in the same account and dispatch-namespace context. Present on reads for `expecting-transfer` entries. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object once the transfer settles. Valid only on live entries. - `exports_reconciliation?: ExportsReconciliation` Summary of the declarative exports reconciliation that ran on this upload. Populated only when the uploaded metadata included an `exports` block. Durable Object entries drive reconciliation; `type: worker` entries do not contribute to this summary. - `created: Array` Class names for which a new namespace was provisioned. - `deleted: Array` Class names whose namespace was deleted by a `deleted` tombstone. - `info: Array` Non-blocking info entries (stale tombstones, tombstone applied with class still in code). See `exports_reconciliation_info`. - `class: string` The class name the info entry is about. - `message: string` Human-readable explanation. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the entry relates to, when applicable. - `referencing_scripts?: Array` Other Workers in the account that still bind to the affected class. Advisory: while non-empty the tombstone is not yet safe to remove — redeploy these Workers with bindings re-pointed first. - `removable_entries: Array` Source class names whose tombstone entry is now stale and safe to delete from `exports` (no remaining referencing scripts). - `renamed: Array` Applied `renamed` tombstones. - `from: string` The original (source) class name. - `to: string` The new class name (`renamed_to`). - `transfer_pending: Array` Phase-1 transfer hints recorded on the target side. - `class: string` The target-side class name awaiting transfer. - `from: string` The source script the namespace will be transferred from. - `transferred: Array` Committed `transferred` tombstones (phase-2). - `class: string` The source class name that was transferred. - `phase: "committed"` The transfer phase. Currently always `committed`. - `"committed"` - `to: string` The destination script that now owns the namespace. - `updated: Array` Class names whose provisioned namespace was mutated in place. - `warnings: Array` Non-blocking warnings. See `exports_reconciliation_warning`. - `class: string` The class name the warning is about. - `message: string` Human-readable explanation of the warning. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the warning relates to, when applicable. - `limits?: Limits` Resource limits enforced at runtime. - `cpu_ms?: number` CPU time limit in milliseconds. - `subrequests?: number` Subrequest limit per request. - `main_module?: string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migration_tag?: string` Durable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `SingleStepMigration` A single set of migrations to apply. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `WorkersMultipleStepMigrations` - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps?: Array` Migrations to apply in order. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `modules?: Array` 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: string` The base64-encoded module content. - `content_type: string` The content type of the module. - `name: string` The name of the module. - `package_dependencies?: Array` The list of npm packages that were installed and used when this Worker version was built. - `installedVersion: string` The exact version that was resolved and installed by the package manager. - `name: string` The npm package name. - `packageJsonVersion: string` The version constraint as written in package.json. - `placement?: Mode | Region | Hostname | 5 more` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `Mode` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `Region` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host and port for targeted placement. - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember7` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `target: Array` Array of placement targets (currently limited to single target). - `Region` - `region: string` Cloud region in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host:port for targeted placement. - `source?: string` The client used to create the version. - `startup_time_ms?: number` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const version = await client.workers.beta.workers.versions.get('version_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', worker_id: 'worker_id', }); console.log(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": true }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "cache_options": { "enabled": true, "cross_version_cache": true }, "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "containers": [ { "class_name": "MyDurableObject" } ], "exports": { "Admin": { "type": "worker", "cache": { "enabled": true }, "state": "created" }, "Counter": { "storage": "sqlite", "type": "durable-object", "container": "my-container", "state": "created" }, "OldCounter": { "state": "renamed", "type": "durable-object" }, "default": { "type": "worker", "cache": { "enabled": false }, "state": "created" } }, "exports_reconciliation": { "created": [ "string" ], "deleted": [ "string" ], "info": [ { "class": "class", "message": "message", "scenario": "code_class_not_in_exports", "namespace_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "referencing_scripts": [ "string" ] } ], "removable_entries": [ "string" ], "renamed": [ { "from": "from", "to": "to" } ], "transfer_pending": [ { "class": "class", "from": "from" } ], "transferred": [ { "class": "class", "phase": "committed", "to": "to" } ], "updated": [ "string" ], "warnings": [ { "class": "class", "message": "message", "scenario": "code_class_not_in_exports", "namespace_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ] }, "limits": { "cpu_ms": 50, "subrequests": 1000 }, "main_module": "index.js", "migration_tag": "v1", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "package_dependencies": [ { "installedVersion": "4.17.22", "name": "lodash", "packageJsonVersion": "^4.17.21" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" }, "success": true } ``` ## Create Version `client.workers.beta.workers.versions.create(stringworkerID, VersionCreateParamsparams, RequestOptionsoptions?): Version` **post** `/accounts/{account_id}/workers/workers/{worker_id}/versions` Create a new version. ### Parameters - `workerID: string` Identifier for the Worker, which can be ID or name. - `params: VersionCreateParams` - `account_id: string` Path param: Identifier. - `deploy?: boolean` Query param: If true, a deployment will be created that sends 100% of traffic to the new version. - `annotations?: Annotations` Body param: Metadata about the version. - `"workers/message"?: string` Human-readable message about the version. Truncated to 1000 bytes if longer. - `"workers/tag"?: string` User-provided identifier for the version. Maximum 100 bytes. - `"workers/triggered_by"?: string` Operation that triggered the creation of the version. - `assets?: Assets` Body param: 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?: Config` Configuration for assets within a Worker. - `html_handling?: "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?: "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?: Array | boolean` 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. - `Array` - `boolean` - `jwt?: string` Token provided upon successful upload of all files from a registered manifest. - `bindings?: Array` Body param: 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. - `WorkersBindingKindAI` - `name: string` A JavaScript variable name for the binding. - `type: "ai"` The kind of resource that the binding provides. - `"ai"` - `WorkersBindingKindAISearch` - `instance_name: string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `name: string` A JavaScript variable name for the binding. - `type: "ai_search"` The kind of resource that the binding provides. - `"ai_search"` - `namespace?: string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `WorkersBindingKindAISearchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` 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: "ai_search_namespace"` The kind of resource that the binding provides. - `"ai_search_namespace"` - `WorkersBindingKindMessaging` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The Messaging namespace to bind to. - `type: "messaging"` The kind of resource that the binding provides. - `"messaging"` - `WorkersBindingKindAnalyticsEngine` - `dataset: string` The name of the dataset to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "analytics_engine"` The kind of resource that the binding provides. - `"analytics_engine"` - `WorkersBindingKindAssets` - `name: string` A JavaScript variable name for the binding. - `type: "assets"` The kind of resource that the binding provides. - `"assets"` - `WorkersBindingKindBrowser` - `name: string` A JavaScript variable name for the binding. - `type: "browser"` The kind of resource that the binding provides. - `"browser"` - `WorkersBindingKindD1` - `database_id: string` Identifier of the D1 database to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "d1"` The kind of resource that the binding provides. - `"d1"` - `id?: string` Identifier of the D1 database to bind to. - `WorkersBindingKindDataBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `type: "data_blob"` The kind of resource that the binding provides. - `"data_blob"` - `WorkersBindingKindDispatchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The name of the dispatch namespace. - `type: "dispatch_namespace"` The kind of resource that the binding provides. - `"dispatch_namespace"` - `outbound?: Outbound` Outbound worker. - `params?: Array` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `name: string` Name of the parameter. - `worker?: Worker` Outbound worker. - `entrypoint?: string` Entrypoint to invoke on the outbound worker. - `environment?: string` Environment of the outbound worker. - `service?: string` Name of the outbound worker. - `WorkersBindingKindDurableObjectNamespace` - `name: string` A JavaScript variable name for the binding. - `type: "durable_object_namespace"` The kind of resource that the binding provides. - `"durable_object_namespace"` - `class_name?: string` The exported class name of the Durable Object. - `dispatch_namespace?: string` The dispatch namespace the Durable Object script belongs to. - `environment?: string` The environment of the script_name to bind to. - `namespace_id?: string` Namespace identifier tag. - `script_name?: string` The script where the Durable Object is defined, if it is external to this Worker. - `WorkersBindingKindHyperdrive` - `id: string` Identifier of the Hyperdrive connection to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "hyperdrive"` The kind of resource that the binding provides. - `"hyperdrive"` - `WorkersBindingKindInherit` - `name: string` The name of the inherited binding. - `type: "inherit"` The kind of resource that the binding provides. - `"inherit"` - `old_name?: string` 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?: string` 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. - `WorkersBindingKindImages` - `name: string` A JavaScript variable name for the binding. - `type: "images"` The kind of resource that the binding provides. - `"images"` - `WorkersBindingKindJson` - `json: unknown` JSON data to use. - `name: string` A JavaScript variable name for the binding. - `type: "json"` The kind of resource that the binding provides. - `"json"` - `WorkersBindingKindKVNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Namespace identifier tag. - `type: "kv_namespace"` The kind of resource that the binding provides. - `"kv_namespace"` - `WorkersBindingKindMedia` - `name: string` A JavaScript variable name for the binding. - `type: "media"` The kind of resource that the binding provides. - `"media"` - `WorkersBindingKindMTLSCertificate` - `certificate_id: string` Identifier of the certificate to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "mtls_certificate"` The kind of resource that the binding provides. - `"mtls_certificate"` - `WorkersBindingKindPlainText` - `name: string` A JavaScript variable name for the binding. - `text: string` The text value to use. - `type: "plain_text"` The kind of resource that the binding provides. - `"plain_text"` - `WorkersBindingKindPipelines` - `name: string` A JavaScript variable name for the binding. - `pipeline: string` Name of the Pipeline to bind to. - `type: "pipelines"` The kind of resource that the binding provides. - `"pipelines"` - `WorkersBindingKindQueue` - `name: string` A JavaScript variable name for the binding. - `queue_name: string` Name of the Queue to bind to. - `type: "queue"` The kind of resource that the binding provides. - `"queue"` - `WorkersBindingKindRatelimit` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Identifier of the rate limit namespace to bind to. - `simple: Simple` The rate limit configuration. - `limit: number` The limit (requests per period). - `period: number` The period in seconds. - `mitigation_timeout?: number` Duration in seconds to apply the mitigation action after the rate limit is exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400. Must be greater than or equal to the period when non-zero. - `type: "ratelimit"` The kind of resource that the binding provides. - `"ratelimit"` - `WorkersBindingKindR2Bucket` - `bucket_name: string` R2 bucket to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "r2_bucket"` The kind of resource that the binding provides. - `"r2_bucket"` - `jurisdiction?: "eu" | "fedramp" | "fedramp-high"` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `"eu"` - `"fedramp"` - `"fedramp-high"` - `WorkersBindingKindSecretText` - `name: string` A JavaScript variable name for the binding. - `text: string` The secret value to use. - `type: "secret_text"` The kind of resource that the binding provides. - `"secret_text"` - `WorkersBindingKindSendEmail` - `name: string` A JavaScript variable name for the binding. - `type: "send_email"` The kind of resource that the binding provides. - `"send_email"` - `allowed_destination_addresses?: Array` List of allowed destination addresses. - `allowed_sender_addresses?: Array` List of allowed sender addresses. - `destination_address?: string` Destination address for the email. - `WorkersBindingKindService` - `name: string` A JavaScript variable name for the binding. - `service: string` Name of Worker to bind to. - `type: "service"` The kind of resource that the binding provides. - `"service"` - `entrypoint?: string` Entrypoint to invoke on the target Worker. - `environment?: string` Optional environment if the Worker utilizes one. - `WorkersBindingKindTextBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `type: "text_blob"` The kind of resource that the binding provides. - `"text_blob"` - `WorkersBindingKindVectorize` - `index_name: string` Name of the Vectorize index to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "vectorize"` The kind of resource that the binding provides. - `"vectorize"` - `WorkersBindingKindVersionMetadata` - `name: string` A JavaScript variable name for the binding. - `type: "version_metadata"` The kind of resource that the binding provides. - `"version_metadata"` - `WorkersBindingKindSecretsStoreSecret` - `name: string` A JavaScript variable name for the binding. - `secret_name: string` Name of the secret in the store. - `store_id: string` ID of the store containing the secret. - `type: "secrets_store_secret"` The kind of resource that the binding provides. - `"secrets_store_secret"` - `WorkersBindingKindFlagship` - `app_id: string` ID of the Flagship app to bind to for feature flag evaluation. - `name: string` A JavaScript variable name for the binding. - `type: "flagship"` The kind of resource that the binding provides. - `"flagship"` - `WorkersBindingKindSecretKey` - `algorithm: unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `format: "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: string` A JavaScript variable name for the binding. - `type: "secret_key"` The kind of resource that the binding provides. - `"secret_key"` - `usages: Array<"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?: string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `key_jwk?: unknown` 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". - `WorkersBindingKindWorkflow` - `name: string` A JavaScript variable name for the binding. - `type: "workflow"` The kind of resource that the binding provides. - `"workflow"` - `workflow_name: string` Name of the Workflow to bind to. - `class_name?: string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `script_name?: string` Script name that contains the Workflow. If not provided, defaults to this script name. - `WorkersBindingKindWasmModule` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `type: "wasm_module"` The kind of resource that the binding provides. - `"wasm_module"` - `WorkersBindingKindVPCService` - `name: string` A JavaScript variable name for the binding. - `service_id: string` Identifier of the VPC service to bind to. - `type: "vpc_service"` The kind of resource that the binding provides. - `"vpc_service"` - `WorkersBindingKindVPCNetwork` - `name: string` A JavaScript variable name for the binding. - `type: "vpc_network"` The kind of resource that the binding provides. - `"vpc_network"` - `network_id?: string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `tunnel_id?: string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `cache_options?: CacheOptions` Body param: Global CacheW configuration for the Worker. When caching is on, the platform provisions a `cloudflare.app` zone for the Worker. A `type: worker` entry in the `exports` map can override this value for a single entrypoint. - `enabled: boolean` Whether caching is enabled for this Worker. - `cross_version_cache?: boolean` Whether cached responses are shared across Worker version uploads. This is independent of `enabled`. It can stay true while caching is off, so the preference survives turning caching off and back on. - `compatibility_date?: string` Body param: Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `compatibility_flags?: Array` Body param: 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`. - `containers?: Array` Body param: List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. - `class_name: string` Select which Durable Object class should get this container attached. - `exports?: Record` Body param: Declarative exports for the version, including Durable Object classes (with their `storage` backend) and named Worker entrypoints. On reads, tombstoned lifecycle entries are omitted, so only live exports (`created` and `expecting-transfer`) are returned. `exports` and `migrations` are mutually exclusive on upload. - `WorkersWorkerExport` A named Worker entrypoint export (`type: worker`). Worker entrypoints are always live (`state: created`) and carry no storage or lifecycle fields. The optional `cache` block overrides the Worker's global `cache_options.enabled` for this entrypoint. - `type: "worker"` Marks this entry as a Worker entrypoint export. - `"worker"` - `cache?: Cache` Cache override for this entrypoint. Overrides the Worker's global `cache_options.enabled` for this entrypoint only. - `enabled: boolean` Whether caching is enabled for this entrypoint. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectExport` A live Durable Object export (`state: created`, the default). The platform auto-provisions the namespace on first deploy, matches it on subsequent deploys, and never mutates or deletes it as a side effect of a code-only change. `storage` is required; `renamed_to`, `transferred_to` and `transfer_from` are not allowed on a live entry. - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object. When set, the namespace is container-enabled. Valid only on live entries. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectDeletedExport` A `deleted` tombstone: retires the provisioned namespace for this class and all of its data. The class must be absent from the uploaded code and no other Worker in the account may bind to the namespace, otherwise the deploy is rejected. No other fields are allowed. Deletion is irreversible. - `state: "deleted"` Tombstone that deletes the namespace. - `"deleted"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectRenamedExport` A `renamed` tombstone: rewrites the provisioned namespace's class name from this map key to `renamed_to`. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `transferred_to` and `transfer_from` are not allowed. - `renamed_to: string` The destination class name. Must differ from the source class (the map key) and must be declared as a live (`created`) entry in the same `exports` map. Write-only: never present in GET responses. - `state: "renamed"` Tombstone that renames the namespace's class. - `"renamed"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectTransferredExport` A `transferred` tombstone (source side of a two-phase transfer): hands ownership of the provisioned namespace to another script in the same account, named by `transferred_to`. The target must have already deployed a matching `expecting-transfer` entry. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `renamed_to` and `transfer_from` are not allowed. - `state: "transferred"` Tombstone that transfers the namespace to another script. - `"transferred"` - `transferred_to: string` The destination script name. Must be in the same account and the same dispatch-namespace context (or both non-dispatch). Cross-dispatch-namespace transfers are rejected. Write-only: never present in GET responses. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectExpectingTransferExport` The target side of a two-phase transfer (`state: expecting-transfer`). Declares that this script expects to receive a namespace for this class from the `transfer_from` script. This is a live entry, not a tombstone: bindings resolve through the source's namespace until the source commits with a `transferred` tombstone. `storage` and `transfer_from` are required; `renamed_to` and `transferred_to` are not allowed. - `state: "expecting-transfer"` Target side of a two-phase transfer. - `"expecting-transfer"` - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `transfer_from: string` The source script name to receive the namespace from. Must be in the same account and dispatch-namespace context. Present on reads for `expecting-transfer` entries. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object once the transfer settles. Valid only on live entries. - `limits?: Limits` Body param: Resource limits enforced at runtime. - `cpu_ms?: number` CPU time limit in milliseconds. - `subrequests?: number` Subrequest limit per request. - `main_module?: string` Body param: The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Body param: Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `SingleStepMigration` A single set of migrations to apply. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `WorkersMultipleStepMigrations` - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps?: Array` Migrations to apply in order. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `modules?: Array` Body param: 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: string` The base64-encoded module content. - `content_type: string` The content type of the module. - `name: string` The name of the module. - `package_dependencies?: Array` Body param: The list of npm packages that were installed and used when this Worker version was built. - `installedVersion: string` The exact version that was resolved and installed by the package manager. - `name: string` The npm package name. - `packageJsonVersion: string` The version constraint as written in package.json. - `placement?: Mode | Region | Hostname | 5 more` Body param: Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `Mode` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `Region` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host and port for targeted placement. - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember7` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `target: Array` Array of placement targets (currently limited to single target). - `Region` - `region: string` Cloud region in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host:port for targeted placement. - `usage_model?: "standard" | "bundled" | "unbound"` Body param: Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Returns - `Version` - `id: string` Version identifier. - `created_on: string` When the version was created. - `number: number` The integer version number, starting from one. - `urls: Array` 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?: Annotations` Metadata about the version. - `"workers/message"?: string` Human-readable message about the version. Truncated to 1000 bytes if longer. - `"workers/tag"?: string` User-provided identifier for the version. Maximum 100 bytes. - `"workers/triggered_by"?: string` Operation that triggered the creation of the version. - `assets?: 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?: Config` Configuration for assets within a Worker. - `html_handling?: "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?: "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?: Array | boolean` 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. - `Array` - `boolean` - `jwt?: string` Token provided upon successful upload of all files from a registered manifest. - `bindings?: Array` 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. - `WorkersBindingKindAI` - `name: string` A JavaScript variable name for the binding. - `type: "ai"` The kind of resource that the binding provides. - `"ai"` - `WorkersBindingKindAISearch` - `instance_name: string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `name: string` A JavaScript variable name for the binding. - `type: "ai_search"` The kind of resource that the binding provides. - `"ai_search"` - `namespace?: string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `WorkersBindingKindAISearchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` 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: "ai_search_namespace"` The kind of resource that the binding provides. - `"ai_search_namespace"` - `WorkersBindingKindMessaging` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The Messaging namespace to bind to. - `type: "messaging"` The kind of resource that the binding provides. - `"messaging"` - `WorkersBindingKindAnalyticsEngine` - `dataset: string` The name of the dataset to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "analytics_engine"` The kind of resource that the binding provides. - `"analytics_engine"` - `WorkersBindingKindAssets` - `name: string` A JavaScript variable name for the binding. - `type: "assets"` The kind of resource that the binding provides. - `"assets"` - `WorkersBindingKindBrowser` - `name: string` A JavaScript variable name for the binding. - `type: "browser"` The kind of resource that the binding provides. - `"browser"` - `WorkersBindingKindD1` - `database_id: string` Identifier of the D1 database to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "d1"` The kind of resource that the binding provides. - `"d1"` - `id?: string` Identifier of the D1 database to bind to. - `WorkersBindingKindDataBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `type: "data_blob"` The kind of resource that the binding provides. - `"data_blob"` - `WorkersBindingKindDispatchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The name of the dispatch namespace. - `type: "dispatch_namespace"` The kind of resource that the binding provides. - `"dispatch_namespace"` - `outbound?: Outbound` Outbound worker. - `params?: Array` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `name: string` Name of the parameter. - `worker?: Worker` Outbound worker. - `entrypoint?: string` Entrypoint to invoke on the outbound worker. - `environment?: string` Environment of the outbound worker. - `service?: string` Name of the outbound worker. - `WorkersBindingKindDurableObjectNamespace` - `name: string` A JavaScript variable name for the binding. - `type: "durable_object_namespace"` The kind of resource that the binding provides. - `"durable_object_namespace"` - `class_name?: string` The exported class name of the Durable Object. - `dispatch_namespace?: string` The dispatch namespace the Durable Object script belongs to. - `environment?: string` The environment of the script_name to bind to. - `namespace_id?: string` Namespace identifier tag. - `script_name?: string` The script where the Durable Object is defined, if it is external to this Worker. - `WorkersBindingKindHyperdrive` - `id: string` Identifier of the Hyperdrive connection to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "hyperdrive"` The kind of resource that the binding provides. - `"hyperdrive"` - `WorkersBindingKindInherit` - `name: string` The name of the inherited binding. - `type: "inherit"` The kind of resource that the binding provides. - `"inherit"` - `old_name?: string` 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?: string` 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. - `WorkersBindingKindImages` - `name: string` A JavaScript variable name for the binding. - `type: "images"` The kind of resource that the binding provides. - `"images"` - `WorkersBindingKindJson` - `json: unknown` JSON data to use. - `name: string` A JavaScript variable name for the binding. - `type: "json"` The kind of resource that the binding provides. - `"json"` - `WorkersBindingKindKVNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Namespace identifier tag. - `type: "kv_namespace"` The kind of resource that the binding provides. - `"kv_namespace"` - `WorkersBindingKindMedia` - `name: string` A JavaScript variable name for the binding. - `type: "media"` The kind of resource that the binding provides. - `"media"` - `WorkersBindingKindMTLSCertificate` - `certificate_id: string` Identifier of the certificate to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "mtls_certificate"` The kind of resource that the binding provides. - `"mtls_certificate"` - `WorkersBindingKindPlainText` - `name: string` A JavaScript variable name for the binding. - `text: string` The text value to use. - `type: "plain_text"` The kind of resource that the binding provides. - `"plain_text"` - `WorkersBindingKindPipelines` - `name: string` A JavaScript variable name for the binding. - `pipeline: string` Name of the Pipeline to bind to. - `type: "pipelines"` The kind of resource that the binding provides. - `"pipelines"` - `WorkersBindingKindQueue` - `name: string` A JavaScript variable name for the binding. - `queue_name: string` Name of the Queue to bind to. - `type: "queue"` The kind of resource that the binding provides. - `"queue"` - `WorkersBindingKindRatelimit` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Identifier of the rate limit namespace to bind to. - `simple: Simple` The rate limit configuration. - `limit: number` The limit (requests per period). - `period: number` The period in seconds. - `mitigation_timeout?: number` Duration in seconds to apply the mitigation action after the rate limit is exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400. Must be greater than or equal to the period when non-zero. - `type: "ratelimit"` The kind of resource that the binding provides. - `"ratelimit"` - `WorkersBindingKindR2Bucket` - `bucket_name: string` R2 bucket to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "r2_bucket"` The kind of resource that the binding provides. - `"r2_bucket"` - `jurisdiction?: "eu" | "fedramp" | "fedramp-high"` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `"eu"` - `"fedramp"` - `"fedramp-high"` - `WorkersBindingKindSecretText` - `name: string` A JavaScript variable name for the binding. - `text: string` The secret value to use. - `type: "secret_text"` The kind of resource that the binding provides. - `"secret_text"` - `WorkersBindingKindSendEmail` - `name: string` A JavaScript variable name for the binding. - `type: "send_email"` The kind of resource that the binding provides. - `"send_email"` - `allowed_destination_addresses?: Array` List of allowed destination addresses. - `allowed_sender_addresses?: Array` List of allowed sender addresses. - `destination_address?: string` Destination address for the email. - `WorkersBindingKindService` - `name: string` A JavaScript variable name for the binding. - `service: string` Name of Worker to bind to. - `type: "service"` The kind of resource that the binding provides. - `"service"` - `entrypoint?: string` Entrypoint to invoke on the target Worker. - `environment?: string` Optional environment if the Worker utilizes one. - `WorkersBindingKindTextBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `type: "text_blob"` The kind of resource that the binding provides. - `"text_blob"` - `WorkersBindingKindVectorize` - `index_name: string` Name of the Vectorize index to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "vectorize"` The kind of resource that the binding provides. - `"vectorize"` - `WorkersBindingKindVersionMetadata` - `name: string` A JavaScript variable name for the binding. - `type: "version_metadata"` The kind of resource that the binding provides. - `"version_metadata"` - `WorkersBindingKindSecretsStoreSecret` - `name: string` A JavaScript variable name for the binding. - `secret_name: string` Name of the secret in the store. - `store_id: string` ID of the store containing the secret. - `type: "secrets_store_secret"` The kind of resource that the binding provides. - `"secrets_store_secret"` - `WorkersBindingKindFlagship` - `app_id: string` ID of the Flagship app to bind to for feature flag evaluation. - `name: string` A JavaScript variable name for the binding. - `type: "flagship"` The kind of resource that the binding provides. - `"flagship"` - `WorkersBindingKindSecretKey` - `algorithm: unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `format: "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: string` A JavaScript variable name for the binding. - `type: "secret_key"` The kind of resource that the binding provides. - `"secret_key"` - `usages: Array<"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?: string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `key_jwk?: unknown` 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". - `WorkersBindingKindWorkflow` - `name: string` A JavaScript variable name for the binding. - `type: "workflow"` The kind of resource that the binding provides. - `"workflow"` - `workflow_name: string` Name of the Workflow to bind to. - `class_name?: string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `script_name?: string` Script name that contains the Workflow. If not provided, defaults to this script name. - `WorkersBindingKindWasmModule` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `type: "wasm_module"` The kind of resource that the binding provides. - `"wasm_module"` - `WorkersBindingKindVPCService` - `name: string` A JavaScript variable name for the binding. - `service_id: string` Identifier of the VPC service to bind to. - `type: "vpc_service"` The kind of resource that the binding provides. - `"vpc_service"` - `WorkersBindingKindVPCNetwork` - `name: string` A JavaScript variable name for the binding. - `type: "vpc_network"` The kind of resource that the binding provides. - `"vpc_network"` - `network_id?: string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `tunnel_id?: string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `cache_options?: CacheOptions` Global CacheW configuration for the Worker. When caching is on, the platform provisions a `cloudflare.app` zone for the Worker. A `type: worker` entry in the `exports` map can override this value for a single entrypoint. - `enabled: boolean` Whether caching is enabled for this Worker. - `cross_version_cache?: boolean` Whether cached responses are shared across Worker version uploads. This is independent of `enabled`. It can stay true while caching is off, so the preference survives turning caching off and back on. - `compatibility_date?: string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `compatibility_flags?: Array` 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`. - `containers?: Array` List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. - `class_name: string` Select which Durable Object class should get this container attached. - `exports?: Record` Declarative exports for the version, including Durable Object classes (with their `storage` backend) and named Worker entrypoints. On reads, tombstoned lifecycle entries are omitted, so only live exports (`created` and `expecting-transfer`) are returned. `exports` and `migrations` are mutually exclusive on upload. - `WorkersWorkerExport` A named Worker entrypoint export (`type: worker`). Worker entrypoints are always live (`state: created`) and carry no storage or lifecycle fields. The optional `cache` block overrides the Worker's global `cache_options.enabled` for this entrypoint. - `type: "worker"` Marks this entry as a Worker entrypoint export. - `"worker"` - `cache?: Cache` Cache override for this entrypoint. Overrides the Worker's global `cache_options.enabled` for this entrypoint only. - `enabled: boolean` Whether caching is enabled for this entrypoint. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectExport` A live Durable Object export (`state: created`, the default). The platform auto-provisions the namespace on first deploy, matches it on subsequent deploys, and never mutates or deletes it as a side effect of a code-only change. `storage` is required; `renamed_to`, `transferred_to` and `transfer_from` are not allowed on a live entry. - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object. When set, the namespace is container-enabled. Valid only on live entries. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectDeletedExport` A `deleted` tombstone: retires the provisioned namespace for this class and all of its data. The class must be absent from the uploaded code and no other Worker in the account may bind to the namespace, otherwise the deploy is rejected. No other fields are allowed. Deletion is irreversible. - `state: "deleted"` Tombstone that deletes the namespace. - `"deleted"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectRenamedExport` A `renamed` tombstone: rewrites the provisioned namespace's class name from this map key to `renamed_to`. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `transferred_to` and `transfer_from` are not allowed. - `renamed_to: string` The destination class name. Must differ from the source class (the map key) and must be declared as a live (`created`) entry in the same `exports` map. Write-only: never present in GET responses. - `state: "renamed"` Tombstone that renames the namespace's class. - `"renamed"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectTransferredExport` A `transferred` tombstone (source side of a two-phase transfer): hands ownership of the provisioned namespace to another script in the same account, named by `transferred_to`. The target must have already deployed a matching `expecting-transfer` entry. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `renamed_to` and `transfer_from` are not allowed. - `state: "transferred"` Tombstone that transfers the namespace to another script. - `"transferred"` - `transferred_to: string` The destination script name. Must be in the same account and the same dispatch-namespace context (or both non-dispatch). Cross-dispatch-namespace transfers are rejected. Write-only: never present in GET responses. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectExpectingTransferExport` The target side of a two-phase transfer (`state: expecting-transfer`). Declares that this script expects to receive a namespace for this class from the `transfer_from` script. This is a live entry, not a tombstone: bindings resolve through the source's namespace until the source commits with a `transferred` tombstone. `storage` and `transfer_from` are required; `renamed_to` and `transferred_to` are not allowed. - `state: "expecting-transfer"` Target side of a two-phase transfer. - `"expecting-transfer"` - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `transfer_from: string` The source script name to receive the namespace from. Must be in the same account and dispatch-namespace context. Present on reads for `expecting-transfer` entries. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object once the transfer settles. Valid only on live entries. - `exports_reconciliation?: ExportsReconciliation` Summary of the declarative exports reconciliation that ran on this upload. Populated only when the uploaded metadata included an `exports` block. Durable Object entries drive reconciliation; `type: worker` entries do not contribute to this summary. - `created: Array` Class names for which a new namespace was provisioned. - `deleted: Array` Class names whose namespace was deleted by a `deleted` tombstone. - `info: Array` Non-blocking info entries (stale tombstones, tombstone applied with class still in code). See `exports_reconciliation_info`. - `class: string` The class name the info entry is about. - `message: string` Human-readable explanation. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the entry relates to, when applicable. - `referencing_scripts?: Array` Other Workers in the account that still bind to the affected class. Advisory: while non-empty the tombstone is not yet safe to remove — redeploy these Workers with bindings re-pointed first. - `removable_entries: Array` Source class names whose tombstone entry is now stale and safe to delete from `exports` (no remaining referencing scripts). - `renamed: Array` Applied `renamed` tombstones. - `from: string` The original (source) class name. - `to: string` The new class name (`renamed_to`). - `transfer_pending: Array` Phase-1 transfer hints recorded on the target side. - `class: string` The target-side class name awaiting transfer. - `from: string` The source script the namespace will be transferred from. - `transferred: Array` Committed `transferred` tombstones (phase-2). - `class: string` The source class name that was transferred. - `phase: "committed"` The transfer phase. Currently always `committed`. - `"committed"` - `to: string` The destination script that now owns the namespace. - `updated: Array` Class names whose provisioned namespace was mutated in place. - `warnings: Array` Non-blocking warnings. See `exports_reconciliation_warning`. - `class: string` The class name the warning is about. - `message: string` Human-readable explanation of the warning. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the warning relates to, when applicable. - `limits?: Limits` Resource limits enforced at runtime. - `cpu_ms?: number` CPU time limit in milliseconds. - `subrequests?: number` Subrequest limit per request. - `main_module?: string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migration_tag?: string` Durable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `SingleStepMigration` A single set of migrations to apply. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `WorkersMultipleStepMigrations` - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps?: Array` Migrations to apply in order. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `modules?: Array` 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: string` The base64-encoded module content. - `content_type: string` The content type of the module. - `name: string` The name of the module. - `package_dependencies?: Array` The list of npm packages that were installed and used when this Worker version was built. - `installedVersion: string` The exact version that was resolved and installed by the package manager. - `name: string` The npm package name. - `packageJsonVersion: string` The version constraint as written in package.json. - `placement?: Mode | Region | Hostname | 5 more` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `Mode` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `Region` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host and port for targeted placement. - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember7` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `target: Array` Array of placement targets (currently limited to single target). - `Region` - `region: string` Cloud region in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host:port for targeted placement. - `source?: string` The client used to create the version. - `startup_time_ms?: number` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const version = await client.workers.beta.workers.versions.create('worker_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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": true }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "cache_options": { "enabled": true, "cross_version_cache": true }, "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "containers": [ { "class_name": "MyDurableObject" } ], "exports": { "Admin": { "type": "worker", "cache": { "enabled": true }, "state": "created" }, "Counter": { "storage": "sqlite", "type": "durable-object", "container": "my-container", "state": "created" }, "OldCounter": { "state": "renamed", "type": "durable-object" }, "default": { "type": "worker", "cache": { "enabled": false }, "state": "created" } }, "exports_reconciliation": { "created": [ "string" ], "deleted": [ "string" ], "info": [ { "class": "class", "message": "message", "scenario": "code_class_not_in_exports", "namespace_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "referencing_scripts": [ "string" ] } ], "removable_entries": [ "string" ], "renamed": [ { "from": "from", "to": "to" } ], "transfer_pending": [ { "class": "class", "from": "from" } ], "transferred": [ { "class": "class", "phase": "committed", "to": "to" } ], "updated": [ "string" ], "warnings": [ { "class": "class", "message": "message", "scenario": "code_class_not_in_exports", "namespace_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ] }, "limits": { "cpu_ms": 50, "subrequests": 1000 }, "main_module": "index.js", "migration_tag": "v1", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "package_dependencies": [ { "installedVersion": "4.17.22", "name": "lodash", "packageJsonVersion": "^4.17.21" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" }, "success": true } ``` ## Delete Version `client.workers.beta.workers.versions.delete(stringversionID, VersionDeleteParamsparams, RequestOptionsoptions?): VersionDeleteResponse` **delete** `/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}` Delete a version. ### Parameters - `versionID: string` 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. - `params: VersionDeleteParams` - `account_id: string` Identifier. - `worker_id: string` Identifier for the Worker, which can be ID or name. ### Returns - `VersionDeleteResponse` - `errors: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `success: true` Whether the API call was successful. - `true` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const version = await client.workers.beta.workers.versions.delete('version_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', worker_id: 'worker_id', }); console.log(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 - `Version` - `id: string` Version identifier. - `created_on: string` When the version was created. - `number: number` The integer version number, starting from one. - `urls: Array` 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?: Annotations` Metadata about the version. - `"workers/message"?: string` Human-readable message about the version. Truncated to 1000 bytes if longer. - `"workers/tag"?: string` User-provided identifier for the version. Maximum 100 bytes. - `"workers/triggered_by"?: string` Operation that triggered the creation of the version. - `assets?: 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?: Config` Configuration for assets within a Worker. - `html_handling?: "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?: "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?: Array | boolean` 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. - `Array` - `boolean` - `jwt?: string` Token provided upon successful upload of all files from a registered manifest. - `bindings?: Array` 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. - `WorkersBindingKindAI` - `name: string` A JavaScript variable name for the binding. - `type: "ai"` The kind of resource that the binding provides. - `"ai"` - `WorkersBindingKindAISearch` - `instance_name: string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `name: string` A JavaScript variable name for the binding. - `type: "ai_search"` The kind of resource that the binding provides. - `"ai_search"` - `namespace?: string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `WorkersBindingKindAISearchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` 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: "ai_search_namespace"` The kind of resource that the binding provides. - `"ai_search_namespace"` - `WorkersBindingKindMessaging` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The Messaging namespace to bind to. - `type: "messaging"` The kind of resource that the binding provides. - `"messaging"` - `WorkersBindingKindAnalyticsEngine` - `dataset: string` The name of the dataset to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "analytics_engine"` The kind of resource that the binding provides. - `"analytics_engine"` - `WorkersBindingKindAssets` - `name: string` A JavaScript variable name for the binding. - `type: "assets"` The kind of resource that the binding provides. - `"assets"` - `WorkersBindingKindBrowser` - `name: string` A JavaScript variable name for the binding. - `type: "browser"` The kind of resource that the binding provides. - `"browser"` - `WorkersBindingKindD1` - `database_id: string` Identifier of the D1 database to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "d1"` The kind of resource that the binding provides. - `"d1"` - `id?: string` Identifier of the D1 database to bind to. - `WorkersBindingKindDataBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `type: "data_blob"` The kind of resource that the binding provides. - `"data_blob"` - `WorkersBindingKindDispatchNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace: string` The name of the dispatch namespace. - `type: "dispatch_namespace"` The kind of resource that the binding provides. - `"dispatch_namespace"` - `outbound?: Outbound` Outbound worker. - `params?: Array` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `name: string` Name of the parameter. - `worker?: Worker` Outbound worker. - `entrypoint?: string` Entrypoint to invoke on the outbound worker. - `environment?: string` Environment of the outbound worker. - `service?: string` Name of the outbound worker. - `WorkersBindingKindDurableObjectNamespace` - `name: string` A JavaScript variable name for the binding. - `type: "durable_object_namespace"` The kind of resource that the binding provides. - `"durable_object_namespace"` - `class_name?: string` The exported class name of the Durable Object. - `dispatch_namespace?: string` The dispatch namespace the Durable Object script belongs to. - `environment?: string` The environment of the script_name to bind to. - `namespace_id?: string` Namespace identifier tag. - `script_name?: string` The script where the Durable Object is defined, if it is external to this Worker. - `WorkersBindingKindHyperdrive` - `id: string` Identifier of the Hyperdrive connection to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "hyperdrive"` The kind of resource that the binding provides. - `"hyperdrive"` - `WorkersBindingKindInherit` - `name: string` The name of the inherited binding. - `type: "inherit"` The kind of resource that the binding provides. - `"inherit"` - `old_name?: string` 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?: string` 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. - `WorkersBindingKindImages` - `name: string` A JavaScript variable name for the binding. - `type: "images"` The kind of resource that the binding provides. - `"images"` - `WorkersBindingKindJson` - `json: unknown` JSON data to use. - `name: string` A JavaScript variable name for the binding. - `type: "json"` The kind of resource that the binding provides. - `"json"` - `WorkersBindingKindKVNamespace` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Namespace identifier tag. - `type: "kv_namespace"` The kind of resource that the binding provides. - `"kv_namespace"` - `WorkersBindingKindMedia` - `name: string` A JavaScript variable name for the binding. - `type: "media"` The kind of resource that the binding provides. - `"media"` - `WorkersBindingKindMTLSCertificate` - `certificate_id: string` Identifier of the certificate to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "mtls_certificate"` The kind of resource that the binding provides. - `"mtls_certificate"` - `WorkersBindingKindPlainText` - `name: string` A JavaScript variable name for the binding. - `text: string` The text value to use. - `type: "plain_text"` The kind of resource that the binding provides. - `"plain_text"` - `WorkersBindingKindPipelines` - `name: string` A JavaScript variable name for the binding. - `pipeline: string` Name of the Pipeline to bind to. - `type: "pipelines"` The kind of resource that the binding provides. - `"pipelines"` - `WorkersBindingKindQueue` - `name: string` A JavaScript variable name for the binding. - `queue_name: string` Name of the Queue to bind to. - `type: "queue"` The kind of resource that the binding provides. - `"queue"` - `WorkersBindingKindRatelimit` - `name: string` A JavaScript variable name for the binding. - `namespace_id: string` Identifier of the rate limit namespace to bind to. - `simple: Simple` The rate limit configuration. - `limit: number` The limit (requests per period). - `period: number` The period in seconds. - `mitigation_timeout?: number` Duration in seconds to apply the mitigation action after the rate limit is exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400. Must be greater than or equal to the period when non-zero. - `type: "ratelimit"` The kind of resource that the binding provides. - `"ratelimit"` - `WorkersBindingKindR2Bucket` - `bucket_name: string` R2 bucket to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "r2_bucket"` The kind of resource that the binding provides. - `"r2_bucket"` - `jurisdiction?: "eu" | "fedramp" | "fedramp-high"` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `"eu"` - `"fedramp"` - `"fedramp-high"` - `WorkersBindingKindSecretText` - `name: string` A JavaScript variable name for the binding. - `text: string` The secret value to use. - `type: "secret_text"` The kind of resource that the binding provides. - `"secret_text"` - `WorkersBindingKindSendEmail` - `name: string` A JavaScript variable name for the binding. - `type: "send_email"` The kind of resource that the binding provides. - `"send_email"` - `allowed_destination_addresses?: Array` List of allowed destination addresses. - `allowed_sender_addresses?: Array` List of allowed sender addresses. - `destination_address?: string` Destination address for the email. - `WorkersBindingKindService` - `name: string` A JavaScript variable name for the binding. - `service: string` Name of Worker to bind to. - `type: "service"` The kind of resource that the binding provides. - `"service"` - `entrypoint?: string` Entrypoint to invoke on the target Worker. - `environment?: string` Optional environment if the Worker utilizes one. - `WorkersBindingKindTextBlob` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `type: "text_blob"` The kind of resource that the binding provides. - `"text_blob"` - `WorkersBindingKindVectorize` - `index_name: string` Name of the Vectorize index to bind to. - `name: string` A JavaScript variable name for the binding. - `type: "vectorize"` The kind of resource that the binding provides. - `"vectorize"` - `WorkersBindingKindVersionMetadata` - `name: string` A JavaScript variable name for the binding. - `type: "version_metadata"` The kind of resource that the binding provides. - `"version_metadata"` - `WorkersBindingKindSecretsStoreSecret` - `name: string` A JavaScript variable name for the binding. - `secret_name: string` Name of the secret in the store. - `store_id: string` ID of the store containing the secret. - `type: "secrets_store_secret"` The kind of resource that the binding provides. - `"secrets_store_secret"` - `WorkersBindingKindFlagship` - `app_id: string` ID of the Flagship app to bind to for feature flag evaluation. - `name: string` A JavaScript variable name for the binding. - `type: "flagship"` The kind of resource that the binding provides. - `"flagship"` - `WorkersBindingKindSecretKey` - `algorithm: unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `format: "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: string` A JavaScript variable name for the binding. - `type: "secret_key"` The kind of resource that the binding provides. - `"secret_key"` - `usages: Array<"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?: string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `key_jwk?: unknown` 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". - `WorkersBindingKindWorkflow` - `name: string` A JavaScript variable name for the binding. - `type: "workflow"` The kind of resource that the binding provides. - `"workflow"` - `workflow_name: string` Name of the Workflow to bind to. - `class_name?: string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `script_name?: string` Script name that contains the Workflow. If not provided, defaults to this script name. - `WorkersBindingKindWasmModule` - `name: string` A JavaScript variable name for the binding. - `part: string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `type: "wasm_module"` The kind of resource that the binding provides. - `"wasm_module"` - `WorkersBindingKindVPCService` - `name: string` A JavaScript variable name for the binding. - `service_id: string` Identifier of the VPC service to bind to. - `type: "vpc_service"` The kind of resource that the binding provides. - `"vpc_service"` - `WorkersBindingKindVPCNetwork` - `name: string` A JavaScript variable name for the binding. - `type: "vpc_network"` The kind of resource that the binding provides. - `"vpc_network"` - `network_id?: string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `tunnel_id?: string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `cache_options?: CacheOptions` Global CacheW configuration for the Worker. When caching is on, the platform provisions a `cloudflare.app` zone for the Worker. A `type: worker` entry in the `exports` map can override this value for a single entrypoint. - `enabled: boolean` Whether caching is enabled for this Worker. - `cross_version_cache?: boolean` Whether cached responses are shared across Worker version uploads. This is independent of `enabled`. It can stay true while caching is off, so the preference survives turning caching off and back on. - `compatibility_date?: string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `compatibility_flags?: Array` 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`. - `containers?: Array` List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. - `class_name: string` Select which Durable Object class should get this container attached. - `exports?: Record` Declarative exports for the version, including Durable Object classes (with their `storage` backend) and named Worker entrypoints. On reads, tombstoned lifecycle entries are omitted, so only live exports (`created` and `expecting-transfer`) are returned. `exports` and `migrations` are mutually exclusive on upload. - `WorkersWorkerExport` A named Worker entrypoint export (`type: worker`). Worker entrypoints are always live (`state: created`) and carry no storage or lifecycle fields. The optional `cache` block overrides the Worker's global `cache_options.enabled` for this entrypoint. - `type: "worker"` Marks this entry as a Worker entrypoint export. - `"worker"` - `cache?: Cache` Cache override for this entrypoint. Overrides the Worker's global `cache_options.enabled` for this entrypoint only. - `enabled: boolean` Whether caching is enabled for this entrypoint. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectExport` A live Durable Object export (`state: created`, the default). The platform auto-provisions the namespace on first deploy, matches it on subsequent deploys, and never mutates or deletes it as a side effect of a code-only change. `storage` is required; `renamed_to`, `transferred_to` and `transfer_from` are not allowed on a live entry. - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object. When set, the namespace is container-enabled. Valid only on live entries. - `state?: "created"` Live export. May be omitted; defaults to `created`. - `"created"` - `WorkersDurableObjectDeletedExport` A `deleted` tombstone: retires the provisioned namespace for this class and all of its data. The class must be absent from the uploaded code and no other Worker in the account may bind to the namespace, otherwise the deploy is rejected. No other fields are allowed. Deletion is irreversible. - `state: "deleted"` Tombstone that deletes the namespace. - `"deleted"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectRenamedExport` A `renamed` tombstone: rewrites the provisioned namespace's class name from this map key to `renamed_to`. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `transferred_to` and `transfer_from` are not allowed. - `renamed_to: string` The destination class name. Must differ from the source class (the map key) and must be declared as a live (`created`) entry in the same `exports` map. Write-only: never present in GET responses. - `state: "renamed"` Tombstone that renames the namespace's class. - `"renamed"` - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectTransferredExport` A `transferred` tombstone (source side of a two-phase transfer): hands ownership of the provisioned namespace to another script in the same account, named by `transferred_to`. The target must have already deployed a matching `expecting-transfer` entry. The source class may stay in code during the rollout window (an info notice is emitted). `storage`, `renamed_to` and `transfer_from` are not allowed. - `state: "transferred"` Tombstone that transfers the namespace to another script. - `"transferred"` - `transferred_to: string` The destination script name. Must be in the same account and the same dispatch-namespace context (or both non-dispatch). Cross-dispatch-namespace transfers are rejected. Write-only: never present in GET responses. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `WorkersDurableObjectExpectingTransferExport` The target side of a two-phase transfer (`state: expecting-transfer`). Declares that this script expects to receive a namespace for this class from the `transfer_from` script. This is a live entry, not a tombstone: bindings resolve through the source's namespace until the source commits with a `transferred` tombstone. `storage` and `transfer_from` are required; `renamed_to` and `transferred_to` are not allowed. - `state: "expecting-transfer"` Target side of a two-phase transfer. - `"expecting-transfer"` - `storage: "sqlite" | "legacy-kv"` Durable Object storage backend. `sqlite` is the recommended (and only) backend for new namespaces. `legacy-kv` is accepted only for a class whose namespace already exists as KV-backed; the `exports` flow never provisions a new `legacy-kv` namespace. - `"sqlite"` - `"legacy-kv"` - `transfer_from: string` The source script name to receive the namespace from. Must be in the same account and dispatch-namespace context. Present on reads for `expecting-transfer` entries. - `type: "durable-object"` Marks this entry as a Durable Object export. - `"durable-object"` - `container?: string` Name of the container (declared in the upload's `metadata.containers`) that backs this Durable Object once the transfer settles. Valid only on live entries. - `exports_reconciliation?: ExportsReconciliation` Summary of the declarative exports reconciliation that ran on this upload. Populated only when the uploaded metadata included an `exports` block. Durable Object entries drive reconciliation; `type: worker` entries do not contribute to this summary. - `created: Array` Class names for which a new namespace was provisioned. - `deleted: Array` Class names whose namespace was deleted by a `deleted` tombstone. - `info: Array` Non-blocking info entries (stale tombstones, tombstone applied with class still in code). See `exports_reconciliation_info`. - `class: string` The class name the info entry is about. - `message: string` Human-readable explanation. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the entry relates to, when applicable. - `referencing_scripts?: Array` Other Workers in the account that still bind to the affected class. Advisory: while non-empty the tombstone is not yet safe to remove — redeploy these Workers with bindings re-pointed first. - `removable_entries: Array` Source class names whose tombstone entry is now stale and safe to delete from `exports` (no remaining referencing scripts). - `renamed: Array` Applied `renamed` tombstones. - `from: string` The original (source) class name. - `to: string` The new class name (`renamed_to`). - `transfer_pending: Array` Phase-1 transfer hints recorded on the target side. - `class: string` The target-side class name awaiting transfer. - `from: string` The source script the namespace will be transferred from. - `transferred: Array` Committed `transferred` tombstones (phase-2). - `class: string` The source class name that was transferred. - `phase: "committed"` The transfer phase. Currently always `committed`. - `"committed"` - `to: string` The destination script that now owns the namespace. - `updated: Array` Class names whose provisioned namespace was mutated in place. - `warnings: Array` Non-blocking warnings. See `exports_reconciliation_warning`. - `class: string` The class name the warning is about. - `message: string` Human-readable explanation of the warning. - `scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 more` Stable, machine-readable tag identifying which reconciliation scenario produced an error, warning, or info entry. Clients may branch on this value instead of parsing `message`. - `"code_class_not_in_exports"` - `"provisioned_class_missing_from_config"` - `"config_export_not_in_code"` - `"config_references_nonexistent_class"` - `"orphaned_provisioned_namespace"` - `"storage_type_mismatch"` - `"free_tier_requires_sqlite"` - `"invalid_export"` - `"tombstone_delete_class_still_in_code"` - `"tombstone_delete_blocked_by_external_bindings"` - `"tombstone_renamed_to_occupied"` - `"transferred_pending_not_found"` - `"transferred_target_missing"` - `"transferred_target_mismatch"` - `"phase_one_transfer_source_missing"` - `"phase_one_transfer_source_namespace_missing"` - `"phase_one_transfer_target_class_provisioned"` - `"phase_one_transfer_after_commit_mismatch"` - `"phase_one_transfer_duplicate"` - `"phase_one_transfer_target_in_dispatch_namespace"` - `"phase_one_transfer_source_in_dispatch_namespace"` - `"transferred_source_in_dispatch_namespace"` - `"transferred_target_in_dispatch_namespace"` - `"container_undeclared_reference"` - `"container_class_not_durable_object"` - `"container_wiring_inconsistent"` - `"container_multiple_durable_objects"` - `"transfer_container_parity_mismatch"` - `"transfer_container_parity_mismatch_on_commit"` - `"tombstone_class_still_in_code"` - `"stale_tombstone"` - `"transfer_receive_already_applied"` - `"transfer_receive_cleanup_complete"` - `namespace_id?: string` The provisioned namespace the warning relates to, when applicable. - `limits?: Limits` Resource limits enforced at runtime. - `cpu_ms?: number` CPU time limit in milliseconds. - `subrequests?: number` Subrequest limit per request. - `main_module?: string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `migration_tag?: string` Durable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `SingleStepMigration` A single set of migrations to apply. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `WorkersMultipleStepMigrations` - `new_tag?: string` Tag to set as the latest migration tag. - `old_tag?: string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `steps?: Array` Migrations to apply in order. - `deleted_classes?: Array` A list of classes to delete Durable Object namespaces from. - `new_classes?: Array` A list of classes to create Durable Object namespaces from. - `new_sqlite_classes?: Array` A list of classes to create Durable Object namespaces with SQLite from. - `renamed_classes?: Array` A list of classes with Durable Object namespaces that were renamed. - `from?: string` - `to?: string` - `transferred_classes?: Array` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `from?: string` - `from_script?: string` - `to?: string` - `modules?: Array` 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: string` The base64-encoded module content. - `content_type: string` The content type of the module. - `name: string` The name of the module. - `package_dependencies?: Array` The list of npm packages that were installed and used when this Worker version was built. - `installedVersion: string` The exact version that was resolved and installed by the package manager. - `name: string` The npm package name. - `packageJsonVersion: string` The version constraint as written in package.json. - `placement?: Mode | Region | Hostname | 5 more` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `Mode` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `Region` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host and port for targeted placement. - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `UnionMember7` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `target: Array` Array of placement targets (currently limited to single target). - `Region` - `region: string` Cloud region in format 'provider:region'. - `Hostname` - `hostname: string` HTTP hostname for targeted placement. - `Host` - `host: string` TCP host:port for targeted placement. - `source?: string` The client used to create the version. - `startup_time_ms?: number` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the version. - `"standard"` - `"bundled"` - `"unbound"` ### Version Delete Response - `VersionDeleteResponse` - `errors: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `success: true` Whether the API call was successful. - `true`