# Scripts
## List Workers
`client.Workers.Scripts.List(ctx, params) (*SinglePage[ScriptListResponse], error)`
**get** `/accounts/{account_id}/workers/scripts`
Fetch a list of uploaded workers.
### Parameters
- `params ScriptListParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Tags param.Field[string]`
Query param: Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.
### Returns
- `type ScriptListResponse struct{…}`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 Time`
When the script was created.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptListResponseNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptListResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptListResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptListResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptListResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptListResponsePlacementObject struct{…}`
- `Mode ScriptListResponsePlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectModeSmart ScriptListResponsePlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `Target []ScriptListResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptListResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptListResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptListResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptListResponsePlacementMode`
- `const ScriptListResponsePlacementModeSmart ScriptListResponsePlacementMode = "smart"`
- `const ScriptListResponsePlacementModeTargeted ScriptListResponsePlacementMode = "targeted"`
- `PlacementStatus ScriptListResponsePlacementStatus`
- `const ScriptListResponsePlacementStatusSuccess ScriptListResponsePlacementStatus = "SUCCESS"`
- `const ScriptListResponsePlacementStatusUnsupportedApplication ScriptListResponsePlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementStatusInsufficientInvocations ScriptListResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Routes []ScriptListResponseRoute`
Routes associated with the Worker.
- `ID string`
Identifier.
- `Pattern string`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script string`
Name of the script to run if the route matches.
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptListResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptListResponseUsageModelStandard ScriptListResponseUsageModel = "standard"`
- `const ScriptListResponseUsageModelBundled ScriptListResponseUsageModel = "bundled"`
- `const ScriptListResponseUsageModelUnbound ScriptListResponseUsageModel = "unbound"`
### Example
```go
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"),
)
page, err := client.Workers.Scripts.List(context.TODO(), workers.ScriptListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "my-workers-script",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2017-01-01T00:00:00Z",
"etag": "ea95132c15732412d22c1476fa83f27a",
"handlers": [
"fetch",
"scheduled"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2017-01-01T00:00:00Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"routes": [
{
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
}
],
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
}
],
"success": true
}
```
## Search Workers
`client.Workers.Scripts.Search(ctx, params) (*[]ScriptSearchResponse, error)`
**get** `/accounts/{account_id}/workers/scripts-search`
Search for Workers in an account.
### Parameters
- `params ScriptSearchParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `ID param.Field[string]`
Query param: Worker ID (also called tag) to search for. Only exact matches are returned.
- `Name param.Field[string]`
Query param: Worker name to search for. Both exact and partial matches are returned.
- `OrderBy param.Field[ScriptSearchParamsOrderBy]`
Query param: Property to sort results by. Results are sorted in ascending order.
- `const ScriptSearchParamsOrderByCreatedOn ScriptSearchParamsOrderBy = "created_on"`
- `const ScriptSearchParamsOrderByModifiedOn ScriptSearchParamsOrderBy = "modified_on"`
- `const ScriptSearchParamsOrderByName ScriptSearchParamsOrderBy = "name"`
- `Page param.Field[int64]`
Query param: Current page.
- `PerPage param.Field[int64]`
Query param: Items per page.
### Returns
- `type ScriptSearchResponseEnvelopeResult []ScriptSearchResponse`
- `ID string`
Identifier.
- `CreatedOn Time`
When the script was created.
- `ModifiedOn Time`
When the script was last modified.
- `ScriptName string`
Name of the script, used in URLs and route configuration.
- `EnvironmentIsDefault bool`
Whether the environment is the default environment.
- `EnvironmentName string`
Name of the environment.
- `ServiceName string`
Name of the service.
### Example
```go
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"),
)
response, err := client.Workers.Scripts.Search(context.TODO(), workers.ScriptSearchParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"created_on": "2017-01-01T00:00:00Z",
"modified_on": "2017-01-01T00:00:00Z",
"script_name": "this-is_my_script-01",
"environment_is_default": true,
"environment_name": "production",
"service_name": "my-service"
}
],
"success": true,
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}
```
## Download Worker
`client.Workers.Scripts.Get(ctx, scriptName, query) (*string, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}`
Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptGetResponse string`
### Example
```go
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.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script)
}
```
## 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/.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Metadata param.Field[ScriptUpdateParamsMetadata]`
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
- `Annotations ScriptUpdateParamsMetadataAnnotations`
Annotations for the version created by this upload.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `Assets ScriptUpdateParamsMetadataAssets`
Configuration for assets within a Worker.
- `Config ScriptUpdateParamsMetadataAssetsConfig`
Configuration for assets within a Worker.
- `Headers string`
The contents of a _headers file (used to attach custom headers on asset responses).
- `Redirects string`
The contents of a _redirects file (used to apply redirects or proxy paths ahead of asset serving).
- `HTMLHandling ScriptUpdateParamsMetadataAssetsConfigHTMLHandling`
Determines the redirects and rewrites of requests for HTML content.
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingAutoTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "auto-trailing-slash"`
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingForceTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "force-trailing-slash"`
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingDropTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "drop-trailing-slash"`
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingNone ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "none"`
- `NotFoundHandling ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling`
Determines the response when a request does not match a static asset, and there is no Worker script.
- `const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingNone ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "none"`
- `const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling404Page ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "404-page"`
- `const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingSinglePageApplication ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "single-page-application"`
- `RunWorkerFirst ScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstUnion`
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.
- `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`
- `ServeDirectly bool`
When true and the incoming request matches an asset, that will be served instead of invoking the Worker script. When false, requests will always invoke the Worker script.
- `JWT string`
Token provided upon successful upload of all files from a registered manifest.
- `Bindings []ScriptUpdateParamsMetadataBinding`
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 ScriptUpdateParamsMetadataBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAITypeAI ScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType = "ai"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchTypeAISearch ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsTypeAssets ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserTypeBrowser ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType = "browser"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1TypeD1 ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1Type = "d1"`
- `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.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritTypeInherit ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesTypeImages ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType = "images"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonTypeJson ScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaTypeMedia ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType = "media"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextTypePlainText ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesTypePipelines ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueTypeQueue ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueType = "queue"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextTypeSecretText ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceTypeService ScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
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.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeTypeVectorize ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `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 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
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.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `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.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `BodyPart string`
Name of the uploaded file that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 bool`
Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token.
- `KeepBindings []string`
List of binding types to keep from previous_upload.
- `Limits ScriptUpdateParamsMetadataLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MainModule string`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
- `Migrations ScriptUpdateParamsMetadataMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptUpdateParamsMetadataMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptUpdateParamsMetadataObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptUpdateParamsMetadataObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptUpdateParamsMetadataObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptUpdateParamsMetadataPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectModeSmart ScriptUpdateParamsMetadataPlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `Target []ScriptUpdateParamsMetadataPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tags []string`
List of strings to use as tags for this Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUpdateParamsMetadataUsageModel`
Usage model for the Worker invocations.
- `const ScriptUpdateParamsMetadataUsageModelStandard ScriptUpdateParamsMetadataUsageModel = "standard"`
- `const ScriptUpdateParamsMetadataUsageModelBundled ScriptUpdateParamsMetadataUsageModel = "bundled"`
- `const ScriptUpdateParamsMetadataUsageModelUnbound ScriptUpdateParamsMetadataUsageModel = "unbound"`
- `BindingsInherit param.Field[ScriptUpdateParamsBindingsInherit]`
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]`
Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
### Returns
- `type ScriptUpdateResponse struct{…}`
- `StartupTimeMs int64`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 Time`
When the script was created.
- `EntryPoint string`
The entry point for the script.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptUpdateResponseNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptUpdateResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptUpdateResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptUpdateResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptUpdateResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Mode ScriptUpdateResponsePlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectModeSmart ScriptUpdateResponsePlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Mode ScriptUpdateResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `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.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Mode ScriptUpdateResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `Target []ScriptUpdateResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `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 Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptUpdateResponsePlacementMode`
- `const ScriptUpdateResponsePlacementModeSmart ScriptUpdateResponsePlacementMode = "smart"`
- `const ScriptUpdateResponsePlacementModeTargeted ScriptUpdateResponsePlacementMode = "targeted"`
- `PlacementStatus ScriptUpdateResponsePlacementStatus`
- `const ScriptUpdateResponsePlacementStatusSuccess ScriptUpdateResponsePlacementStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementStatusUnsupportedApplication ScriptUpdateResponsePlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementStatusInsufficientInvocations ScriptUpdateResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUpdateResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptUpdateResponseUsageModelStandard ScriptUpdateResponseUsageModel = "standard"`
- `const ScriptUpdateResponseUsageModelBundled ScriptUpdateResponseUsageModel = "bundled"`
- `const ScriptUpdateResponseUsageModelUnbound ScriptUpdateResponseUsageModel = "unbound"`
### Example
```go
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)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"startup_time_ms": 10,
"id": "this-is_my_script-01",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2022-05-05T05:15:11.602148Z",
"entry_point": "index.js",
"etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1",
"handlers": [
"fetch"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2022-05-20T19:02:56.446492Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## Delete Worker
`client.Workers.Scripts.Delete(ctx, scriptName, params) (*ScriptDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}`
Delete your worker. This call has no response body on a successful delete.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptDeleteParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Force param.Field[bool]`
Query param: If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.
### Returns
- `type ScriptDeleteResponse interface{…}`
### Example
```go
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.Delete(
context.TODO(),
"this-is_my_script-01",
workers.ScriptDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {}
}
```
## Domain Types
### Script
- `type Script struct{…}`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 Time`
When the script was created.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Target []ScriptPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptPlacementMode`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"`
- `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"`
- `PlacementStatus ScriptPlacementStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"`
- `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUsageModel`
Usage model for the Worker invocations.
- `const ScriptUsageModelStandard ScriptUsageModel = "standard"`
- `const ScriptUsageModelBundled ScriptUsageModel = "bundled"`
- `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"`
### Script Setting
- `type ScriptSetting struct{…}`
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Observability ScriptSettingObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptSettingObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptSettingObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
# Assets
# Upload
## Create Assets Upload Session
`client.Workers.Scripts.Assets.Upload.New(ctx, scriptName, params) (*ScriptAssetUploadNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session`
Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptAssetUploadNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Manifest param.Field[map[string, ScriptAssetUploadNewParamsManifest]]`
Body param: A manifest ([path]: {hash, size}) map of files to upload. As an example, `/blog/hello-world.html` would be a valid path key.
- `Hash string`
The hash of the file.
- `Size int64`
The size of the file in bytes.
### Returns
- `type ScriptAssetUploadNewResponse struct{…}`
- `Buckets [][]string`
The requests to make to upload assets.
- `JWT string`
A JWT to use as authentication for uploading assets.
### Example
```go
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"),
)
upload, err := client.Workers.Scripts.Assets.Upload.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptAssetUploadNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Manifest: cloudflare.F(map[string]workers.ScriptAssetUploadNewParamsManifest{
"foo": workers.ScriptAssetUploadNewParamsManifest{
Hash: cloudflare.F("hash"),
Size: cloudflare.F(int64(0)),
},
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", upload.Buckets)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"buckets": [
[
"string"
]
],
"jwt": "jwt"
}
}
```
# Subdomain
## Get Worker subdomain
`client.Workers.Scripts.Subdomain.Get(ctx, scriptName, query) (*ScriptSubdomainGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Get if the Worker is available on the workers.dev subdomain.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptSubdomainGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSubdomainGetResponse struct{…}`
- `Enabled bool`
Whether the Worker is available on the workers.dev subdomain.
- `PreviewsEnabled bool`
Whether the Worker's Preview URLs are available on the workers.dev subdomain.
### Example
```go
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"),
)
subdomain, err := client.Workers.Scripts.Subdomain.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSubdomainGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Enabled)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Post Worker subdomain
`client.Workers.Scripts.Subdomain.New(ctx, scriptName, params) (*ScriptSubdomainNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Enable or disable the Worker on the workers.dev subdomain.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptSubdomainNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Enabled param.Field[bool]`
Body param: Whether the Worker should be available on the workers.dev subdomain.
- `PreviewsEnabled param.Field[bool]`
Body param: Whether the Worker's Preview URLs should be available on the workers.dev subdomain.
### Returns
- `type ScriptSubdomainNewResponse struct{…}`
- `Enabled bool`
Whether the Worker is available on the workers.dev subdomain.
- `PreviewsEnabled bool`
Whether the Worker's Preview URLs are available on the workers.dev subdomain.
### Example
```go
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"),
)
subdomain, err := client.Workers.Scripts.Subdomain.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSubdomainNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Enabled: cloudflare.F(true),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Enabled)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Delete Worker subdomain
`client.Workers.Scripts.Subdomain.Delete(ctx, scriptName, body) (*ScriptSubdomainDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Disable all workers.dev subdomains for a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `body ScriptSubdomainDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSubdomainDeleteResponse struct{…}`
- `Enabled bool`
Whether the Worker is available on the workers.dev subdomain.
- `PreviewsEnabled bool`
Whether the Worker's Preview URLs are available on the workers.dev subdomain.
### Example
```go
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"),
)
subdomain, err := client.Workers.Scripts.Subdomain.Delete(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSubdomainDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Enabled)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
# Schedules
## Get Cron Triggers
`client.Workers.Scripts.Schedules.Get(ctx, scriptName, query) (*ScriptScheduleGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/schedules`
Fetches Cron Triggers for a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptScheduleGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptScheduleGetResponse struct{…}`
- `Schedules []ScriptScheduleGetResponseSchedule`
- `Cron string`
- `CreatedOn string`
- `ModifiedOn string`
### Example
```go
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"),
)
schedule, err := client.Workers.Scripts.Schedules.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScheduleGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", schedule.Schedules)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"schedules": [
{
"cron": "*/30 * * * *",
"created_on": "created_on",
"modified_on": "modified_on"
}
]
},
"success": true
}
```
## Update Cron Triggers
`client.Workers.Scripts.Schedules.Update(ctx, scriptName, params) (*ScriptScheduleUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/schedules`
Updates Cron Triggers for a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptScheduleUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Body param.Field[[]ScriptScheduleUpdateParamsBody]`
Body param
- `Cron string`
- `CreatedOn string`
- `ModifiedOn string`
### Returns
- `type ScriptScheduleUpdateResponse struct{…}`
- `Schedules []ScriptScheduleUpdateResponseSchedule`
- `Cron string`
- `CreatedOn string`
- `ModifiedOn string`
### Example
```go
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"),
)
schedule, err := client.Workers.Scripts.Schedules.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScheduleUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: []workers.ScriptScheduleUpdateParamsBody{workers.ScriptScheduleUpdateParamsBody{
Cron: cloudflare.F("*/30 * * * *"),
}},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", schedule.Schedules)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"schedules": [
{
"cron": "*/30 * * * *",
"created_on": "created_on",
"modified_on": "modified_on"
}
]
},
"success": true
}
```
# Tail
## List Tails
`client.Workers.Scripts.Tail.Get(ctx, scriptName, query) (*ScriptTailGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/tails`
Get list of tails currently deployed on a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptTailGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptTailGetResponse struct{…}`
- `ID string`
Identifier.
- `ExpiresAt string`
- `URL string`
### Example
```go
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"),
)
tail, err := client.Workers.Scripts.Tail.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptTailGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tail.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"expires_at": "expires_at",
"url": "url"
},
"success": true
}
```
## Start Tail
`client.Workers.Scripts.Tail.New(ctx, scriptName, params) (*ScriptTailNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/tails`
Starts a tail that receives logs and exception from a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptTailNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Body param.Field[unknown]`
Body param
### Returns
- `type ScriptTailNewResponse struct{…}`
- `ID string`
Identifier.
- `ExpiresAt string`
- `URL string`
### Example
```go
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"),
)
tail, err := client.Workers.Scripts.Tail.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptTailNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: map[string]interface{}{
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tail.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"expires_at": "expires_at",
"url": "url"
},
"success": true
}
```
## Delete Tail
`client.Workers.Scripts.Tail.Delete(ctx, scriptName, id, body) (*ScriptTailDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}`
Deletes a tail from a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `id string`
Identifier.
- `body ScriptTailDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptTailDeleteResponse struct{…}`
- `Errors []ScriptTailDeleteResponseError`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptTailDeleteResponseErrorsSource`
- `Pointer string`
- `Messages []ScriptTailDeleteResponseMessage`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptTailDeleteResponseMessagesSource`
- `Pointer string`
- `Success ScriptTailDeleteResponseSuccess`
Whether the API call was successful.
- `const ScriptTailDeleteResponseSuccessTrue ScriptTailDeleteResponseSuccess = true`
### Example
```go
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"),
)
tail, err := client.Workers.Scripts.Tail.Delete(
context.TODO(),
"this-is_my_script-01",
"023e105f4ecef8ad9ca31a8372d0c353",
workers.ScriptTailDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tail.Errors)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true
}
```
## Domain Types
### Consumer Script
- `type ConsumerScript struct{…}`
A reference to a script that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
# Content
## Get script content
`client.Workers.Scripts.Content.Get(ctx, scriptName, query) (*Response, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/content/v2`
Fetch script content only.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptContentGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptContentGetResponse interface{…}`
### Example
```go
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"),
)
content, err := client.Workers.Scripts.Content.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptContentGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", content)
}
```
## Put script content
`client.Workers.Scripts.Content.Update(ctx, scriptName, params) (*Script, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/content`
Put script content without touching config or metadata.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptContentUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Metadata param.Field[ScriptContentUpdateParamsMetadata]`
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
- `BodyPart string`
Name of the uploaded file that contains the Worker script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker.
- `MainModule string`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
- `Files param.Field[[]Reader]`
Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
- `CfWorkerBodyPart param.Field[string]`
Header param: The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.
- `CfWorkerMainModulePart param.Field[string]`
Header param: The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.
### Returns
- `type Script struct{…}`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 Time`
When the script was created.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Target []ScriptPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptPlacementMode`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"`
- `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"`
- `PlacementStatus ScriptPlacementStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"`
- `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUsageModel`
Usage model for the Worker invocations.
- `const ScriptUsageModelStandard ScriptUsageModel = "standard"`
- `const ScriptUsageModelBundled ScriptUsageModel = "bundled"`
- `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"`
### Example
```go
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.Content.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptContentUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Metadata: cloudflare.F(workers.ScriptContentUpdateParamsMetadata{
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "my-workers-script",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2017-01-01T00:00:00Z",
"etag": "ea95132c15732412d22c1476fa83f27a",
"handlers": [
"fetch",
"scheduled"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2017-01-01T00:00:00Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
# Settings
## Get Script Settings
`client.Workers.Scripts.Settings.Get(ctx, scriptName, query) (*ScriptSetting, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/script-settings`
Get script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Includes Logpush and Tail Consumers.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptSettingGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSetting struct{…}`
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Observability ScriptSettingObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptSettingObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptSettingObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
### Example
```go
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"),
)
scriptSetting, err := client.Workers.Scripts.Settings.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSettingGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scriptSetting.Logpush)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"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
}
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
]
},
"success": true
}
```
## Patch Script Settings
`client.Workers.Scripts.Settings.Edit(ctx, scriptName, params) (*ScriptSetting, error)`
**patch** `/accounts/{account_id}/workers/scripts/{script_name}/script-settings`
Patch script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Including but not limited to Logpush and Tail Consumers.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptSettingEditParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `ScriptSetting param.Field[ScriptSetting]`
Body param
### Returns
- `type ScriptSetting struct{…}`
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Observability ScriptSettingObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptSettingObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptSettingObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
### Example
```go
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"),
)
scriptSetting, err := client.Workers.Scripts.Settings.Edit(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSettingEditParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
ScriptSetting: workers.ScriptSettingParam{
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scriptSetting.Logpush)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"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
}
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
]
},
"success": true
}
```
# Deployments
## List Deployments
`client.Workers.Scripts.Deployments.List(ctx, scriptName, query) (*ScriptDeploymentListResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/deployments`
List of Worker Deployments. The first deployment in the list is the latest deployment actively serving traffic.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptDeploymentListParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptDeploymentListResponse struct{…}`
- `Deployments []Deployment`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
### Example
```go
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"),
)
deployments, err := client.Workers.Scripts.Deployments.List(
context.TODO(),
"this-is_my_script-01",
workers.ScriptDeploymentListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployments.Deployments)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"deployments": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
}
]
},
"success": true
}
```
## Create Deployment
`client.Workers.Scripts.Deployments.New(ctx, scriptName, params) (*Deployment, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/deployments`
Deployments configure how [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) are deployed to traffic. A deployment can consist of one or two versions of a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptDeploymentNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Deployment param.Field[Deployment]`
Body param
- `Force param.Field[bool]`
Query param: If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed.
### Returns
- `type Deployment struct{…}`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
### Example
```go
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"),
)
deployment, err := client.Workers.Scripts.Deployments.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptDeploymentNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Deployment: workers.DeploymentParam{
Strategy: cloudflare.F(workers.DeploymentStrategyPercentage),
Versions: cloudflare.F([]workers.DeploymentVersionParam{workers.DeploymentVersionParam{
Percentage: cloudflare.F(100.000000),
VersionID: cloudflare.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}}),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployment.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
},
"success": true
}
```
## Get Deployment
`client.Workers.Scripts.Deployments.Get(ctx, scriptName, deploymentID, query) (*Deployment, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}`
Get information about a Worker Deployment.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `deploymentID string`
- `query ScriptDeploymentGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type Deployment struct{…}`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
### Example
```go
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"),
)
deployment, err := client.Workers.Scripts.Deployments.Get(
context.TODO(),
"this-is_my_script-01",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
workers.ScriptDeploymentGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployment.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
},
"success": true
}
```
## Delete Deployment
`client.Workers.Scripts.Deployments.Delete(ctx, scriptName, deploymentID, body) (*ScriptDeploymentDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}`
Delete a Worker Deployment. The latest deployment, which is actively serving traffic, cannot be deleted. All other deployments can be deleted.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `deploymentID string`
- `body ScriptDeploymentDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptDeploymentDeleteResponse struct{…}`
- `Errors []ScriptDeploymentDeleteResponseError`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptDeploymentDeleteResponseErrorsSource`
- `Pointer string`
- `Messages []ScriptDeploymentDeleteResponseMessage`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptDeploymentDeleteResponseMessagesSource`
- `Pointer string`
- `Success ScriptDeploymentDeleteResponseSuccess`
Whether the API call was successful.
- `const ScriptDeploymentDeleteResponseSuccessTrue ScriptDeploymentDeleteResponseSuccess = true`
### Example
```go
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"),
)
deployment, err := client.Workers.Scripts.Deployments.Delete(
context.TODO(),
"this-is_my_script-01",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
workers.ScriptDeploymentDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployment.Errors)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true
}
```
## Domain Types
### Deployment
- `type Deployment struct{…}`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
# Versions
## List Versions
`client.Workers.Scripts.Versions.List(ctx, scriptName, params) (*V4PagePagination[ScriptVersionListResponse], error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/versions`
List of Worker Versions. The first version in the list is the latest version.
### Parameters
- `scriptName string`
Name of the script.
- `params ScriptVersionListParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Deployable param.Field[bool]`
Query param: Only return versions that can be used in a deployment. Ignores pagination.
- `Page param.Field[int64]`
Query param: Current page.
- `PerPage param.Field[int64]`
Query param: Items per-page.
### Returns
- `type ScriptVersionListResponse struct{…}`
- `ID string`
Unique identifier for the version.
- `Metadata ScriptVersionListResponseMetadata`
- `AuthorEmail string`
Email of the user who created the version.
- `AuthorID string`
Identifier of the user who created the version.
- `CreatedOn string`
When the version was created.
- `HasPreview bool`
Whether the version can be previewed.
- `ModifiedOn string`
When the version was last modified.
- `Source ScriptVersionListResponseMetadataSource`
The source of the version upload.
- `const ScriptVersionListResponseMetadataSourceUnknown ScriptVersionListResponseMetadataSource = "unknown"`
- `const ScriptVersionListResponseMetadataSourceAPI ScriptVersionListResponseMetadataSource = "api"`
- `const ScriptVersionListResponseMetadataSourceWrangler ScriptVersionListResponseMetadataSource = "wrangler"`
- `const ScriptVersionListResponseMetadataSourceTerraform ScriptVersionListResponseMetadataSource = "terraform"`
- `const ScriptVersionListResponseMetadataSourceDash ScriptVersionListResponseMetadataSource = "dash"`
- `const ScriptVersionListResponseMetadataSourceDashTemplate ScriptVersionListResponseMetadataSource = "dash_template"`
- `const ScriptVersionListResponseMetadataSourceIntegration ScriptVersionListResponseMetadataSource = "integration"`
- `const ScriptVersionListResponseMetadataSourceQuickEditor ScriptVersionListResponseMetadataSource = "quick_editor"`
- `const ScriptVersionListResponseMetadataSourcePlayground ScriptVersionListResponseMetadataSource = "playground"`
- `const ScriptVersionListResponseMetadataSourceWorkersci ScriptVersionListResponseMetadataSource = "workersci"`
- `Number float64`
Sequential version number.
### Example
```go
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"),
)
page, err := client.Workers.Scripts.Versions.List(
context.TODO(),
"this-is_my_script-01",
workers.ScriptVersionListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"items": [
{
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1
}
]
},
"success": true
}
```
## Get Version Detail
`client.Workers.Scripts.Versions.Get(ctx, scriptName, versionID, query) (*ScriptVersionGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}`
Retrieves detailed information about a specific version of a Workers script.
### Parameters
- `scriptName string`
Name of the script.
- `versionID string`
- `query ScriptVersionGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptVersionGetResponse struct{…}`
- `Resources ScriptVersionGetResponseResources`
- `Bindings []ScriptVersionGetResponseResourcesBinding`
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 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAITypeAI ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearch 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 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchTypeAISearch ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespace 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 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssetsTypeAssets ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowserTypeBrowser ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1TypeD1 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlob 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.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInheritTypeInherit ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImagesTypeImages ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJsonTypeJson ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMediaTypeMedia ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainTextTypePlainText ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelinesTypePipelines ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueueTypeQueue ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretTextTypeSecretText ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindServiceTypeService ScriptVersionGetResponseResourcesBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlob 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.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorizeTypeVectorize ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecret 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 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatRaw ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatSpki ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatJwk ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageSign ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageVerify ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModule 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.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `Script ScriptVersionGetResponseResourcesScript`
- `Etag string`
Hashed script content
- `Handlers []string`
The names of handlers exported as part of the default export.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `NamedHandlers []ScriptVersionGetResponseResourcesScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the exported class or entrypoint.
- `ScriptRuntime ScriptVersionGetResponseResourcesScriptRuntime`
Runtime configuration for the Worker.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime.
- `Limits ScriptVersionGetResponseResourcesScriptRuntimeLimits`
Resource limits for the Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `UsageModel ScriptVersionGetResponseResourcesScriptRuntimeUsageModel`
Usage model for the Worker invocations.
- `const ScriptVersionGetResponseResourcesScriptRuntimeUsageModelBundled ScriptVersionGetResponseResourcesScriptRuntimeUsageModel = "bundled"`
- `const ScriptVersionGetResponseResourcesScriptRuntimeUsageModelUnbound ScriptVersionGetResponseResourcesScriptRuntimeUsageModel = "unbound"`
- `const ScriptVersionGetResponseResourcesScriptRuntimeUsageModelStandard ScriptVersionGetResponseResourcesScriptRuntimeUsageModel = "standard"`
- `ID string`
Unique identifier for the version.
- `Metadata ScriptVersionGetResponseMetadata`
- `AuthorEmail string`
Email of the user who created the version.
- `AuthorID string`
Identifier of the user who created the version.
- `CreatedOn string`
When the version was created.
- `HasPreview bool`
Whether the version can be previewed.
- `ModifiedOn string`
When the version was last modified.
- `Source ScriptVersionGetResponseMetadataSource`
The source of the version upload.
- `const ScriptVersionGetResponseMetadataSourceUnknown ScriptVersionGetResponseMetadataSource = "unknown"`
- `const ScriptVersionGetResponseMetadataSourceAPI ScriptVersionGetResponseMetadataSource = "api"`
- `const ScriptVersionGetResponseMetadataSourceWrangler ScriptVersionGetResponseMetadataSource = "wrangler"`
- `const ScriptVersionGetResponseMetadataSourceTerraform ScriptVersionGetResponseMetadataSource = "terraform"`
- `const ScriptVersionGetResponseMetadataSourceDash ScriptVersionGetResponseMetadataSource = "dash"`
- `const ScriptVersionGetResponseMetadataSourceDashTemplate ScriptVersionGetResponseMetadataSource = "dash_template"`
- `const ScriptVersionGetResponseMetadataSourceIntegration ScriptVersionGetResponseMetadataSource = "integration"`
- `const ScriptVersionGetResponseMetadataSourceQuickEditor ScriptVersionGetResponseMetadataSource = "quick_editor"`
- `const ScriptVersionGetResponseMetadataSourcePlayground ScriptVersionGetResponseMetadataSource = "playground"`
- `const ScriptVersionGetResponseMetadataSourceWorkersci ScriptVersionGetResponseMetadataSource = "workersci"`
- `Number float64`
Sequential version number.
### Example
```go
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"),
)
version, err := client.Workers.Scripts.Versions.Get(
context.TODO(),
"this-is_my_script-01",
"bcf48806-b317-4351-9ee7-36e7d557d4de",
workers.ScriptVersionGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", version.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"resources": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"script": {
"etag": "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794",
"handlers": [
"fetch"
],
"last_deployed_from": "api",
"named_handlers": [
{
"handlers": [
"fetch"
],
"name": "MyClass"
}
]
},
"script_runtime": {
"compatibility_date": "2022-11-08",
"compatibility_flags": [
"x"
],
"limits": {
"cpu_ms": 50
},
"migration_tag": "v1",
"usage_model": "standard"
}
},
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1
},
"success": true
}
```
## Upload Version
`client.Workers.Scripts.Versions.New(ctx, scriptName, params) (*ScriptVersionNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/versions`
Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.
### Parameters
- `scriptName string`
Name of the script.
- `params ScriptVersionNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Metadata param.Field[ScriptVersionNewParamsMetadata]`
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
- `MainModule string`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker, which is required for Version Upload.
- `Annotations ScriptVersionNewParamsMetadataAnnotations`
- `WorkersAlias string`
Associated alias for a version.
- `WorkersMessage string`
Human-readable message about the version. Truncated to 100 bytes.
- `WorkersTag string`
User-provided identifier for the version.
- `Bindings []ScriptVersionNewParamsMetadataBinding`
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 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAITypeAI ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearch 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 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchTypeAISearch ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespace 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 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssetsTypeAssets ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowserTypeBrowser ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1TypeD1 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlob 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.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInheritTypeInherit ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImagesTypeImages ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJsonTypeJson ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMediaTypeMedia ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainTextTypePlainText ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelinesTypePipelines ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueueTypeQueue ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretTextTypeSecretText ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindServiceTypeService ScriptVersionNewParamsMetadataBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlob 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.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorizeTypeVectorize ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecret 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 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatRaw ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatSpki ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatJwk ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageSign ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageVerify ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModule 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.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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`.
- `KeepBindings []string`
List of binding types to keep from previous_upload.
- `UsageModel ScriptVersionNewParamsMetadataUsageModel`
Usage model for the Worker invocations.
- `const ScriptVersionNewParamsMetadataUsageModelStandard ScriptVersionNewParamsMetadataUsageModel = "standard"`
- `const ScriptVersionNewParamsMetadataUsageModelBundled ScriptVersionNewParamsMetadataUsageModel = "bundled"`
- `const ScriptVersionNewParamsMetadataUsageModelUnbound ScriptVersionNewParamsMetadataUsageModel = "unbound"`
- `BindingsInherit param.Field[ScriptVersionNewParamsBindingsInherit]`
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 ScriptVersionNewParamsBindingsInheritStrict ScriptVersionNewParamsBindingsInherit = "strict"`
- `Files param.Field[[]Reader]`
Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
### Returns
- `type ScriptVersionNewResponse struct{…}`
- `Resources ScriptVersionNewResponseResources`
- `Bindings []ScriptVersionNewResponseResourcesBinding`
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 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAITypeAI ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearch 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 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchTypeAISearch ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespace 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 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssetsTypeAssets ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowserTypeBrowser ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1TypeD1 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlob 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.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInheritTypeInherit ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImagesTypeImages ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJsonTypeJson ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMediaTypeMedia ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainTextTypePlainText ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelinesTypePipelines ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueueTypeQueue ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretTextTypeSecretText ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindServiceTypeService ScriptVersionNewResponseResourcesBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlob 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.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorizeTypeVectorize ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecret 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 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatRaw ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatSpki ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatJwk ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageSign ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageVerify ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModule 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.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `Script ScriptVersionNewResponseResourcesScript`
- `Etag string`
Hashed script content
- `Handlers []string`
The names of handlers exported as part of the default export.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `NamedHandlers []ScriptVersionNewResponseResourcesScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the exported class or entrypoint.
- `ScriptRuntime ScriptVersionNewResponseResourcesScriptRuntime`
Runtime configuration for the Worker.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime.
- `Limits ScriptVersionNewResponseResourcesScriptRuntimeLimits`
Resource limits for the Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `UsageModel ScriptVersionNewResponseResourcesScriptRuntimeUsageModel`
Usage model for the Worker invocations.
- `const ScriptVersionNewResponseResourcesScriptRuntimeUsageModelBundled ScriptVersionNewResponseResourcesScriptRuntimeUsageModel = "bundled"`
- `const ScriptVersionNewResponseResourcesScriptRuntimeUsageModelUnbound ScriptVersionNewResponseResourcesScriptRuntimeUsageModel = "unbound"`
- `const ScriptVersionNewResponseResourcesScriptRuntimeUsageModelStandard ScriptVersionNewResponseResourcesScriptRuntimeUsageModel = "standard"`
- `ID string`
Unique identifier for the version.
- `Metadata ScriptVersionNewResponseMetadata`
- `AuthorEmail string`
Email of the user who created the version.
- `AuthorID string`
Identifier of the user who created the version.
- `CreatedOn string`
When the version was created.
- `HasPreview bool`
Whether the version can be previewed.
- `ModifiedOn string`
When the version was last modified.
- `Source ScriptVersionNewResponseMetadataSource`
The source of the version upload.
- `const ScriptVersionNewResponseMetadataSourceUnknown ScriptVersionNewResponseMetadataSource = "unknown"`
- `const ScriptVersionNewResponseMetadataSourceAPI ScriptVersionNewResponseMetadataSource = "api"`
- `const ScriptVersionNewResponseMetadataSourceWrangler ScriptVersionNewResponseMetadataSource = "wrangler"`
- `const ScriptVersionNewResponseMetadataSourceTerraform ScriptVersionNewResponseMetadataSource = "terraform"`
- `const ScriptVersionNewResponseMetadataSourceDash ScriptVersionNewResponseMetadataSource = "dash"`
- `const ScriptVersionNewResponseMetadataSourceDashTemplate ScriptVersionNewResponseMetadataSource = "dash_template"`
- `const ScriptVersionNewResponseMetadataSourceIntegration ScriptVersionNewResponseMetadataSource = "integration"`
- `const ScriptVersionNewResponseMetadataSourceQuickEditor ScriptVersionNewResponseMetadataSource = "quick_editor"`
- `const ScriptVersionNewResponseMetadataSourcePlayground ScriptVersionNewResponseMetadataSource = "playground"`
- `const ScriptVersionNewResponseMetadataSourceWorkersci ScriptVersionNewResponseMetadataSource = "workersci"`
- `Number float64`
Sequential version number.
- `StartupTimeMs int64`
Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time).
### Example
```go
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"),
)
version, err := client.Workers.Scripts.Versions.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptVersionNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Metadata: cloudflare.F(workers.ScriptVersionNewParamsMetadata{
MainModule: cloudflare.F("worker.js"),
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", version.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"resources": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"script": {
"etag": "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794",
"handlers": [
"fetch"
],
"last_deployed_from": "api",
"named_handlers": [
{
"handlers": [
"fetch"
],
"name": "MyClass"
}
]
},
"script_runtime": {
"compatibility_date": "2022-11-08",
"compatibility_flags": [
"x"
],
"limits": {
"cpu_ms": 50
},
"migration_tag": "v1",
"usage_model": "standard"
}
},
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1,
"startup_time_ms": 10
},
"success": true
}
```
# Secrets
## List script secrets
`client.Workers.Scripts.Secrets.List(ctx, scriptName, query) (*SinglePage[ScriptSecretListResponse], error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/secrets`
List secrets bound to a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptSecretListParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSecretListResponse interface{…}`
A secret value accessible through a binding.
- `type ScriptSecretListResponseWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptSecretListResponseWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptSecretListResponseWorkersBindingKindSecretTextTypeSecretText ScriptSecretListResponseWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptSecretListResponseWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptSecretListResponseWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatRaw ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatPkcs8 ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatSpki ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatJwk ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptSecretListResponseWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyTypeSecretKey ScriptSecretListResponseWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptSecretListResponseWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageEncrypt ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageDecrypt ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageSign ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageVerify ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageDeriveKey ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageDeriveBits ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageWrapKey ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageUnwrapKey ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```go
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"),
)
page, err := client.Workers.Scripts.Secrets.List(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSecretListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": [
{
"name": "myBinding",
"type": "secret_text"
}
]
}
```
## Get secret binding
`client.Workers.Scripts.Secrets.Get(ctx, scriptName, secretName, params) (*ScriptSecretGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}`
Get a given secret binding (value omitted) on a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `secretName string`
A JavaScript variable name for the secret binding.
- `params ScriptSecretGetParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `URLEncoded param.Field[bool]`
Query param: Flag that indicates whether the secret name is URL encoded.
### Returns
- `type ScriptSecretGetResponse interface{…}`
A secret value accessible through a binding.
- `type ScriptSecretGetResponseWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptSecretGetResponseWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptSecretGetResponseWorkersBindingKindSecretTextTypeSecretText ScriptSecretGetResponseWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptSecretGetResponseWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatRaw ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatPkcs8 ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatSpki ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatJwk ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptSecretGetResponseWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyTypeSecretKey ScriptSecretGetResponseWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageEncrypt ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDecrypt ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageSign ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageVerify ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDeriveKey ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDeriveBits ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageWrapKey ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageUnwrapKey ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```go
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"),
)
secret, err := client.Workers.Scripts.Secrets.Get(
context.TODO(),
"this-is_my_script-01",
"mySecret",
workers.ScriptSecretGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"name": "myBinding",
"type": "secret_text"
}
}
```
## Add script secret
`client.Workers.Scripts.Secrets.Update(ctx, scriptName, params) (*ScriptSecretUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/secrets`
Add a secret to a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptSecretUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Name param.Field[string]`
Body param: A JavaScript variable name for the binding.
- `Text param.Field[string]`
Body param: The secret value to use.
- `Type param.Field[ScriptSecretUpdateParamsWorkersBindingKindSecretTextType]`
Body param: The kind of resource that the binding provides.
- `const ScriptSecretUpdateParamsWorkersBindingKindSecretTextTypeSecretText ScriptSecretUpdateParamsWorkersBindingKindSecretTextType = "secret_text"`
### Returns
- `type ScriptSecretUpdateResponse interface{…}`
A secret value accessible through a binding.
- `type ScriptSecretUpdateResponseWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptSecretUpdateResponseWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretTextTypeSecretText ScriptSecretUpdateResponseWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptSecretUpdateResponseWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatRaw ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatPkcs8 ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatSpki ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatJwk ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptSecretUpdateResponseWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyTypeSecretKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageEncrypt ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDecrypt ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageSign ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageVerify ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDeriveKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDeriveBits ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageWrapKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageUnwrapKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```go
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"),
)
secret, err := client.Workers.Scripts.Secrets.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSecretUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: workers.ScriptSecretUpdateParamsBodyWorkersBindingKindSecretText{
Name: cloudflare.F("myBinding"),
Text: cloudflare.F("My secret."),
Type: cloudflare.F(workers.ScriptSecretUpdateParamsBodyWorkersBindingKindSecretTextTypeSecretText),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"name": "myBinding",
"type": "secret_text"
}
}
```
## Delete script secret
`client.Workers.Scripts.Secrets.Delete(ctx, scriptName, secretName, params) (*ScriptSecretDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}`
Remove a secret from a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `secretName string`
A JavaScript variable name for the secret binding.
- `params ScriptSecretDeleteParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `URLEncoded param.Field[bool]`
Query param: Flag that indicates whether the secret name is URL encoded.
### Returns
- `type ScriptSecretDeleteResponse interface{…}`
### Example
```go
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"),
)
secret, err := client.Workers.Scripts.Secrets.Delete(
context.TODO(),
"this-is_my_script-01",
"mySecret",
workers.ScriptSecretDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {}
}
```
# Script And Version Settings
## Get Settings
`client.Workers.Scripts.ScriptAndVersionSettings.Get(ctx, scriptName, query) (*ScriptScriptAndVersionSettingGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/settings`
Get metadata and config, such as bindings or usage model.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptScriptAndVersionSettingGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptScriptAndVersionSettingGetResponse struct{…}`
- `Annotations ScriptScriptAndVersionSettingGetResponseAnnotations`
Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `Bindings []ScriptScriptAndVersionSettingGetResponseBinding`
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 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAITypeAI ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearch 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 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchTypeAISearch ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespace 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 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssetsTypeAssets ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowserTypeBrowser ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1TypeD1 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlob 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.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInheritTypeInherit ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImagesTypeImages ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJsonTypeJson ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMediaTypeMedia ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainTextTypePlainText ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelinesTypePipelines ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueueTypeQueue ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretTextTypeSecretText ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindServiceTypeService ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlob 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.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorizeTypeVectorize ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecret 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 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatRaw ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatSpki ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatJwk ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageSign ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageVerify ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModule 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.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 ScriptScriptAndVersionSettingGetResponseLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Migrations ScriptScriptAndVersionSettingGetResponseMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptScriptAndVersionSettingGetResponseMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptScriptAndVersionSettingGetResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptScriptAndVersionSettingGetResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptScriptAndVersionSettingGetResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptScriptAndVersionSettingGetResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptScriptAndVersionSettingGetResponsePlacementMode struct{…}`
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementModeMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptScriptAndVersionSettingGetResponsePlacementModeModeSmart ScriptScriptAndVersionSettingGetResponsePlacementModeMode = "smart"`
- `type ScriptScriptAndVersionSettingGetResponsePlacementRegion struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingGetResponsePlacementHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingGetResponsePlacementHost struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `Target []ScriptScriptAndVersionSettingGetResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptScriptAndVersionSettingGetResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptScriptAndVersionSettingGetResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptScriptAndVersionSettingGetResponseUsageModelStandard ScriptScriptAndVersionSettingGetResponseUsageModel = "standard"`
- `const ScriptScriptAndVersionSettingGetResponseUsageModelBundled ScriptScriptAndVersionSettingGetResponseUsageModel = "bundled"`
- `const ScriptScriptAndVersionSettingGetResponseUsageModelUnbound ScriptScriptAndVersionSettingGetResponseUsageModel = "unbound"`
### Example
```go
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"),
)
scriptAndVersionSetting, err := client.Workers.Scripts.ScriptAndVersionSettings.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScriptAndVersionSettingGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scriptAndVersionSetting.Annotations)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## 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.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptScriptAndVersionSettingEditParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Settings param.Field[ScriptScriptAndVersionSettingEditParamsSettings]`
Body param
- `Annotations ScriptScriptAndVersionSettingEditParamsSettingsAnnotations`
Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `Bindings []ScriptScriptAndVersionSettingEditParamsSettingsBinding`
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 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAITypeAI ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAIType = "ai"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchTypeAISearch ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsTypeAssets ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserTypeBrowser ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1 struct{…}`
- `ID 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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1TypeD1 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1Type = "d1"`
- `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.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritTypeInherit ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesTypeImages ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesType = "images"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJsonTypeJson ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaTypeMedia ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaType = "media"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextTypePlainText ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesTypePipelines ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueueTypeQueue ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueueType = "queue"`
- `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.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextTypeSecretText ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindServiceTypeService ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
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.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeTypeVectorize ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `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 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
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.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `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.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 ScriptScriptAndVersionSettingEditParamsSettingsLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Migrations ScriptScriptAndVersionSettingEditParamsSettingsMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptScriptAndVersionSettingEditParamsSettingsMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptScriptAndVersionSettingEditParamsSettingsObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptScriptAndVersionSettingEditParamsSettingsObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptScriptAndVersionSettingEditParamsSettingsObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptScriptAndVersionSettingEditParamsSettingsPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementMode struct{…}`
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementModeMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementModeModeSmart ScriptScriptAndVersionSettingEditParamsSettingsPlacementModeMode = "smart"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementRegion struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementHost struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `Target []ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptScriptAndVersionSettingEditParamsSettingsUsageModel`
Usage model for the Worker invocations.
- `const ScriptScriptAndVersionSettingEditParamsSettingsUsageModelStandard ScriptScriptAndVersionSettingEditParamsSettingsUsageModel = "standard"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsUsageModelBundled ScriptScriptAndVersionSettingEditParamsSettingsUsageModel = "bundled"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsUsageModelUnbound ScriptScriptAndVersionSettingEditParamsSettingsUsageModel = "unbound"`
### Returns
- `type ScriptScriptAndVersionSettingEditResponse struct{…}`
- `Annotations ScriptScriptAndVersionSettingEditResponseAnnotations`
Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `Bindings []ScriptScriptAndVersionSettingEditResponseBinding`
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 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAITypeAI ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearch 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 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchTypeAISearch ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespace 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 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssetsTypeAssets ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowserTypeBrowser ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1TypeD1 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlob 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.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInheritTypeInherit ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImagesTypeImages ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJsonTypeJson ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMediaTypeMedia ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainTextTypePlainText ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelinesTypePipelines ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueueTypeQueue ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretTextTypeSecretText ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindServiceTypeService ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlob 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.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorizeTypeVectorize ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecret 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 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatRaw ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatSpki ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatJwk ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageSign ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageVerify ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModule 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.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
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 ScriptScriptAndVersionSettingEditResponseLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Migrations ScriptScriptAndVersionSettingEditResponseMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptScriptAndVersionSettingEditResponseMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptScriptAndVersionSettingEditResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptScriptAndVersionSettingEditResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptScriptAndVersionSettingEditResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptScriptAndVersionSettingEditResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptScriptAndVersionSettingEditResponsePlacementMode struct{…}`
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementModeMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptScriptAndVersionSettingEditResponsePlacementModeModeSmart ScriptScriptAndVersionSettingEditResponsePlacementModeMode = "smart"`
- `type ScriptScriptAndVersionSettingEditResponsePlacementRegion struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditResponsePlacementHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditResponsePlacementHost struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `Target []ScriptScriptAndVersionSettingEditResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptScriptAndVersionSettingEditResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptScriptAndVersionSettingEditResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptScriptAndVersionSettingEditResponseUsageModelStandard ScriptScriptAndVersionSettingEditResponseUsageModel = "standard"`
- `const ScriptScriptAndVersionSettingEditResponseUsageModelBundled ScriptScriptAndVersionSettingEditResponseUsageModel = "bundled"`
- `const ScriptScriptAndVersionSettingEditResponseUsageModelUnbound ScriptScriptAndVersionSettingEditResponseUsageModel = "unbound"`
### Example
```go
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"),
)
response, err := client.Workers.Scripts.ScriptAndVersionSettings.Edit(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScriptAndVersionSettingEditParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Annotations)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```