Skip to content
Start here

Upload Worker Module

client.Workers.Scripts.Update(ctx, scriptName, params) (*ScriptUpdateResponse, error)
PUT/accounts/{account_id}/workers/scripts/{script_name}

Upload a worker module. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers Scripts Write
ParametersExpand Collapse
scriptName string

Name of the script, used in URLs and route configuration.

params ScriptUpdateParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
Metadata param.Field[ScriptUpdateParamsMetadata]

Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.

Annotations ScriptUpdateParamsMetadataAnnotationsoptional

Annotations for the version created by this upload.

WorkersMessage stringoptional

Human-readable message about the version.

maxLength100
WorkersTag stringoptional

User-provided identifier for the version.

maxLength25
Assets ScriptUpdateParamsMetadataAssetsoptional

Configuration for assets within a Worker.

Config ScriptUpdateParamsMetadataAssetsConfigoptional

Configuration for assets within a Worker.

Headers stringoptional

The contents of a _headers file (used to attach custom headers on asset responses).

Redirects stringoptional

The contents of a _redirects file (used to apply redirects or proxy paths ahead of asset serving).

HTMLHandling ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingoptional

Determines the redirects and rewrites of requests for HTML content.

One of the following:
const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingAutoTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "auto-trailing-slash"
const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingForceTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "force-trailing-slash"
const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingDropTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "drop-trailing-slash"
const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingNone ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "none"
NotFoundHandling ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingoptional

Determines the response when a request does not match a static asset, and there is no Worker script.

One of the following:
const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingNone ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "none"
const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling404Page ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "404-page"
const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingSinglePageApplication ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "single-page-application"
RunWorkerFirst ScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstUnionoptional

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.

One of the following:
type ScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstArray []string

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.

UnionBool
DeprecatedServeDirectly booloptional

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 stringoptional

Token provided upon successful upload of all files from a registered manifest.

Bindings []ScriptUpdateParamsMetadataBindingoptional

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.

One of the following:
type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAI struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearch struct{…}
InstanceName 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 ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchType

The kind of resource that the binding provides.

Namespace stringoptional

The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespace struct{…}
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 ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngine struct{…}
Dataset string

The name of the dataset to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssets struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowser struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1 struct{…}
ID string

Identifier of the D1 database to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1Type

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlob struct{…}
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.

DeprecatedType ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespace struct{…}
Name string

A JavaScript variable name for the binding.

Namespace string

The name of the dispatch namespace.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType

The kind of resource that the binding provides.

Outbound ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundoptional

Outbound worker.

Params []ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundParamoptional

Pass information from the Dispatch Worker to the Outbound Worker through the parameters.

Name string

Name of the parameter.

Worker ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundWorkeroptional

Outbound worker.

Entrypoint stringoptional

Entrypoint to invoke on the outbound worker.

Environment stringoptional

Environment of the outbound worker.

Service stringoptional

Name of the outbound worker.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespace struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType

The kind of resource that the binding provides.

ClassName stringoptional

The exported class name of the Durable Object.

DispatchNamespace stringoptional

The dispatch namespace the Durable Object script belongs to.

Environment stringoptional

The environment of the script_name to bind to.

NamespaceID stringoptional

Namespace identifier tag.

maxLength32
ScriptName stringoptional

The script where the Durable Object is defined, if it is external to this Worker.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdrive struct{…}
ID string

Identifier of the Hyperdrive connection to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindInherit struct{…}
Name string

The name of the inherited binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType

The kind of resource that the binding provides.

OldName stringoptional

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.

VersionID stringoptional

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.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindImages struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindJson struct{…}
Json unknown

JSON data to use.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespace struct{…}
Name string

A JavaScript variable name for the binding.

NamespaceID string

Namespace identifier tag.

maxLength32
Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMedia struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificate struct{…}
CertificateID string

Identifier of the certificate to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainText struct{…}
Name string

A JavaScript variable name for the binding.

Text string

The text value to use.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelines struct{…}
Name string

A JavaScript variable name for the binding.

Pipeline string

Name of the Pipeline to bind to.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueue struct{…}
Name string

A JavaScript variable name for the binding.

QueueName string

Name of the Queue to bind to.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimit struct{…}
Name string

A JavaScript variable name for the binding.

NamespaceID string

Identifier of the rate limit namespace to bind to.

Simple ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitSimple

The rate limit configuration.

Limit float64

The limit (requests per period).

Period int64

The period in seconds.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2Bucket struct{…}
BucketName string

R2 bucket to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketType

The kind of resource that the binding provides.

Jurisdiction ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionoptional

The jurisdiction of the R2 bucket.

One of the following:
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "eu"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"
type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretText struct{…}
Name string

A JavaScript variable name for the binding.

Text string

The secret value to use.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmail struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType

The kind of resource that the binding provides.

AllowedDestinationAddresses []stringoptional

List of allowed destination addresses.

AllowedSenderAddresses []stringoptional

List of allowed sender addresses.

DestinationAddress stringoptional

Destination address for the email.

formatemail
type ScriptUpdateParamsMetadataBindingsWorkersBindingKindService struct{…}
Name string

A JavaScript variable name for the binding.

Service string

Name of Worker to bind to.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceType

The kind of resource that the binding provides.

Entrypoint stringoptional

Entrypoint to invoke on the target Worker.

Environment stringoptional

Optional environment if the Worker utilizes one.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlob struct{…}
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.

DeprecatedType ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorize struct{…}
IndexName string

Name of the Vectorize index to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadata struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecret struct{…}
Name string

A JavaScript variable name for the binding.

SecretName string

Name of the secret in the store.

StoreID string

ID of the store containing the secret.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKey struct{…}
Algorithm unknown

Algorithm-specific key parameters. Learn more.

Format ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat

Data format of the key. Learn more.

One of the following:
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatRaw ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "raw"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatSpki ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "spki"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatJwk ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "jwk"
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyType

The kind of resource that the binding provides.

Usages []ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage

Allowed operations with the key. Learn more.

One of the following:
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "encrypt"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "decrypt"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageSign ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "sign"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageVerify ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "verify"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"
const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"
KeyBase64 stringoptional

Base64-encoded key data. Required if format is "raw", "pkcs8", or "spki".

KeyJwk unknownoptional

Key data in JSON Web Key format. Required if format is "jwk".

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflow struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType

The kind of resource that the binding provides.

WorkflowName string

Name of the Workflow to bind to.

ClassName stringoptional

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

ScriptName stringoptional

Script name that contains the Workflow. If not provided, defaults to this script name.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModule struct{…}
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.

DeprecatedType ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCService struct{…}
Name string

A JavaScript variable name for the binding.

ServiceID string

Identifier of the VPC service to bind to.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceType

The kind of resource that the binding provides.

type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetwork struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType

The kind of resource that the binding provides.

NetworkID stringoptional

Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.

TunnelID stringoptional

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

BodyPart stringoptional

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.

CompatibilityDate stringoptional

Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.

CompatibilityFlags []stringoptional

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.

KeepAssets booloptional

Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token.

KeepBindings []stringoptional

List of binding types to keep from previous_upload.

Limits ScriptUpdateParamsMetadataLimitsoptional

Limits to apply for this Worker.

CPUMs int64optional

The amount of CPU time this Worker can use in milliseconds.

Logpush booloptional

Whether Logpush is turned on for the Worker.

MainModule stringoptional

Name of the uploaded file that contains the main module (e.g. the file exporting a fetch handler). Indicates a module syntax Worker.

Migrations ScriptUpdateParamsMetadataMigrationsoptional

Migrations to apply for Durable Objects associated with this Worker.

One of the following:
type SingleStepMigration struct{…}

A single set of migrations to apply.

DeletedClasses []stringoptional

A list of classes to delete Durable Object namespaces from.

NewClasses []stringoptional

A list of classes to create Durable Object namespaces from.

NewSqliteClasses []stringoptional

A list of classes to create Durable Object namespaces with SQLite from.

NewTag stringoptional

Tag to set as the latest migration tag.

OldTag stringoptional

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

RenamedClasses []SingleStepMigrationRenamedClassoptional

A list of classes with Durable Object namespaces that were renamed.

From stringoptional
To stringoptional
TransferredClasses []SingleStepMigrationTransferredClassoptional

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

From stringoptional
FromScript stringoptional
To stringoptional
type ScriptUpdateParamsMetadataMigrationsWorkersMultipleStepMigrations struct{…}
NewTag stringoptional

Tag to set as the latest migration tag.

OldTag stringoptional

Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.

Steps []MigrationStepoptional

Migrations to apply in order.

DeletedClasses []stringoptional

A list of classes to delete Durable Object namespaces from.

NewClasses []stringoptional

A list of classes to create Durable Object namespaces from.

NewSqliteClasses []stringoptional

A list of classes to create Durable Object namespaces with SQLite from.

RenamedClasses []MigrationStepRenamedClassoptional

A list of classes with Durable Object namespaces that were renamed.

From stringoptional
To stringoptional
TransferredClasses []MigrationStepTransferredClassoptional

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

From stringoptional
FromScript stringoptional
To stringoptional
Observability ScriptUpdateParamsMetadataObservabilityoptional

Observability settings for the Worker.

Enabled bool

Whether observability is enabled for the Worker.

HeadSamplingRate float64optional

The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

Logs ScriptUpdateParamsMetadataObservabilityLogsoptional

Log settings for the Worker.

Enabled bool

Whether logs are enabled for the Worker.

InvocationLogs bool

Whether invocation logs are enabled for the Worker.

Destinations []stringoptional

A list of destinations where logs will be exported to.

HeadSamplingRate float64optional

The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

Persist booloptional

Whether log persistence is enabled for the Worker.

Traces ScriptUpdateParamsMetadataObservabilityTracesoptional

Trace settings for the Worker.

Destinations []stringoptional

A list of destinations where traces will be exported to.

Enabled booloptional

Whether traces are enabled for the Worker.

HeadSamplingRate float64optional

The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

Persist booloptional

Whether trace persistence is enabled for the Worker.

Placement ScriptUpdateParamsMetadataPlacementoptional

Configuration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host.

One of the following:
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Mode ScriptUpdateParamsMetadataPlacementObjectMode

Enables Smart Placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Region string

Cloud region for targeted placement in format 'provider:region'.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Hostname string

HTTP hostname for targeted placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Host string

TCP host and port for targeted placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Mode ScriptUpdateParamsMetadataPlacementObjectMode

Targeted placement mode.

Region string

Cloud region for targeted placement in format 'provider:region'.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Hostname string

HTTP hostname for targeted placement.

Mode ScriptUpdateParamsMetadataPlacementObjectMode

Targeted placement mode.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Host string

TCP host and port for targeted placement.

Mode ScriptUpdateParamsMetadataPlacementObjectMode

Targeted placement mode.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateParamsMetadataPlacementObject struct{…}
Mode ScriptUpdateParamsMetadataPlacementObjectMode

Targeted placement mode.

Target []ScriptUpdateParamsMetadataPlacementObjectTarget

Array of placement targets (currently limited to single target).

One of the following:
type ScriptUpdateParamsMetadataPlacementObjectTargetRegion struct{…}
Region string

Cloud region in format 'provider:region'.

type ScriptUpdateParamsMetadataPlacementObjectTargetHostname struct{…}
Hostname string

HTTP hostname for targeted placement.

type ScriptUpdateParamsMetadataPlacementObjectTargetHost struct{…}
Host string

TCP host:port for targeted placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateParamsMetadataPlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"
const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
Tags []stringoptional

List of strings to use as tags for this Worker.

TailConsumers []ConsumerScriptoptional

List of Workers that will consume logs from the attached Worker.

Service string

Name of Worker that is to be the consumer.

Environment stringoptional

Optional environment if the Worker utilizes one.

Namespace stringoptional

Optional dispatch namespace the script belongs to.

UsageModel ScriptUpdateParamsMetadataUsageModeloptional

Usage model for the Worker invocations.

One of the following:
const ScriptUpdateParamsMetadataUsageModelStandard ScriptUpdateParamsMetadataUsageModel = "standard"
const ScriptUpdateParamsMetadataUsageModelBundled ScriptUpdateParamsMetadataUsageModel = "bundled"
const ScriptUpdateParamsMetadataUsageModelUnbound ScriptUpdateParamsMetadataUsageModel = "unbound"
BindingsInherit param.Field[ScriptUpdateParamsBindingsInherit]optional

Query param: When set to "strict", the upload will fail if any inherit type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.

const ScriptUpdateParamsBindingsInheritStrict ScriptUpdateParamsBindingsInherit = "strict"
Files param.Field[[]Reader]optional

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
type ScriptUpdateResponse struct{…}
StartupTimeMs int64
ID stringoptional

The name used to identify the script.

CompatibilityDate stringoptional

Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.

CompatibilityFlags []stringoptional

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.

CreatedOn Timeoptional

When the script was created.

formatdate-time
EntryPoint stringoptional

The entry point for the script.

Etag stringoptional

Hashed script content, can be used in a If-None-Match header when updating.

Handlers []stringoptional

The names of handlers exported as part of the default export.

HasAssets booloptional

Whether a Worker contains assets.

HasModules booloptional

Whether a Worker contains modules.

LastDeployedFrom stringoptional

The client most recently used to deploy this Worker.

Logpush booloptional

Whether Logpush is turned on for the Worker.

MigrationTag stringoptional

The tag of the Durable Object migration that was most recently applied for this Worker.

ModifiedOn Timeoptional

When the script was last modified.

formatdate-time
NamedHandlers []ScriptUpdateResponseNamedHandleroptional

Named exports, such as Durable Object class implementations and named entrypoints.

Handlers []stringoptional

The names of handlers exported as part of the named export.

Name stringoptional

The name of the export.

Observability ScriptUpdateResponseObservabilityoptional

Observability settings for the Worker.

Enabled bool

Whether observability is enabled for the Worker.

HeadSamplingRate float64optional

The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

Logs ScriptUpdateResponseObservabilityLogsoptional

Log settings for the Worker.

Enabled bool

Whether logs are enabled for the Worker.

InvocationLogs bool

Whether invocation logs are enabled for the Worker.

Destinations []stringoptional

A list of destinations where logs will be exported to.

HeadSamplingRate float64optional

The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

Persist booloptional

Whether log persistence is enabled for the Worker.

Traces ScriptUpdateResponseObservabilityTracesoptional

Trace settings for the Worker.

Destinations []stringoptional

A list of destinations where traces will be exported to.

Enabled booloptional

Whether traces are enabled for the Worker.

HeadSamplingRate float64optional

The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

Persist booloptional

Whether trace persistence is enabled for the Worker.

Placement ScriptUpdateResponsePlacementoptional

Configuration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host.

One of the following:
type ScriptUpdateResponsePlacementObject struct{…}
Mode ScriptUpdateResponsePlacementObjectMode

Enables Smart Placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Region string

Cloud region for targeted placement in format 'provider:region'.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Hostname string

HTTP hostname for targeted placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Host string

TCP host and port for targeted placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Mode ScriptUpdateResponsePlacementObjectMode

Targeted placement mode.

Region string

Cloud region for targeted placement in format 'provider:region'.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Hostname string

HTTP hostname for targeted placement.

Mode ScriptUpdateResponsePlacementObjectMode

Targeted placement mode.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Host string

TCP host and port for targeted placement.

Mode ScriptUpdateResponsePlacementObjectMode

Targeted placement mode.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
type ScriptUpdateResponsePlacementObject struct{…}
Mode ScriptUpdateResponsePlacementObjectMode

Targeted placement mode.

Target []ScriptUpdateResponsePlacementObjectTarget

Array of placement targets (currently limited to single target).

One of the following:
type ScriptUpdateResponsePlacementObjectTargetRegion struct{…}
Region string

Cloud region in format 'provider:region'.

type ScriptUpdateResponsePlacementObjectTargetHostname struct{…}
Hostname string

HTTP hostname for targeted placement.

type ScriptUpdateResponsePlacementObjectTargetHost struct{…}
Host string

TCP host:port for targeted placement.

LastAnalyzedAt Timeoptional

The last time the script was analyzed for Smart Placement.

formatdate-time
Status ScriptUpdateResponsePlacementObjectStatusoptional

Status of Smart Placement.

One of the following:
const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"
const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"
DeprecatedPlacementMode ScriptUpdateResponsePlacementModeoptional
One of the following:
const ScriptUpdateResponsePlacementModeSmart ScriptUpdateResponsePlacementMode = "smart"
const ScriptUpdateResponsePlacementModeTargeted ScriptUpdateResponsePlacementMode = "targeted"
DeprecatedPlacementStatus ScriptUpdateResponsePlacementStatusoptional
One of the following:
const ScriptUpdateResponsePlacementStatusSuccess ScriptUpdateResponsePlacementStatus = "SUCCESS"
const ScriptUpdateResponsePlacementStatusUnsupportedApplication ScriptUpdateResponsePlacementStatus = "UNSUPPORTED_APPLICATION"
const ScriptUpdateResponsePlacementStatusInsufficientInvocations ScriptUpdateResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"
Tag stringoptional

The immutable ID of the script.

Tags []stringoptional

Tags associated with the Worker.

TailConsumers []ConsumerScriptoptional

List of Workers that will consume logs from the attached Worker.

Service string

Name of Worker that is to be the consumer.

Environment stringoptional

Optional environment if the Worker utilizes one.

Namespace stringoptional

Optional dispatch namespace the script belongs to.

UsageModel ScriptUpdateResponseUsageModeloptional

Usage model for the Worker invocations.

One of the following:
const ScriptUpdateResponseUsageModelStandard ScriptUpdateResponseUsageModel = "standard"
const ScriptUpdateResponseUsageModelBundled ScriptUpdateResponseUsageModel = "bundled"
const ScriptUpdateResponseUsageModelUnbound ScriptUpdateResponseUsageModel = "unbound"

Upload Worker Module

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/workers"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  script, err := client.Workers.Scripts.Update(
    context.TODO(),
    "this-is_my_script-01",
    workers.ScriptUpdateParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
      Metadata: cloudflare.F(workers.ScriptUpdateParamsMetadata{

      }),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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",
    "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
}
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",
    "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
}