# Workers For Platforms # Dispatch # Namespaces ## List dispatch namespaces `client.workersForPlatforms.dispatch.namespaces.list(NamespaceListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/workers/dispatch/namespaces` Fetch a list of Workers for Platforms namespaces. ### Parameters - `params: NamespaceListParams` - `account_id: string` Identifier. ### Returns - `NamespaceListResponse` - `created_by?: string` Identifier. - `created_on?: string` When the script was created. - `modified_by?: string` Identifier. - `modified_on?: string` When the script was last modified. - `namespace_id?: string` API Resource UUID tag. - `namespace_name?: string` Name of the Workers for Platforms dispatch namespace. - `script_count?: number` The current number of scripts in this Dispatch Namespace. - `trusted_workers?: boolean` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Example ```node 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 namespaceListResponse of client.workersForPlatforms.dispatch.namespaces.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(namespaceListResponse.namespace_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" } } ], "success": true, "result": [ { "created_by": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2017-01-01T00:00:00Z", "modified_by": "023e105f4ecef8ad9ca31a8372d0c353", "modified_on": "2017-01-01T00:00:00Z", "namespace_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "namespace_name": "my-dispatch-namespace", "script_count": 800, "trusted_workers": false } ] } ``` ## Get dispatch namespace `client.workersForPlatforms.dispatch.namespaces.get(stringdispatchNamespace, NamespaceGetParamsparams, RequestOptionsoptions?): NamespaceGetResponse` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}` Get a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `params: NamespaceGetParams` - `account_id: string` Identifier. ### Returns - `NamespaceGetResponse` - `created_by?: string` Identifier. - `created_on?: string` When the script was created. - `modified_by?: string` Identifier. - `modified_on?: string` When the script was last modified. - `namespace_id?: string` API Resource UUID tag. - `namespace_name?: string` Name of the Workers for Platforms dispatch namespace. - `script_count?: number` The current number of scripts in this Dispatch Namespace. - `trusted_workers?: boolean` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const namespace = await client.workersForPlatforms.dispatch.namespaces.get( 'my-dispatch-namespace', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(namespace.namespace_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" } } ], "success": true, "result": { "created_by": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2017-01-01T00:00:00Z", "modified_by": "023e105f4ecef8ad9ca31a8372d0c353", "modified_on": "2017-01-01T00:00:00Z", "namespace_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "namespace_name": "my-dispatch-namespace", "script_count": 800, "trusted_workers": false } } ``` ## Create dispatch namespace `client.workersForPlatforms.dispatch.namespaces.create(NamespaceCreateParamsparams, RequestOptionsoptions?): NamespaceCreateResponse` **post** `/accounts/{account_id}/workers/dispatch/namespaces` Create a new Workers for Platforms namespace. ### Parameters - `params: NamespaceCreateParams` - `account_id: string` Path param: Identifier. - `name?: string` Body param: The name of the dispatch namespace. ### Returns - `NamespaceCreateResponse` - `created_by?: string` Identifier. - `created_on?: string` When the script was created. - `modified_by?: string` Identifier. - `modified_on?: string` When the script was last modified. - `namespace_id?: string` API Resource UUID tag. - `namespace_name?: string` Name of the Workers for Platforms dispatch namespace. - `script_count?: number` The current number of scripts in this Dispatch Namespace. - `trusted_workers?: boolean` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const namespace = await client.workersForPlatforms.dispatch.namespaces.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(namespace.namespace_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" } } ], "success": true, "result": { "created_by": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2017-01-01T00:00:00Z", "modified_by": "023e105f4ecef8ad9ca31a8372d0c353", "modified_on": "2017-01-01T00:00:00Z", "namespace_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "namespace_name": "my-dispatch-namespace", "script_count": 800, "trusted_workers": false } } ``` ## Delete dispatch namespace `client.workersForPlatforms.dispatch.namespaces.delete(stringdispatchNamespace, NamespaceDeleteParamsparams, RequestOptionsoptions?): NamespaceDeleteResponse | null` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}` Delete a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `params: NamespaceDeleteParams` - `account_id: string` Identifier. ### Returns - `NamespaceDeleteResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const namespace = await client.workersForPlatforms.dispatch.namespaces.delete( 'my-dispatch-namespace', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(namespace); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Namespace List Response - `NamespaceListResponse` - `created_by?: string` Identifier. - `created_on?: string` When the script was created. - `modified_by?: string` Identifier. - `modified_on?: string` When the script was last modified. - `namespace_id?: string` API Resource UUID tag. - `namespace_name?: string` Name of the Workers for Platforms dispatch namespace. - `script_count?: number` The current number of scripts in this Dispatch Namespace. - `trusted_workers?: boolean` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Namespace Get Response - `NamespaceGetResponse` - `created_by?: string` Identifier. - `created_on?: string` When the script was created. - `modified_by?: string` Identifier. - `modified_on?: string` When the script was last modified. - `namespace_id?: string` API Resource UUID tag. - `namespace_name?: string` Name of the Workers for Platforms dispatch namespace. - `script_count?: number` The current number of scripts in this Dispatch Namespace. - `trusted_workers?: boolean` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Namespace Create Response - `NamespaceCreateResponse` - `created_by?: string` Identifier. - `created_on?: string` When the script was created. - `modified_by?: string` Identifier. - `modified_on?: string` When the script was last modified. - `namespace_id?: string` API Resource UUID tag. - `namespace_name?: string` Name of the Workers for Platforms dispatch namespace. - `script_count?: number` The current number of scripts in this Dispatch Namespace. - `trusted_workers?: boolean` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Namespace Delete Response - `NamespaceDeleteResponse = unknown` # Scripts ## Worker Details `client.workersForPlatforms.dispatch.namespaces.scripts.get(stringdispatchNamespace, stringscriptName, ScriptGetParamsparams, RequestOptionsoptions?): Script` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}` Fetch information about a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: ScriptGetParams` - `account_id: string` Identifier. ### Returns - `Script` Details about a worker uploaded to a Workers for Platforms namespace. - `created_on?: string` When the script was created. - `dispatch_namespace?: string` Name of the Workers for Platforms dispatch namespace. - `modified_on?: string` When the script was last modified. - `script?: Script` - `id?: string` The name used to identify the script. - `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`. - `created_on?: string` When the script was created. - `etag?: string` Hashed script content, can be used in a If-None-Match header when updating. - `handlers?: Array` The names of handlers exported as part of the default export. - `has_assets?: boolean` Whether a Worker contains assets. - `has_modules?: boolean` Whether a Worker contains modules. - `last_deployed_from?: string` The client most recently used to deploy this Worker. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migration_tag?: string` The tag of the Durable Object migration that was most recently applied for this Worker. - `modified_on?: string` When the script was last modified. - `named_handlers?: Array` Named exports, such as Durable Object class implementations and named entrypoints. - `handlers?: Array` The names of handlers exported as part of the named export. - `name?: string` The name of the export. - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `placement?: UnionMember0 | UnionMember1 | UnionMember2 | 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. - `UnionMember0` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember1` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember2` - `hostname: string` HTTP hostname for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember3` - `host: string` TCP host and port for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `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. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `placement_mode?: "smart" | "targeted"` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `"smart"` - `"targeted"` - `placement_status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `tag?: string` The immutable ID of the script. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const script = await client.workersForPlatforms.dispatch.namespaces.scripts.get( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(script.created_on); ``` #### 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": { "created_on": "2017-01-01T00:00:00Z", "dispatch_namespace": "my-dispatch-namespace", "modified_on": "2017-01-01T00:00:00Z", "script": { "id": "my-workers-script", "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "created_on": "2017-01-01T00:00:00Z", "etag": "ea95132c15732412d22c1476fa83f27a", "handlers": [ "fetch", "scheduled" ], "has_assets": false, "has_modules": false, "last_deployed_from": "wrangler", "logpush": false, "migration_tag": "v1", "modified_on": "2017-01-01T00:00:00Z", "named_handlers": [ { "handlers": [ "class" ], "name": "MyDurableObject" } ], "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart", "last_analyzed_at": "2025-01-01T00:00:00Z", "status": "SUCCESS" }, "placement_mode": "smart", "placement_status": "SUCCESS", "tag": "e8f70fdbc8b1fb0b8ddb1af166186758", "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" } }, "success": true } ``` ## Upload Worker Module `client.workersForPlatforms.dispatch.namespaces.scripts.update(stringdispatchNamespace, stringscriptName, ScriptUpdateParamsparams, RequestOptionsoptions?): ScriptUpdateResponse` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}` Upload a worker module to a Workers for Platforms namespace. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: ScriptUpdateParams` - `account_id: string` Path param: Identifier. - `metadata: Metadata` Body param: JSON-encoded metadata about the uploaded parts and Worker configuration. - `assets?: Assets` Configuration for assets within a Worker. - `config?: Config` Configuration for assets within a Worker. - `_headers?: string` The contents of a _headers file (used to attach custom headers on asset responses). - `_redirects?: string` The contents of a _redirects file (used to apply redirects or proxy paths ahead of asset serving). - `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` - `serve_directly?: boolean` When true and the incoming request matches an asset, that will be served instead of invoking the Worker script. When false, requests will always invoke the Worker script. - `jwt?: 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"` - `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` - `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"` - `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. - `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"` - `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. - `body_part?: string` Name of the uploaded file that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker. - `compatibility_date?: 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`. - `keep_assets?: boolean` Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token. - `keep_bindings?: Array` List of binding types to keep from previous_upload. - `limits?: Limits` Limits to apply for this Worker. - `cpu_ms?: number` The amount of CPU time this Worker can use in milliseconds. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `main_module?: string` Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations to apply for Durable Objects associated with this Worker. - `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` - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `placement?: UnionMember0 | UnionMember1 | UnionMember2 | 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. - `UnionMember0` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember1` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember2` - `hostname: string` HTTP hostname for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember3` - `host: string` TCP host and port for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `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. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `tags?: Array` List of strings to use as tags for this Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` - `bindings_inherit?: "strict"` Query param: When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the script. Without this, unresolvable inherit bindings are silently dropped. - `"strict"` - `files?: Array` Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`. ### Returns - `ScriptUpdateResponse` - `startup_time_ms: number` - `id?: string` The name used to identify the script. - `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`. - `created_on?: string` When the script was created. - `entry_point?: string` The entry point for the script. - `etag?: string` Hashed script content, can be used in a If-None-Match header when updating. - `handlers?: Array` The names of handlers exported as part of the default export. - `has_assets?: boolean` Whether a Worker contains assets. - `has_modules?: boolean` Whether a Worker contains modules. - `last_deployed_from?: string` The client most recently used to deploy this Worker. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migration_tag?: string` The tag of the Durable Object migration that was most recently applied for this Worker. - `modified_on?: string` When the script was last modified. - `named_handlers?: Array` Named exports, such as Durable Object class implementations and named entrypoints. - `handlers?: Array` The names of handlers exported as part of the named export. - `name?: string` The name of the export. - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `placement?: UnionMember0 | UnionMember1 | UnionMember2 | 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. - `UnionMember0` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember1` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember2` - `hostname: string` HTTP hostname for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember3` - `host: string` TCP host and port for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `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. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `placement_mode?: "smart" | "targeted"` - `"smart"` - `"targeted"` - `placement_status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `tag?: string` The immutable ID of the script. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const script = await client.workersForPlatforms.dispatch.namespaces.scripts.update( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', metadata: {}, }, ); console.log(script.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "startup_time_ms": 10, "id": "this-is_my_script-01", "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "created_on": "2022-05-05T05:15:11.602148Z", "entry_point": "index.js", "etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1", "handlers": [ "fetch" ], "has_assets": false, "has_modules": false, "last_deployed_from": "wrangler", "logpush": false, "migration_tag": "v1", "modified_on": "2022-05-20T19:02:56.446492Z", "named_handlers": [ { "handlers": [ "class" ], "name": "MyDurableObject" } ], "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart", "last_analyzed_at": "2025-01-01T00:00:00Z", "status": "SUCCESS" }, "placement_mode": "smart", "placement_status": "SUCCESS", "tag": "e8f70fdbc8b1fb0b8ddb1af166186758", "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" }, "success": true } ``` ## Delete Worker `client.workersForPlatforms.dispatch.namespaces.scripts.delete(stringdispatchNamespace, stringscriptName, ScriptDeleteParamsparams, RequestOptionsoptions?): ScriptDeleteResponse | null` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}` Delete a worker from a Workers for Platforms namespace. This call has no response body on a successful delete. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: ScriptDeleteParams` - `account_id: string` Path param: Identifier. - `force?: boolean` Query param: If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script. ### Returns - `ScriptDeleteResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const script = await client.workersForPlatforms.dispatch.namespaces.scripts.delete( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(script); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Script - `Script` Details about a worker uploaded to a Workers for Platforms namespace. - `created_on?: string` When the script was created. - `dispatch_namespace?: string` Name of the Workers for Platforms dispatch namespace. - `modified_on?: string` When the script was last modified. - `script?: Script` - `id?: string` The name used to identify the script. - `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`. - `created_on?: string` When the script was created. - `etag?: string` Hashed script content, can be used in a If-None-Match header when updating. - `handlers?: Array` The names of handlers exported as part of the default export. - `has_assets?: boolean` Whether a Worker contains assets. - `has_modules?: boolean` Whether a Worker contains modules. - `last_deployed_from?: string` The client most recently used to deploy this Worker. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migration_tag?: string` The tag of the Durable Object migration that was most recently applied for this Worker. - `modified_on?: string` When the script was last modified. - `named_handlers?: Array` Named exports, such as Durable Object class implementations and named entrypoints. - `handlers?: Array` The names of handlers exported as part of the named export. - `name?: string` The name of the export. - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `placement?: UnionMember0 | UnionMember1 | UnionMember2 | 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. - `UnionMember0` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember1` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember2` - `hostname: string` HTTP hostname for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember3` - `host: string` TCP host and port for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `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. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `placement_mode?: "smart" | "targeted"` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `"smart"` - `"targeted"` - `placement_status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `tag?: string` The immutable ID of the script. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Script Update Response - `ScriptUpdateResponse` - `startup_time_ms: number` - `id?: string` The name used to identify the script. - `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`. - `created_on?: string` When the script was created. - `entry_point?: string` The entry point for the script. - `etag?: string` Hashed script content, can be used in a If-None-Match header when updating. - `handlers?: Array` The names of handlers exported as part of the default export. - `has_assets?: boolean` Whether a Worker contains assets. - `has_modules?: boolean` Whether a Worker contains modules. - `last_deployed_from?: string` The client most recently used to deploy this Worker. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migration_tag?: string` The tag of the Durable Object migration that was most recently applied for this Worker. - `modified_on?: string` When the script was last modified. - `named_handlers?: Array` Named exports, such as Durable Object class implementations and named entrypoints. - `handlers?: Array` The names of handlers exported as part of the named export. - `name?: string` The name of the export. - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `placement?: UnionMember0 | UnionMember1 | UnionMember2 | 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. - `UnionMember0` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember1` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember2` - `hostname: string` HTTP hostname for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember3` - `host: string` TCP host and port for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `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. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `placement_mode?: "smart" | "targeted"` - `"smart"` - `"targeted"` - `placement_status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `tag?: string` The immutable ID of the script. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Script Delete Response - `ScriptDeleteResponse = unknown` # Asset Upload ## Create Assets Upload Session `client.workersForPlatforms.dispatch.namespaces.scripts.assetUpload.create(stringdispatchNamespace, stringscriptName, AssetUploadCreateParamsparams, RequestOptionsoptions?): AssetUploadCreateResponse` **post** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/assets-upload-session` Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: AssetUploadCreateParams` - `account_id: string` Path param: Identifier. - `manifest: Record` Body param: A manifest ([path]: {hash, size}) map of files to upload. As an example, `/blog/hello-world.html` would be a valid path key. - `hash: string` The hash of the file. - `size: number` The size of the file in bytes. ### Returns - `AssetUploadCreateResponse` - `buckets?: Array>` The requests to make to upload assets. - `jwt?: string` A JWT to use as authentication for uploading assets. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const assetUpload = await client.workersForPlatforms.dispatch.namespaces.scripts.assetUpload.create( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', manifest: { foo: { hash: 'hash', size: 0 } }, }, ); console.log(assetUpload.buckets); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "buckets": [ [ "string" ] ], "jwt": "jwt" } } ``` ## Domain Types ### Asset Upload Create Response - `AssetUploadCreateResponse` - `buckets?: Array>` The requests to make to upload assets. - `jwt?: string` A JWT to use as authentication for uploading assets. # Content ## Get Script Content `client.workersForPlatforms.dispatch.namespaces.scripts.content.get(stringdispatchNamespace, stringscriptName, ContentGetParamsparams, RequestOptionsoptions?): Response` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content` Fetch script content from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: ContentGetParams` - `account_id: string` Identifier. ### Returns - `unnamed_schema_7 = Response` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const content = await client.workersForPlatforms.dispatch.namespaces.scripts.content.get( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(content); const data = await content.blob(); console.log(data); ``` ## Put Script Content `client.workersForPlatforms.dispatch.namespaces.scripts.content.update(stringdispatchNamespace, stringscriptName, ContentUpdateParamsparams, RequestOptionsoptions?): Script` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content` Put script content for a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: ContentUpdateParams` - `account_id: string` Path param: Identifier. - `metadata: WorkerMetadata` Body param: JSON-encoded metadata about the uploaded parts and Worker configuration. - `body_part?: string` Name of the part in the multipart request that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker. - `main_module?: string` Name of the part in the multipart request that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker. - `files?: Array` Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`. - `cfWorkerBodyPart?: string` Header param: The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part. - `cfWorkerMainModulePart?: string` Header param: The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part. ### Returns - `Script` - `id?: string` The name used to identify the script. - `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`. - `created_on?: string` When the script was created. - `etag?: string` Hashed script content, can be used in a If-None-Match header when updating. - `handlers?: Array` The names of handlers exported as part of the default export. - `has_assets?: boolean` Whether a Worker contains assets. - `has_modules?: boolean` Whether a Worker contains modules. - `last_deployed_from?: string` The client most recently used to deploy this Worker. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migration_tag?: string` The tag of the Durable Object migration that was most recently applied for this Worker. - `modified_on?: string` When the script was last modified. - `named_handlers?: Array` Named exports, such as Durable Object class implementations and named entrypoints. - `handlers?: Array` The names of handlers exported as part of the named export. - `name?: string` The name of the export. - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `placement?: UnionMember0 | UnionMember1 | UnionMember2 | 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. - `UnionMember0` - `mode: "smart"` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"smart"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember1` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember2` - `hostname: string` HTTP hostname for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember3` - `host: string` TCP host and port for targeted placement. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember4` - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `region: string` Cloud region for targeted placement in format 'provider:region'. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember5` - `hostname: string` HTTP hostname for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `UnionMember6` - `host: string` TCP host and port for targeted placement. - `mode: "targeted"` Targeted placement mode. - `"targeted"` - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `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. - `last_analyzed_at?: string` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `placement_mode?: "smart" | "targeted"` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `"smart"` - `"targeted"` - `placement_status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `"SUCCESS"` - `"UNSUPPORTED_APPLICATION"` - `"INSUFFICIENT_INVOCATIONS"` - `tag?: string` The immutable ID of the script. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const script = await client.workersForPlatforms.dispatch.namespaces.scripts.content.update( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', metadata: {}, }, ); console.log(script.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "my-workers-script", "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "created_on": "2017-01-01T00:00:00Z", "etag": "ea95132c15732412d22c1476fa83f27a", "handlers": [ "fetch", "scheduled" ], "has_assets": false, "has_modules": false, "last_deployed_from": "wrangler", "logpush": false, "migration_tag": "v1", "modified_on": "2017-01-01T00:00:00Z", "named_handlers": [ { "handlers": [ "class" ], "name": "MyDurableObject" } ], "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart", "last_analyzed_at": "2025-01-01T00:00:00Z", "status": "SUCCESS" }, "placement_mode": "smart", "placement_status": "SUCCESS", "tag": "e8f70fdbc8b1fb0b8ddb1af166186758", "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" }, "success": true } ``` # Settings ## Get Script Settings `client.workersForPlatforms.dispatch.namespaces.scripts.settings.get(stringdispatchNamespace, stringscriptName, SettingGetParamsparams, RequestOptionsoptions?): SettingGetResponse` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings` Get script settings from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: SettingGetParams` - `account_id: string` Identifier. ### Returns - `SettingGetResponse` Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `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"` - `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` - `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"` - `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. - `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"` - `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. - `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`. - `limits?: Limits` Limits to apply for this Worker. - `cpu_ms?: number` The amount of CPU time this Worker can use in milliseconds. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations to apply for Durable Objects associated with this Worker. - `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` - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `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. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const setting = await client.workersForPlatforms.dispatch.namespaces.scripts.settings.get( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(setting.bindings); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "logpush": false, "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart" }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" } } ``` ## Patch Script Settings `client.workersForPlatforms.dispatch.namespaces.scripts.settings.edit(stringdispatchNamespace, stringscriptName, SettingEditParamsparams, RequestOptionsoptions?): SettingEditResponse` **patch** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings` Patch script metadata, such as bindings. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: SettingEditParams` - `account_id: string` Path param: Identifier. - `settings?: Settings` Body param: Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `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"` - `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` - `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"` - `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. - `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"` - `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. - `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`. - `limits?: Limits` Limits to apply for this Worker. - `cpu_ms?: number` The amount of CPU time this Worker can use in milliseconds. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations to apply for Durable Objects associated with this Worker. - `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` - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `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. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Returns - `SettingEditResponse` Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `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"` - `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` - `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"` - `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. - `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"` - `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. - `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`. - `limits?: Limits` Limits to apply for this Worker. - `cpu_ms?: number` The amount of CPU time this Worker can use in milliseconds. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations to apply for Durable Objects associated with this Worker. - `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` - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `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. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.workersForPlatforms.dispatch.namespaces.scripts.settings.edit( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(response.bindings); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "logpush": false, "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart" }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" } } ``` ## Domain Types ### Setting Get Response - `SettingGetResponse` Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `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"` - `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` - `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"` - `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. - `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"` - `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. - `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`. - `limits?: Limits` Limits to apply for this Worker. - `cpu_ms?: number` The amount of CPU time this Worker can use in milliseconds. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations to apply for Durable Objects associated with this Worker. - `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` - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `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. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` ### Setting Edit Response - `SettingEditResponse` Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `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"` - `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` - `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"` - `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. - `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"` - `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. - `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`. - `limits?: Limits` Limits to apply for this Worker. - `cpu_ms?: number` The amount of CPU time this Worker can use in milliseconds. - `logpush?: boolean` Whether Logpush is turned on for the Worker. - `migrations?: SingleStepMigration | WorkersMultipleStepMigrations` Migrations to apply for Durable Objects associated with this Worker. - `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` - `observability?: Observability` Observability settings for the Worker. - `enabled: boolean` Whether observability is enabled for the Worker. - `head_sampling_rate?: number | null` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `logs?: Logs | null` Log settings for the Worker. - `enabled: boolean` Whether logs are enabled for the Worker. - `invocation_logs: boolean` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `destinations?: Array` A list of destinations where logs will be exported to. - `head_sampling_rate?: number | null` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether log persistence is enabled for the Worker. - `traces?: Traces | null` 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 | null` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `persist?: boolean` Whether trace persistence is enabled for the Worker. - `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. - `tags?: Array | null` Tags associated with the Worker. - `tail_consumers?: Array | null` List of Workers that will consume logs from the attached Worker. - `service: string` Name of Worker that is to be the consumer. - `environment?: string` Optional environment if the Worker utilizes one. - `namespace?: string` Optional dispatch namespace the script belongs to. - `usage_model?: "standard" | "bundled" | "unbound"` Usage model for the Worker invocations. - `"standard"` - `"bundled"` - `"unbound"` # Bindings ## Get Script Bindings `client.workersForPlatforms.dispatch.namespaces.scripts.bindings.get(stringdispatchNamespace, stringscriptName, BindingGetParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings` Fetch script bindings from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: BindingGetParams` - `account_id: string` Identifier. ### Returns - `BindingGetResponse = WorkersBindingKindAI | WorkersBindingKindAISearch | WorkersBindingKindAISearchNamespace | 31 more` A binding to allow the Worker to communicate with resources. - `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"` - `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` - `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"` - `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. - `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"` - `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. ### Example ```node 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 bindingGetResponse of client.workersForPlatforms.dispatch.namespaces.scripts.bindings.get( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(bindingGetResponse); } ``` #### 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": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "success": true } ``` ## Domain Types ### Binding Get Response - `BindingGetResponse = WorkersBindingKindAI | WorkersBindingKindAISearch | WorkersBindingKindAISearchNamespace | 31 more` A binding to allow the Worker to communicate with resources. - `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"` - `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` - `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"` - `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. - `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"` - `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. # Secrets ## List Script Secrets `client.workersForPlatforms.dispatch.namespaces.scripts.secrets.list(stringdispatchNamespace, stringscriptName, SecretListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets` List secrets bound to a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: SecretListParams` - `account_id: string` Identifier. ### Returns - `SecretListResponse = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` A secret value accessible through a binding. - `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"` - `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". ### Example ```node 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 secretListResponse of client.workersForPlatforms.dispatch.namespaces.scripts.secrets.list( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(secretListResponse); } ``` #### 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": [ { "name": "myBinding", "type": "secret_text" } ], "success": true } ``` ## Get secret binding `client.workersForPlatforms.dispatch.namespaces.scripts.secrets.get(stringdispatchNamespace, stringscriptName, stringsecretName, SecretGetParamsparams, RequestOptionsoptions?): SecretGetResponse` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}` Get a given secret binding (value omitted) on a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `secretName: string` A JavaScript variable name for the secret binding. - `params: SecretGetParams` - `account_id: string` Path param: Identifier. - `url_encoded?: boolean` Query param: Flag that indicates whether the secret name is URL encoded. ### Returns - `SecretGetResponse = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` A secret value accessible through a binding. - `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"` - `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". ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const secret = await client.workersForPlatforms.dispatch.namespaces.scripts.secrets.get( 'my-dispatch-namespace', 'this-is_my_script-01', 'mySecret', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(secret); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "name": "myBinding", "type": "secret_text" }, "success": true } ``` ## Add script secret `client.workersForPlatforms.dispatch.namespaces.scripts.secrets.update(stringdispatchNamespace, stringscriptName, SecretUpdateParamsparams, RequestOptionsoptions?): SecretUpdateResponse` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets` Add a secret to a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `SecretUpdateParams = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` - `SecretUpdateParamsBase` - `WorkersBindingKindSecretText extends SecretUpdateParamsBase` - `WorkersBindingKindSecretKey extends SecretUpdateParamsBase` ### Returns - `SecretUpdateResponse = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` A secret value accessible through a binding. - `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"` - `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". ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const secret = await client.workersForPlatforms.dispatch.namespaces.scripts.secrets.update( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'myBinding', text: 'My secret.', type: 'secret_text', }, ); console.log(secret); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "name": "myBinding", "type": "secret_text" }, "success": true } ``` ## Delete script secret `client.workersForPlatforms.dispatch.namespaces.scripts.secrets.delete(stringdispatchNamespace, stringscriptName, stringsecretName, SecretDeleteParamsparams, RequestOptionsoptions?): SecretDeleteResponse | null` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}` Remove a secret from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `secretName: string` A JavaScript variable name for the secret binding. - `params: SecretDeleteParams` - `account_id: string` Path param: Identifier. - `url_encoded?: boolean` Query param: Flag that indicates whether the secret name is URL encoded. ### Returns - `SecretDeleteResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const secret = await client.workersForPlatforms.dispatch.namespaces.scripts.secrets.delete( 'my-dispatch-namespace', 'this-is_my_script-01', 'mySecret', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(secret); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Secret List Response - `SecretListResponse = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` A secret value accessible through a binding. - `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"` - `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". ### Secret Get Response - `SecretGetResponse = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` A secret value accessible through a binding. - `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"` - `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". ### Secret Update Response - `SecretUpdateResponse = WorkersBindingKindSecretText | WorkersBindingKindSecretKey` A secret value accessible through a binding. - `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"` - `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". ### Secret Delete Response - `SecretDeleteResponse = unknown` # Tags ## Get Script Tags `client.workersForPlatforms.dispatch.namespaces.scripts.tags.list(stringdispatchNamespace, stringscriptName, TagListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags` Fetch tags from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: TagListParams` - `account_id: string` Identifier. ### Returns - `TagListResponse = string` ### Example ```node 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 tagListResponse of client.workersForPlatforms.dispatch.namespaces.scripts.tags.list( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(tagListResponse); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ "free", "customer" ] } ``` ## Put Script Tags `client.workersForPlatforms.dispatch.namespaces.scripts.tags.update(stringdispatchNamespace, stringscriptName, TagUpdateParamsparams, RequestOptionsoptions?): SinglePage` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags` Put script tags for a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `params: TagUpdateParams` - `account_id: string` Path param: Identifier. - `body: Array | null` Body param: Tags associated with the Worker. ### Returns - `TagUpdateResponse = string` ### Example ```node 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 tagUpdateResponse of client.workersForPlatforms.dispatch.namespaces.scripts.tags.update( 'my-dispatch-namespace', 'this-is_my_script-01', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: ['my-team', 'my-public-api'] }, )) { console.log(tagUpdateResponse); } ``` #### 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": [ "my-tag" ], "success": true } ``` ## Delete Script Tag `client.workersForPlatforms.dispatch.namespaces.scripts.tags.delete(stringdispatchNamespace, stringscriptName, stringtag, TagDeleteParamsparams, RequestOptionsoptions?): TagDeleteResponse | null` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags/{tag}` Delete script tag for a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace: string` Name of the Workers for Platforms dispatch namespace. - `scriptName: string` Name of the script, used in URLs and route configuration. - `tag: string` - `params: TagDeleteParams` - `account_id: string` Identifier. ### Returns - `TagDeleteResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const tag = await client.workersForPlatforms.dispatch.namespaces.scripts.tags.delete( 'my-dispatch-namespace', 'this-is_my_script-01', 'my-tag', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(tag); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Tag List Response - `TagListResponse = string` ### Tag Update Response - `TagUpdateResponse = string` ### Tag Delete Response - `TagDeleteResponse = unknown`