Skip to content
Start here

Patch Settings

client.Workers.Scripts.ScriptAndVersionSettings.Edit(ctx, scriptName, params) (*ScriptScriptAndVersionSettingEditResponse, error)
PATCH/accounts/{account_id}/workers/scripts/{script_name}/settings

Patch metadata or config, such as bindings or usage model.

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 ScriptScriptAndVersionSettingEditParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32

Body param

Annotations ScriptScriptAndVersionSettingEditParamsSettingsAnnotationsOptional

Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.

WorkersMessage stringOptional

Human-readable message about the version. Truncated to 1000 bytes if longer.

maxLength1000
WorkersTag stringOptional

User-provided identifier for the version. Maximum 100 bytes.

maxLength100
WorkersTriggeredBy stringOptional

Operation that triggered the creation of the version. This is read-only and set by the server.

Bindings []ScriptScriptAndVersionSettingEditParamsSettingsBindingOptional

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAI struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAIType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearch 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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchType

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespace 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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMessaging struct{…}
Name string

A JavaScript variable name for the binding.

Namespace string

The Messaging namespace to bind to.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMessagingType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngine struct{…}
Dataset string

The name of the dataset to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssets struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowser struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1 struct{…}
DatabaseID string

Identifier of the D1 database to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1Type

The kind of resource that the binding provides.

DeprecatedID stringOptional

This property has been renamed to database_id.

Identifier of the D1 database to bind to.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlob 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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespace struct{…}
Name string

A JavaScript variable name for the binding.

Namespace string

The name of the dispatch namespace.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceType

The kind of resource that the binding provides.

Outbound ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundOptional

Outbound worker.

Params []ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundParamOptional

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

Name string

Name of the parameter.

Worker ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundWorkerOptional

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespace struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdrive struct{…}
ID string

Identifier of the Hyperdrive connection to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInherit struct{…}
Name string

The name of the inherited binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritType

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImages struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJson struct{…}
Json unknown

JSON data to use.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJsonType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespace struct{…}
Name string

A JavaScript variable name for the binding.

NamespaceID string

Namespace identifier tag.

maxLength32
Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMedia struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificate struct{…}
CertificateID string

Identifier of the certificate to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainText struct{…}
Name string

A JavaScript variable name for the binding.

Text string

The text value to use.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelines struct{…}
Name string

A JavaScript variable name for the binding.

Pipeline string

Name of the Pipeline to bind to.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueue struct{…}
Name string

A JavaScript variable name for the binding.

QueueName string

Name of the Queue to bind to.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueueType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimit struct{…}
Name string

A JavaScript variable name for the binding.

NamespaceID string

Identifier of the rate limit namespace to bind to.

Simple ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitSimple

The rate limit configuration.

Limit float64

The limit (requests per period).

Period int64

The period in seconds.

MitigationTimeout int64Optional

Duration in seconds to apply the mitigation action after the rate limit is exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400. Must be greater than or equal to the period when non-zero.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2Bucket struct{…}
BucketName string

R2 bucket to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketType

The kind of resource that the binding provides.

Jurisdiction ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionOptional

The jurisdiction of the R2 bucket.

One of the following:
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "eu"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"
type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretText struct{…}
Name string

A JavaScript variable name for the binding.

Text string

The secret value to use.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmail struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindService struct{…}
Name string

A JavaScript variable name for the binding.

Service string

Name of Worker to bind to.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindServiceType

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlob 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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorize struct{…}
IndexName string

Name of the Vectorize index to bind to.

Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadata struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecret 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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindFlagship struct{…}
AppID string

ID of the Flagship app to bind to for feature flag evaluation.

maxLength128
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindFlagshipType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKey struct{…}
Algorithm unknown

Algorithm-specific key parameters. Learn more.

Format ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat

Data format of the key. Learn more.

One of the following:
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatRaw ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "raw"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatSpki ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "spki"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatJwk ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "jwk"
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyType

The kind of resource that the binding provides.

Usages []ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage

Allowed operations with the key. Learn more.

One of the following:
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "encrypt"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "decrypt"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageSign ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "sign"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageVerify ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "verify"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"
const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflow struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType

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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModule 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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCService struct{…}
Name string

A JavaScript variable name for the binding.

ServiceID string

Identifier of the VPC service to bind to.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceType

The kind of resource that the binding provides.

type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetwork struct{…}
Name string

A JavaScript variable name for the binding.

Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType

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.