Upload Worker Module
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/.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194Accepted Permissions (at least one required)
Workers Scripts WriteParametersExpand Collapse
params: ScriptUpdateParams { account_id, dispatch_namespace, metadata, 2 more }
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
assets?: Assets { config, jwt } Configuration for assets within a Worker.
Configuration for assets within a Worker.
config?: Config { _headers, _redirects, html_handling, 3 more } Configuration for assets within a Worker.
Configuration for assets within a Worker.
The contents of a _headers file (used to attach custom headers on asset responses).
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.
Determines the redirects and rewrites of requests for HTML content.
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.
Determines the response when a request does not match a static asset, and there is no Worker script.
run_worker_first?: Array<string> | booleanContains 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.
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.
bindings?: Array<WorkersBindingKindAI { name, type } | WorkersBindingKindAISearch { instance_name, name, type, namespace } | WorkersBindingKindAISearchNamespace { name, namespace, type } | 33 more>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.
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.
WorkersBindingKindAISearch { instance_name, name, type, namespace }
WorkersBindingKindAISearchNamespace { name, namespace, type }
WorkersBindingKindDispatchNamespace { name, namespace, type, outbound }
WorkersBindingKindInherit { name, type, old_name, version_id }
WorkersBindingKindRatelimit { name, namespace_id, simple, type }
WorkersBindingKindR2Bucket { bucket_name, name, type, jurisdiction }
jurisdiction?: "eu" | "fedramp" | "fedramp-high"The jurisdiction of the R2 bucket.
The jurisdiction of the R2 bucket.
WorkersBindingKindSecretKey { algorithm, format, name, 4 more }
Algorithm-specific key parameters. Learn more.
format: "raw" | "pkcs8" | "spki" | "jwk"Data format of the key. Learn more.
Data format of the key. Learn more.
usages: Array<"encrypt" | "decrypt" | "sign" | 5 more>Allowed operations with the key. Learn more.
Allowed operations with the key. Learn more.
Key data in JSON Web Key format. Required if format is “jwk”.
WorkersBindingKindWorkflow { name, type, workflow_name, 2 more }
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.
cache_options?: CacheOptions { enabled, cross_version_cache } Global CacheW configuration for the Worker. When caching is on,
the platform provisions a cloudflare.app zone for the Worker.
A type: worker entry in the exports map can override this
value for a single entrypoint.
Global CacheW configuration for the Worker. When caching is on,
the platform provisions a cloudflare.app zone for the Worker.
A type: worker entry in the exports map can override this
value for a single entrypoint.
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
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.
exports?: Record<string, WorkersWorkerExport { type, cache, state } | WorkersDurableObjectExport { storage, type, container, state } | WorkersDurableObjectDeletedExport { state, type } | 3 more>Declarative exports for the Worker. Worker entrypoint
entries (type: worker) carry cache configuration for
that entrypoint.
Declarative exports for the Worker. Worker entrypoint
entries (type: worker) carry cache configuration for
that entrypoint.
WorkersWorkerExport { type, cache, state } A named Worker entrypoint export (type: worker). Worker
entrypoints are always live (state: created) and carry no
storage or lifecycle fields. The optional cache block overrides
the Worker’s global cache_options.enabled for this entrypoint.
A named Worker entrypoint export (type: worker). Worker
entrypoints are always live (state: created) and carry no
storage or lifecycle fields. The optional cache block overrides
the Worker’s global cache_options.enabled for this entrypoint.
WorkersDurableObjectExport { storage, type, container, state } A live Durable Object export (state: created, the default). The
platform auto-provisions the namespace on first deploy, matches it
on subsequent deploys, and never mutates or deletes it as a side
effect of a code-only change. storage is required; renamed_to,
transferred_to and transfer_from are not allowed on a live
entry.
A live Durable Object export (state: created, the default). The
platform auto-provisions the namespace on first deploy, matches it
on subsequent deploys, and never mutates or deletes it as a side
effect of a code-only change. storage is required; renamed_to,
transferred_to and transfer_from are not allowed on a live
entry.
storage: "sqlite" | "legacy-kv"Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
WorkersDurableObjectDeletedExport { state, type } A deleted tombstone: retires the provisioned namespace for this
class and all of its data. The class must be absent from the
uploaded code and no other Worker in the account may bind to the
namespace, otherwise the deploy is rejected. No other fields are
allowed. Deletion is irreversible.
A deleted tombstone: retires the provisioned namespace for this
class and all of its data. The class must be absent from the
uploaded code and no other Worker in the account may bind to the
namespace, otherwise the deploy is rejected. No other fields are
allowed. Deletion is irreversible.
WorkersDurableObjectRenamedExport { renamed_to, state, type } A renamed tombstone: rewrites the provisioned namespace’s class
name from this map key to renamed_to. The source class may stay
in code during the rollout window (an info notice is emitted).
storage, transferred_to and transfer_from are not allowed.
A renamed tombstone: rewrites the provisioned namespace’s class
name from this map key to renamed_to. The source class may stay
in code during the rollout window (an info notice is emitted).
storage, transferred_to and transfer_from are not allowed.
WorkersDurableObjectTransferredExport { state, transferred_to, type } A transferred tombstone (source side of a two-phase transfer):
hands ownership of the provisioned namespace to another script in
the same account, named by transferred_to. The target must have
already deployed a matching expecting-transfer entry. The source
class may stay in code during the rollout window (an info notice
is emitted). storage, renamed_to and transfer_from are not
allowed.
A transferred tombstone (source side of a two-phase transfer):
hands ownership of the provisioned namespace to another script in
the same account, named by transferred_to. The target must have
already deployed a matching expecting-transfer entry. The source
class may stay in code during the rollout window (an info notice
is emitted). storage, renamed_to and transfer_from are not
allowed.
WorkersDurableObjectExpectingTransferExport { state, storage, transfer_from, 2 more } The target side of a two-phase transfer (state: expecting-transfer). Declares that this script expects to receive
a namespace for this class from the transfer_from script. This
is a live entry, not a tombstone: bindings resolve through the
source’s namespace until the source commits with a transferred
tombstone. storage and transfer_from are required; renamed_to
and transferred_to are not allowed.
The target side of a two-phase transfer (state: expecting-transfer). Declares that this script expects to receive
a namespace for this class from the transfer_from script. This
is a live entry, not a tombstone: bindings resolve through the
source’s namespace until the source commits with a transferred
tombstone. storage and transfer_from are required; renamed_to
and transferred_to are not allowed.
storage: "sqlite" | "legacy-kv"Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
exports_reconciliation?: ExportsReconciliation { created, deleted, info, 6 more } Summary of the declarative exports reconciliation that ran
on this upload. Populated only when the uploaded metadata
included an exports block. Durable Object entries drive
reconciliation; type: worker entries do not contribute to
this summary.
Summary of the declarative exports reconciliation that ran
on this upload. Populated only when the uploaded metadata
included an exports block. Durable Object entries drive
reconciliation; type: worker entries do not contribute to
this summary.
info: Array<Info>Non-blocking info entries (stale tombstones, tombstone applied
with class still in code). See exports_reconciliation_info.
Non-blocking info entries (stale tombstones, tombstone applied
with class still in code). See exports_reconciliation_info.
scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 moreStable, machine-readable tag identifying which reconciliation
scenario produced an error, warning, or info entry. Clients may
branch on this value instead of parsing message.
Stable, machine-readable tag identifying which reconciliation
scenario produced an error, warning, or info entry. Clients may
branch on this value instead of parsing message.
Source class names whose tombstone entry is now stale and safe
to delete from exports (no remaining referencing scripts).
warnings: Array<Warning>Non-blocking warnings. See exports_reconciliation_warning.
Non-blocking warnings. See exports_reconciliation_warning.
scenario: "code_class_not_in_exports" | "provisioned_class_missing_from_config" | "config_export_not_in_code" | 30 moreStable, machine-readable tag identifying which reconciliation
scenario produced an error, warning, or info entry. Clients may
branch on this value instead of parsing message.
Stable, machine-readable tag identifying which reconciliation
scenario produced an error, warning, or info entry. Clients may
branch on this value instead of parsing message.
Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token. An explicit assets upload takes precedence over keep_assets.
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 { deleted_classes, new_classes, new_sqlite_classes, 4 more } | WorkersMultipleStepMigrations { new_tag, old_tag, steps } Migrations to apply for Durable Objects associated with this Worker.
Migrations to apply for Durable Objects associated with this Worker.
SingleStepMigration { deleted_classes, new_classes, new_sqlite_classes, 4 more } A single set of migrations to apply.
A single set of migrations to apply.
A list of classes to create Durable Object namespaces with SQLite from.
Tag used to verify against the latest migration tag for this Worker. If they don’t match, the upload is rejected.
WorkersMultipleStepMigrations { new_tag, old_tag, steps }
Tag used to verify against the latest migration tag for this Worker. If they don’t match, the upload is rejected.
observability?: Observability { enabled, head_sampling_rate, logs, traces } Observability settings for the Worker.
Observability settings for the Worker.
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
logs?: Logs | nullLog settings for the Worker.
Log settings for the Worker.
Whether invocation logs are enabled for the Worker.
traces?: Traces | nullTrace settings for the Worker.
Trace settings for the Worker.
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
propagation_policy?: "authenticated" | "accept"Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. “authenticated” (default) honors inbound trace context only when accompanied by a valid trace auth token. “accept” unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.
Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. “authenticated” (default) honors inbound trace context only when accompanied by a valid trace auth token. “accept” unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.
package_dependencies?: Array<PackageDependency>The list of npm packages that were installed and used when this Worker
version was built.
The list of npm packages that were installed and used when this Worker version was built.
placement?: UnionMember0 { mode, last_analyzed_at, status } | UnionMember1 { region, last_analyzed_at, status } | UnionMember2 { hostname, last_analyzed_at, status } | 5 moreConfiguration for Smart Placement. Specify mode=‘smart’ for Smart Placement, or one of region/hostname/host.
Configuration for Smart Placement. Specify mode=‘smart’ for Smart Placement, or one of region/hostname/host.
UnionMember0 { mode, last_analyzed_at, status }
Enables Smart Placement.
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember1 { region, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember2 { hostname, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember3 { host, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember4 { mode, region, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember5 { hostname, mode, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember6 { host, mode, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember7 { mode, target, last_analyzed_at, status }
target: Array<Region { region } | Hostname { hostname } | Host { host } >Array of placement targets (currently limited to single target).
Array of placement targets (currently limited to single target).
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
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.
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.
ReturnsExpand Collapse
ScriptUpdateResponse { startup_time_ms, id, cache_options, 22 more }
cache_options?: CacheOptions { enabled, cross_version_cache } Global CacheW configuration for the Worker. When caching is on,
the platform provisions a cloudflare.app zone for the Worker.
A type: worker entry in the exports map can override this
value for a single entrypoint.
Global CacheW configuration for the Worker. When caching is on,
the platform provisions a cloudflare.app zone for the Worker.
A type: worker entry in the exports map can override this
value for a single entrypoint.
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
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.
exports?: Record<string, WorkersWorkerExport { type, cache, state } | WorkersDurableObjectExport { storage, type, container, state } | WorkersDurableObjectDeletedExport { state, type } | 3 more>Declarative exports for the Worker’s most recent version,
including Durable Object classes (with their storage
backend) and named Worker entrypoints. Tombstoned lifecycle
entries are omitted, so only live exports (created and
expecting-transfer) are returned.
Declarative exports for the Worker’s most recent version,
including Durable Object classes (with their storage
backend) and named Worker entrypoints. Tombstoned lifecycle
entries are omitted, so only live exports (created and
expecting-transfer) are returned.
WorkersWorkerExport { type, cache, state } A named Worker entrypoint export (type: worker). Worker
entrypoints are always live (state: created) and carry no
storage or lifecycle fields. The optional cache block overrides
the Worker’s global cache_options.enabled for this entrypoint.
A named Worker entrypoint export (type: worker). Worker
entrypoints are always live (state: created) and carry no
storage or lifecycle fields. The optional cache block overrides
the Worker’s global cache_options.enabled for this entrypoint.
WorkersDurableObjectExport { storage, type, container, state } A live Durable Object export (state: created, the default). The
platform auto-provisions the namespace on first deploy, matches it
on subsequent deploys, and never mutates or deletes it as a side
effect of a code-only change. storage is required; renamed_to,
transferred_to and transfer_from are not allowed on a live
entry.
A live Durable Object export (state: created, the default). The
platform auto-provisions the namespace on first deploy, matches it
on subsequent deploys, and never mutates or deletes it as a side
effect of a code-only change. storage is required; renamed_to,
transferred_to and transfer_from are not allowed on a live
entry.
storage: "sqlite" | "legacy-kv"Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
WorkersDurableObjectDeletedExport { state, type } A deleted tombstone: retires the provisioned namespace for this
class and all of its data. The class must be absent from the
uploaded code and no other Worker in the account may bind to the
namespace, otherwise the deploy is rejected. No other fields are
allowed. Deletion is irreversible.
A deleted tombstone: retires the provisioned namespace for this
class and all of its data. The class must be absent from the
uploaded code and no other Worker in the account may bind to the
namespace, otherwise the deploy is rejected. No other fields are
allowed. Deletion is irreversible.
WorkersDurableObjectRenamedExport { renamed_to, state, type } A renamed tombstone: rewrites the provisioned namespace’s class
name from this map key to renamed_to. The source class may stay
in code during the rollout window (an info notice is emitted).
storage, transferred_to and transfer_from are not allowed.
A renamed tombstone: rewrites the provisioned namespace’s class
name from this map key to renamed_to. The source class may stay
in code during the rollout window (an info notice is emitted).
storage, transferred_to and transfer_from are not allowed.
WorkersDurableObjectTransferredExport { state, transferred_to, type } A transferred tombstone (source side of a two-phase transfer):
hands ownership of the provisioned namespace to another script in
the same account, named by transferred_to. The target must have
already deployed a matching expecting-transfer entry. The source
class may stay in code during the rollout window (an info notice
is emitted). storage, renamed_to and transfer_from are not
allowed.
A transferred tombstone (source side of a two-phase transfer):
hands ownership of the provisioned namespace to another script in
the same account, named by transferred_to. The target must have
already deployed a matching expecting-transfer entry. The source
class may stay in code during the rollout window (an info notice
is emitted). storage, renamed_to and transfer_from are not
allowed.
WorkersDurableObjectExpectingTransferExport { state, storage, transfer_from, 2 more } The target side of a two-phase transfer (state: expecting-transfer). Declares that this script expects to receive
a namespace for this class from the transfer_from script. This
is a live entry, not a tombstone: bindings resolve through the
source’s namespace until the source commits with a transferred
tombstone. storage and transfer_from are required; renamed_to
and transferred_to are not allowed.
The target side of a two-phase transfer (state: expecting-transfer). Declares that this script expects to receive
a namespace for this class from the transfer_from script. This
is a live entry, not a tombstone: bindings resolve through the
source’s namespace until the source commits with a transferred
tombstone. storage and transfer_from are required; renamed_to
and transferred_to are not allowed.
storage: "sqlite" | "legacy-kv"Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
Durable Object storage backend. sqlite is the recommended (and
only) backend for new namespaces. legacy-kv is accepted only for
a class whose namespace already exists as KV-backed; the exports
flow never provisions a new legacy-kv namespace.
The tag of the Durable Object migration that was most recently applied for this Worker.
named_handlers?: Array<NamedHandler>Named exports, such as Durable Object class implementations and named entrypoints.
Named exports, such as Durable Object class implementations and named entrypoints.
observability?: Observability { enabled, head_sampling_rate, logs, traces } Observability settings for the Worker.
Observability settings for the Worker.
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
logs?: Logs | nullLog settings for the Worker.
Log settings for the Worker.
Whether invocation logs are enabled for the Worker.
traces?: Traces | nullTrace settings for the Worker.
Trace settings for the Worker.
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
propagation_policy?: "authenticated" | "accept"Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. “authenticated” (default) honors inbound trace context only when accompanied by a valid trace auth token. “accept” unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.
Controls how inbound trace context (traceparent/tracestate) headers on incoming requests are handled. “authenticated” (default) honors inbound trace context only when accompanied by a valid trace auth token. “accept” unconditionally accepts inbound trace context. Requires the trace propagation feature to be enabled.
placement?: UnionMember0 { mode, last_analyzed_at, status } | UnionMember1 { region, last_analyzed_at, status } | UnionMember2 { hostname, last_analyzed_at, status } | 5 moreConfiguration for Smart Placement. Specify mode=‘smart’ for Smart Placement, or one of region/hostname/host.
Configuration for Smart Placement. Specify mode=‘smart’ for Smart Placement, or one of region/hostname/host.
UnionMember0 { mode, last_analyzed_at, status }
Enables Smart Placement.
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember1 { region, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember2 { hostname, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember3 { host, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember4 { mode, region, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember5 { hostname, mode, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember6 { host, mode, last_analyzed_at, status }
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
UnionMember7 { mode, target, last_analyzed_at, status }
target: Array<Region { region } | Hostname { hostname } | Host { host } >Array of placement targets (currently limited to single target).
Array of placement targets (currently limited to single target).
status?: "SUCCESS" | "UNSUPPORTED_APPLICATION" | "INSUFFICIENT_INVOCATIONS"Status of Smart Placement.
Status of Smart Placement.
Upload Worker Module
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(
'this-is_my_script-01',
{
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
dispatch_namespace: 'my-dispatch-namespace',
metadata: {},
},
);
console.log(script.id);{
"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",
"cache_options": {
"enabled": true,
"cross_version_cache": true
},
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2022-05-05T05:15:11.602148Z",
"entry_point": "index.js",
"etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1",
"exports": {
"Admin": {
"type": "worker",
"cache": {
"enabled": true
},
"state": "created"
},
"Counter": {
"storage": "sqlite",
"type": "durable-object",
"container": "my-container",
"state": "created"
},
"OldCounter": {
"state": "renamed",
"type": "durable-object"
},
"default": {
"type": "worker",
"cache": {
"enabled": false
},
"state": "created"
}
},
"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,
"propagation_policy": "authenticated"
}
},
"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
}Returns Examples
{
"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",
"cache_options": {
"enabled": true,
"cross_version_cache": true
},
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2022-05-05T05:15:11.602148Z",
"entry_point": "index.js",
"etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1",
"exports": {
"Admin": {
"type": "worker",
"cache": {
"enabled": true
},
"state": "created"
},
"Counter": {
"storage": "sqlite",
"type": "durable-object",
"container": "my-container",
"state": "created"
},
"OldCounter": {
"state": "renamed",
"type": "durable-object"
},
"default": {
"type": "worker",
"cache": {
"enabled": false
},
"state": "created"
}
},
"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,
"propagation_policy": "authenticated"
}
},
"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
}