Patch Script Settings
Patch script metadata, such as bindings.
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 DispatchNamespaceScriptSettingEditParams
Body param: Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts.
Body param: Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts.
Bindings []DispatchNamespaceScriptSettingEditParamsSettingsBindingOptionalList 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.
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearch struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespace struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngine struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindD1 struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDataBlob struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespace struct{…}
The kind of resource that the binding provides.
Outbound DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundOptionalOutbound worker.
Outbound worker.
Params []DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundParamOptionalPass information from the Dispatch Worker to the Outbound Worker through the parameters.
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespace struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindInherit struct{…}
The kind of resource that the binding provides.
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespace struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificate struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindRatelimit struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2Bucket struct{…}
The kind of resource that the binding provides.
Jurisdiction DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionOptionalThe jurisdiction of the R2 bucket.
The jurisdiction of the R2 bucket.
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSendEmail struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindService struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindTextBlob struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadata struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecret struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKey struct{…}
Algorithm-specific key parameters. Learn more.
Format DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatData format of the key. Learn more.
Data format of the key. Learn more.
The kind of resource that the binding provides.
Usages []DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageAllowed 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”.
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWorkflow struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWasmModule struct{…}
type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetwork struct{…}
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.
Limits DispatchNamespaceScriptSettingEditParamsSettingsLimitsOptionalLimits to apply for this Worker.
Limits to apply for this Worker.
Migrations DispatchNamespaceScriptSettingEditParamsSettingsMigrationsOptionalMigrations to apply for Durable Objects associated with this Worker.
Migrations to apply for Durable Objects associated with this Worker.
type SingleStepMigration struct{…}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.
type DispatchNamespaceScriptSettingEditParamsSettingsMigrationsWorkersMultipleStepMigrations struct{…}
Tag used to verify against the latest migration tag for this Worker. If they don’t match, the upload is rejected.
Observability DispatchNamespaceScriptSettingEditParamsSettingsObservabilityOptionalObservability 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 DispatchNamespaceScriptSettingEditParamsSettingsObservabilityLogsOptionalLog settings for the Worker.
Log settings for the Worker.
Whether invocation logs are enabled for the Worker.
Traces DispatchNamespaceScriptSettingEditParamsSettingsObservabilityTracesOptionalTrace 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.
PropagationPolicy DispatchNamespaceScriptSettingEditParamsSettingsObservabilityTracesPropagationPolicyOptionalControls 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 DispatchNamespaceScriptSettingEditParamsSettingsPlacementOptionalConfiguration 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.
type DispatchNamespaceScriptSettingEditParamsSettingsPlacementMode struct{…}
Enables Smart Placement.
type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObject struct{…}
Target []DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectTargetArray of placement targets (currently limited to single target).
Array of placement targets (currently limited to single target).
UsageModel DispatchNamespaceScriptSettingEditParamsSettingsUsageModelOptionalUsage model for the Worker invocations.
Usage model for the Worker invocations.
ReturnsExpand Collapse
type DispatchNamespaceScriptSettingEditResponse struct{…}Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts.
Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts.
Bindings []DispatchNamespaceScriptSettingEditResponseBindingOptionalList 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.
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearch struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchNamespace struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindD1 struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDataBlob struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespace struct{…}
The kind of resource that the binding provides.
Outbound DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundOptionalOutbound worker.
Outbound worker.
Params []DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParamOptionalPass information from the Dispatch Worker to the Outbound Worker through the parameters.
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindInherit struct{…}
The kind of resource that the binding provides.
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindRatelimit struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2Bucket struct{…}
The kind of resource that the binding provides.
Jurisdiction DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionOptionalThe jurisdiction of the R2 bucket.
The jurisdiction of the R2 bucket.
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSendEmail struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindService struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindTextBlob struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecret struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKey struct{…}
Algorithm-specific key parameters. Learn more.
Format DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatData format of the key. Learn more.
Data format of the key. Learn more.
The kind of resource that the binding provides.
Usages []DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageAllowed 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”.
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWorkflow struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWasmModule struct{…}
type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCNetwork struct{…}
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.
Migrations DispatchNamespaceScriptSettingEditResponseMigrationsOptionalMigrations to apply for Durable Objects associated with this Worker.
Migrations to apply for Durable Objects associated with this Worker.
type SingleStepMigration struct{…}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.
type DispatchNamespaceScriptSettingEditResponseMigrationsWorkersMultipleStepMigrations struct{…}
Tag used to verify against the latest migration tag for this Worker. If they don’t match, the upload is rejected.
Observability DispatchNamespaceScriptSettingEditResponseObservabilityOptionalObservability 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 DispatchNamespaceScriptSettingEditResponseObservabilityLogsOptionalLog settings for the Worker.
Log settings for the Worker.
Whether invocation logs are enabled for the Worker.
Traces DispatchNamespaceScriptSettingEditResponseObservabilityTracesOptionalTrace 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.
PropagationPolicy DispatchNamespaceScriptSettingEditResponseObservabilityTracesPropagationPolicyOptionalControls 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 DispatchNamespaceScriptSettingEditResponsePlacementOptionalConfiguration 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.
type DispatchNamespaceScriptSettingEditResponsePlacementMode struct{…}
Enables Smart Placement.
type DispatchNamespaceScriptSettingEditResponsePlacementObject struct{…}
Target []DispatchNamespaceScriptSettingEditResponsePlacementObjectTargetArray of placement targets (currently limited to single target).
Array of placement targets (currently limited to single target).
UsageModel DispatchNamespaceScriptSettingEditResponseUsageModelOptionalUsage model for the Worker invocations.
Usage model for the Worker invocations.
Patch Script Settings
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/cloudflare-go"
"github.com/stainless-sdks/cloudflare-go/option"
"github.com/stainless-sdks/cloudflare-go/workers_for_platforms"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Edit(
context.TODO(),
"my-dispatch-namespace",
"this-is_my_script-01",
workers_for_platforms.DispatchNamespaceScriptSettingEditParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Bindings)
}
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50,
"subrequests": 1000
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true,
"propagation_policy": "authenticated"
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
}
}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"
}
}
],
"success": true,
"result": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50,
"subrequests": 1000
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true,
"propagation_policy": "authenticated"
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
}
}