# Beta # Workers ## List Workers `client.Workers.Beta.Workers.List(ctx, params) (*V4PagePaginationArray[Worker], error)` **get** `/accounts/{account_id}/workers/workers` List all Workers for an account. ### Parameters - `params BetaWorkerListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Order param.Field[BetaWorkerListParamsOrder]` Query param: Sort direction. - `const BetaWorkerListParamsOrderAsc BetaWorkerListParamsOrder = "asc"` - `const BetaWorkerListParamsOrderDesc BetaWorkerListParamsOrder = "desc"` - `OrderBy param.Field[BetaWorkerListParamsOrderBy]` Query param: Property to sort results by. - `const BetaWorkerListParamsOrderByDeployedOn BetaWorkerListParamsOrderBy = "deployed_on"` - `const BetaWorkerListParamsOrderByUpdatedOn BetaWorkerListParamsOrderBy = "updated_on"` - `const BetaWorkerListParamsOrderByCreatedOn BetaWorkerListParamsOrderBy = "created_on"` - `const BetaWorkerListParamsOrderByName BetaWorkerListParamsOrderBy = "name"` - `Page param.Field[int64]` Query param: Current page. - `PerPage param.Field[int64]` Query param: Items per-page. ### Returns - `type Worker struct{…}` - `ID string` Immutable ID of the Worker. - `CreatedOn Time` When the Worker was created. - `Logpush bool` Whether logpush is enabled for the Worker. - `Name string` Name of the Worker. - `Observability WorkerObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `Logs WorkerObservabilityLogs` Log settings for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `Enabled bool` Whether logs are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces WorkerObservabilityTraces` 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%). - `Persist bool` Whether trace persistence is enabled for the Worker. - `References WorkerReferences` Other resources that reference the Worker and depend on it existing. - `DispatchNamespaceOutbounds []WorkerReferencesDispatchNamespaceOutbound` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `NamespaceID string` ID of the dispatch namespace. - `NamespaceName string` Name of the dispatch namespace. - `WorkerID string` ID of the Worker using the dispatch namespace. - `WorkerName string` Name of the Worker using the dispatch namespace. - `Domains []WorkerReferencesDomain` Custom domains connected to the Worker. - `ID string` ID of the custom domain. - `CertificateID string` ID of the TLS certificate issued for the custom domain. - `Hostname string` Full hostname of the custom domain, including the zone name. - `ZoneID string` ID of the zone. - `ZoneName string` Name of the zone. - `DurableObjects []WorkerReferencesDurableObject` Other Workers that reference Durable Object classes implemented by the Worker. - `NamespaceID string` ID of the Durable Object namespace being used. - `NamespaceName string` Name of the Durable Object namespace being used. - `WorkerID string` ID of the Worker using the Durable Object implementation. - `WorkerName string` Name of the Worker using the Durable Object implementation. - `Queues []WorkerReferencesQueue` Queues that send messages to the Worker. - `QueueConsumerID string` ID of the queue consumer configuration. - `QueueID string` ID of the queue. - `QueueName string` Name of the queue. - `Workers []WorkerReferencesWorker` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `ID string` ID of the referencing Worker. - `Name string` Name of the referencing Worker. - `Subdomain WorkerSubdomain` Subdomain settings for the Worker. - `Enabled bool` Whether the *.workers.dev subdomain is enabled for the Worker. - `PreviewsEnabled bool` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `Tags []string` Tags associated with the Worker. - `TailConsumers []WorkerTailConsumer` Other Workers that should consume logs from the Worker. - `Name string` Name of the consumer Worker. - `UpdatedOn Time` When the Worker was most recently updated. - `DeployedOn Time` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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.Beta.Workers.List(context.TODO(), workers.BetaWorkerListParams{ 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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get Worker `client.Workers.Beta.Workers.Get(ctx, workerID, query) (*Worker, error)` **get** `/accounts/{account_id}/workers/workers/{worker_id}` Get details about a specific Worker. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `query BetaWorkerGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Worker struct{…}` - `ID string` Immutable ID of the Worker. - `CreatedOn Time` When the Worker was created. - `Logpush bool` Whether logpush is enabled for the Worker. - `Name string` Name of the Worker. - `Observability WorkerObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `Logs WorkerObservabilityLogs` Log settings for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `Enabled bool` Whether logs are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces WorkerObservabilityTraces` 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%). - `Persist bool` Whether trace persistence is enabled for the Worker. - `References WorkerReferences` Other resources that reference the Worker and depend on it existing. - `DispatchNamespaceOutbounds []WorkerReferencesDispatchNamespaceOutbound` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `NamespaceID string` ID of the dispatch namespace. - `NamespaceName string` Name of the dispatch namespace. - `WorkerID string` ID of the Worker using the dispatch namespace. - `WorkerName string` Name of the Worker using the dispatch namespace. - `Domains []WorkerReferencesDomain` Custom domains connected to the Worker. - `ID string` ID of the custom domain. - `CertificateID string` ID of the TLS certificate issued for the custom domain. - `Hostname string` Full hostname of the custom domain, including the zone name. - `ZoneID string` ID of the zone. - `ZoneName string` Name of the zone. - `DurableObjects []WorkerReferencesDurableObject` Other Workers that reference Durable Object classes implemented by the Worker. - `NamespaceID string` ID of the Durable Object namespace being used. - `NamespaceName string` Name of the Durable Object namespace being used. - `WorkerID string` ID of the Worker using the Durable Object implementation. - `WorkerName string` Name of the Worker using the Durable Object implementation. - `Queues []WorkerReferencesQueue` Queues that send messages to the Worker. - `QueueConsumerID string` ID of the queue consumer configuration. - `QueueID string` ID of the queue. - `QueueName string` Name of the queue. - `Workers []WorkerReferencesWorker` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `ID string` ID of the referencing Worker. - `Name string` Name of the referencing Worker. - `Subdomain WorkerSubdomain` Subdomain settings for the Worker. - `Enabled bool` Whether the *.workers.dev subdomain is enabled for the Worker. - `PreviewsEnabled bool` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `Tags []string` Tags associated with the Worker. - `TailConsumers []WorkerTailConsumer` Other Workers that should consume logs from the Worker. - `Name string` Name of the consumer Worker. - `UpdatedOn Time` When the Worker was most recently updated. - `DeployedOn Time` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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"), ) worker, err := client.Workers.Beta.Workers.Get( context.TODO(), "worker_id", workers.BetaWorkerGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Create Worker `client.Workers.Beta.Workers.New(ctx, params) (*Worker, error)` **post** `/accounts/{account_id}/workers/workers` Create a new Worker. ### Parameters - `params BetaWorkerNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Worker param.Field[Worker]` Body param ### Returns - `type Worker struct{…}` - `ID string` Immutable ID of the Worker. - `CreatedOn Time` When the Worker was created. - `Logpush bool` Whether logpush is enabled for the Worker. - `Name string` Name of the Worker. - `Observability WorkerObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `Logs WorkerObservabilityLogs` Log settings for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `Enabled bool` Whether logs are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces WorkerObservabilityTraces` 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%). - `Persist bool` Whether trace persistence is enabled for the Worker. - `References WorkerReferences` Other resources that reference the Worker and depend on it existing. - `DispatchNamespaceOutbounds []WorkerReferencesDispatchNamespaceOutbound` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `NamespaceID string` ID of the dispatch namespace. - `NamespaceName string` Name of the dispatch namespace. - `WorkerID string` ID of the Worker using the dispatch namespace. - `WorkerName string` Name of the Worker using the dispatch namespace. - `Domains []WorkerReferencesDomain` Custom domains connected to the Worker. - `ID string` ID of the custom domain. - `CertificateID string` ID of the TLS certificate issued for the custom domain. - `Hostname string` Full hostname of the custom domain, including the zone name. - `ZoneID string` ID of the zone. - `ZoneName string` Name of the zone. - `DurableObjects []WorkerReferencesDurableObject` Other Workers that reference Durable Object classes implemented by the Worker. - `NamespaceID string` ID of the Durable Object namespace being used. - `NamespaceName string` Name of the Durable Object namespace being used. - `WorkerID string` ID of the Worker using the Durable Object implementation. - `WorkerName string` Name of the Worker using the Durable Object implementation. - `Queues []WorkerReferencesQueue` Queues that send messages to the Worker. - `QueueConsumerID string` ID of the queue consumer configuration. - `QueueID string` ID of the queue. - `QueueName string` Name of the queue. - `Workers []WorkerReferencesWorker` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `ID string` ID of the referencing Worker. - `Name string` Name of the referencing Worker. - `Subdomain WorkerSubdomain` Subdomain settings for the Worker. - `Enabled bool` Whether the *.workers.dev subdomain is enabled for the Worker. - `PreviewsEnabled bool` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `Tags []string` Tags associated with the Worker. - `TailConsumers []WorkerTailConsumer` Other Workers that should consume logs from the Worker. - `Name string` Name of the consumer Worker. - `UpdatedOn Time` When the Worker was most recently updated. - `DeployedOn Time` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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"), ) worker, err := client.Workers.Beta.Workers.New(context.TODO(), workers.BetaWorkerNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Worker: workers.WorkerParam{ Logpush: cloudflare.F(true), Name: cloudflare.F("my-worker"), Observability: cloudflare.F(workers.WorkerObservabilityParam{ }), Subdomain: cloudflare.F(workers.WorkerSubdomainParam{ }), Tags: cloudflare.F([]string{"my-team", "my-public-api"}), TailConsumers: cloudflare.F([]workers.WorkerTailConsumerParam{workers.WorkerTailConsumerParam{ Name: cloudflare.F("my-tail-consumer"), }}), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Update Worker `client.Workers.Beta.Workers.Update(ctx, workerID, params) (*Worker, error)` **put** `/accounts/{account_id}/workers/workers/{worker_id}` Perform a complete replacement of a Worker, where omitted properties are set to their default values. This is the exact same as the Create Worker endpoint, but operates on an existing Worker. To perform a partial update instead, use the Edit Worker endpoint. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `params BetaWorkerUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `Worker param.Field[Worker]` Body param ### Returns - `type Worker struct{…}` - `ID string` Immutable ID of the Worker. - `CreatedOn Time` When the Worker was created. - `Logpush bool` Whether logpush is enabled for the Worker. - `Name string` Name of the Worker. - `Observability WorkerObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `Logs WorkerObservabilityLogs` Log settings for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `Enabled bool` Whether logs are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces WorkerObservabilityTraces` 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%). - `Persist bool` Whether trace persistence is enabled for the Worker. - `References WorkerReferences` Other resources that reference the Worker and depend on it existing. - `DispatchNamespaceOutbounds []WorkerReferencesDispatchNamespaceOutbound` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `NamespaceID string` ID of the dispatch namespace. - `NamespaceName string` Name of the dispatch namespace. - `WorkerID string` ID of the Worker using the dispatch namespace. - `WorkerName string` Name of the Worker using the dispatch namespace. - `Domains []WorkerReferencesDomain` Custom domains connected to the Worker. - `ID string` ID of the custom domain. - `CertificateID string` ID of the TLS certificate issued for the custom domain. - `Hostname string` Full hostname of the custom domain, including the zone name. - `ZoneID string` ID of the zone. - `ZoneName string` Name of the zone. - `DurableObjects []WorkerReferencesDurableObject` Other Workers that reference Durable Object classes implemented by the Worker. - `NamespaceID string` ID of the Durable Object namespace being used. - `NamespaceName string` Name of the Durable Object namespace being used. - `WorkerID string` ID of the Worker using the Durable Object implementation. - `WorkerName string` Name of the Worker using the Durable Object implementation. - `Queues []WorkerReferencesQueue` Queues that send messages to the Worker. - `QueueConsumerID string` ID of the queue consumer configuration. - `QueueID string` ID of the queue. - `QueueName string` Name of the queue. - `Workers []WorkerReferencesWorker` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `ID string` ID of the referencing Worker. - `Name string` Name of the referencing Worker. - `Subdomain WorkerSubdomain` Subdomain settings for the Worker. - `Enabled bool` Whether the *.workers.dev subdomain is enabled for the Worker. - `PreviewsEnabled bool` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `Tags []string` Tags associated with the Worker. - `TailConsumers []WorkerTailConsumer` Other Workers that should consume logs from the Worker. - `Name string` Name of the consumer Worker. - `UpdatedOn Time` When the Worker was most recently updated. - `DeployedOn Time` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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"), ) worker, err := client.Workers.Beta.Workers.Update( context.TODO(), "worker_id", workers.BetaWorkerUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Worker: workers.WorkerParam{ Logpush: cloudflare.F(true), Name: cloudflare.F("my-worker"), Observability: cloudflare.F(workers.WorkerObservabilityParam{ }), Subdomain: cloudflare.F(workers.WorkerSubdomainParam{ }), Tags: cloudflare.F([]string{"my-team", "my-public-api"}), TailConsumers: cloudflare.F([]workers.WorkerTailConsumerParam{workers.WorkerTailConsumerParam{ Name: cloudflare.F("my-tail-consumer"), }}), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Edit Worker `client.Workers.Beta.Workers.Edit(ctx, workerID, params) (*Worker, error)` **patch** `/accounts/{account_id}/workers/workers/{worker_id}` Perform a partial update on a Worker, where omitted properties are left unchanged from their current values. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `params BetaWorkerEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `Worker param.Field[Worker]` Body param ### Returns - `type Worker struct{…}` - `ID string` Immutable ID of the Worker. - `CreatedOn Time` When the Worker was created. - `Logpush bool` Whether logpush is enabled for the Worker. - `Name string` Name of the Worker. - `Observability WorkerObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `Logs WorkerObservabilityLogs` Log settings for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `Enabled bool` Whether logs are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces WorkerObservabilityTraces` 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%). - `Persist bool` Whether trace persistence is enabled for the Worker. - `References WorkerReferences` Other resources that reference the Worker and depend on it existing. - `DispatchNamespaceOutbounds []WorkerReferencesDispatchNamespaceOutbound` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `NamespaceID string` ID of the dispatch namespace. - `NamespaceName string` Name of the dispatch namespace. - `WorkerID string` ID of the Worker using the dispatch namespace. - `WorkerName string` Name of the Worker using the dispatch namespace. - `Domains []WorkerReferencesDomain` Custom domains connected to the Worker. - `ID string` ID of the custom domain. - `CertificateID string` ID of the TLS certificate issued for the custom domain. - `Hostname string` Full hostname of the custom domain, including the zone name. - `ZoneID string` ID of the zone. - `ZoneName string` Name of the zone. - `DurableObjects []WorkerReferencesDurableObject` Other Workers that reference Durable Object classes implemented by the Worker. - `NamespaceID string` ID of the Durable Object namespace being used. - `NamespaceName string` Name of the Durable Object namespace being used. - `WorkerID string` ID of the Worker using the Durable Object implementation. - `WorkerName string` Name of the Worker using the Durable Object implementation. - `Queues []WorkerReferencesQueue` Queues that send messages to the Worker. - `QueueConsumerID string` ID of the queue consumer configuration. - `QueueID string` ID of the queue. - `QueueName string` Name of the queue. - `Workers []WorkerReferencesWorker` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `ID string` ID of the referencing Worker. - `Name string` Name of the referencing Worker. - `Subdomain WorkerSubdomain` Subdomain settings for the Worker. - `Enabled bool` Whether the *.workers.dev subdomain is enabled for the Worker. - `PreviewsEnabled bool` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `Tags []string` Tags associated with the Worker. - `TailConsumers []WorkerTailConsumer` Other Workers that should consume logs from the Worker. - `Name string` Name of the consumer Worker. - `UpdatedOn Time` When the Worker was most recently updated. - `DeployedOn Time` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. ### 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"), ) worker, err := client.Workers.Beta.Workers.Edit( context.TODO(), "worker_id", workers.BetaWorkerEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Worker: workers.WorkerParam{ Logpush: cloudflare.F(true), Name: cloudflare.F("my-worker"), Observability: cloudflare.F(workers.WorkerObservabilityParam{ }), Subdomain: cloudflare.F(workers.WorkerSubdomainParam{ }), Tags: cloudflare.F([]string{"my-team", "my-public-api"}), TailConsumers: cloudflare.F([]workers.WorkerTailConsumerParam{workers.WorkerTailConsumerParam{ Name: cloudflare.F("my-tail-consumer"), }}), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", worker.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": "e8f70fdbc8b1fb0b8ddb1af166186758", "created_on": "2019-12-27T18:11:19.117Z", "logpush": true, "name": "my-worker", "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true }, "traces": { "destinations": [ "string" ], "enabled": true, "head_sampling_rate": 1, "persist": true } }, "references": { "dispatch_namespace_outbounds": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-dispatch-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "domains": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "certificate_id": "certificate_id", "hostname": "my-worker.example.com", "zone_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "zone_name": "example.com" } ], "durable_objects": [ { "namespace_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "namespace_name": "my-durable-object-namespace", "worker_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "worker_name": "my-worker" } ], "queues": [ { "queue_consumer_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_id": "e8f70fdbc8b1fb0b8ddb1af166186758", "queue_name": "my-queue" } ], "workers": [ { "id": "e8f70fdbc8b1fb0b8ddb1af166186758", "name": "my-worker" } ] }, "subdomain": { "enabled": true, "previews_enabled": true }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "name": "my-tail-consumer" } ], "updated_on": "2019-12-27T18:11:19.117Z", "deployed_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Delete Worker `client.Workers.Beta.Workers.Delete(ctx, workerID, body) (*BetaWorkerDeleteResponse, error)` **delete** `/accounts/{account_id}/workers/workers/{worker_id}` Delete a Worker and all its associated resources (versions, deployments, etc.). ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `body BetaWorkerDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type BetaWorkerDeleteResponse struct{…}` - `Errors []BetaWorkerDeleteResponseError` - `Code int64` - `Message string` - `DocumentationURL string` - `Source BetaWorkerDeleteResponseErrorsSource` - `Pointer string` - `Messages []BetaWorkerDeleteResponseMessage` - `Code int64` - `Message string` - `DocumentationURL string` - `Source BetaWorkerDeleteResponseMessagesSource` - `Pointer string` - `Success BetaWorkerDeleteResponseSuccess` Whether the API call was successful. - `const BetaWorkerDeleteResponseSuccessTrue BetaWorkerDeleteResponseSuccess = 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"), ) worker, err := client.Workers.Beta.Workers.Delete( context.TODO(), "worker_id", workers.BetaWorkerDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", worker.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 ### Worker - `type Worker struct{…}` - `ID string` Immutable ID of the Worker. - `CreatedOn Time` When the Worker was created. - `Logpush bool` Whether logpush is enabled for the Worker. - `Name string` Name of the Worker. - `Observability WorkerObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%). - `Logs WorkerObservabilityLogs` Log settings for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `Enabled bool` Whether logs are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces WorkerObservabilityTraces` 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%). - `Persist bool` Whether trace persistence is enabled for the Worker. - `References WorkerReferences` Other resources that reference the Worker and depend on it existing. - `DispatchNamespaceOutbounds []WorkerReferencesDispatchNamespaceOutbound` Other Workers that reference the Worker as an outbound for a dispatch namespace. - `NamespaceID string` ID of the dispatch namespace. - `NamespaceName string` Name of the dispatch namespace. - `WorkerID string` ID of the Worker using the dispatch namespace. - `WorkerName string` Name of the Worker using the dispatch namespace. - `Domains []WorkerReferencesDomain` Custom domains connected to the Worker. - `ID string` ID of the custom domain. - `CertificateID string` ID of the TLS certificate issued for the custom domain. - `Hostname string` Full hostname of the custom domain, including the zone name. - `ZoneID string` ID of the zone. - `ZoneName string` Name of the zone. - `DurableObjects []WorkerReferencesDurableObject` Other Workers that reference Durable Object classes implemented by the Worker. - `NamespaceID string` ID of the Durable Object namespace being used. - `NamespaceName string` Name of the Durable Object namespace being used. - `WorkerID string` ID of the Worker using the Durable Object implementation. - `WorkerName string` Name of the Worker using the Durable Object implementation. - `Queues []WorkerReferencesQueue` Queues that send messages to the Worker. - `QueueConsumerID string` ID of the queue consumer configuration. - `QueueID string` ID of the queue. - `QueueName string` Name of the queue. - `Workers []WorkerReferencesWorker` Other Workers that reference the Worker using [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). - `ID string` ID of the referencing Worker. - `Name string` Name of the referencing Worker. - `Subdomain WorkerSubdomain` Subdomain settings for the Worker. - `Enabled bool` Whether the *.workers.dev subdomain is enabled for the Worker. - `PreviewsEnabled bool` Whether [preview URLs](https://developers.cloudflare.com/workers/configuration/previews/) are enabled for the Worker. - `Tags []string` Tags associated with the Worker. - `TailConsumers []WorkerTailConsumer` Other Workers that should consume logs from the Worker. - `Name string` Name of the consumer Worker. - `UpdatedOn Time` When the Worker was most recently updated. - `DeployedOn Time` When the Worker's most recent deployment was created. `null` if the Worker has never been deployed. # Versions ## List Versions `client.Workers.Beta.Workers.Versions.List(ctx, workerID, params) (*V4PagePaginationArray[Version], error)` **get** `/accounts/{account_id}/workers/workers/{worker_id}/versions` List all versions for a Worker. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `params BetaWorkerVersionListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Page param.Field[int64]` Query param: Current page. - `PerPage param.Field[int64]` Query param: Items per-page. ### Returns - `type Version struct{…}` - `ID string` Version identifier. - `CreatedOn Time` When the version was created. - `Number int64` The integer version number, starting from one. - `URLs []string` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `Annotations VersionAnnotations` Metadata about the version. - `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. - `Assets VersionAssets` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `Config VersionAssetsConfig` Configuration for assets within a Worker. - `HTMLHandling VersionAssetsConfigHTMLHandling` Determines the redirects and rewrites of requests for HTML content. - `const VersionAssetsConfigHTMLHandlingAutoTrailingSlash VersionAssetsConfigHTMLHandling = "auto-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingForceTrailingSlash VersionAssetsConfigHTMLHandling = "force-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingDropTrailingSlash VersionAssetsConfigHTMLHandling = "drop-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingNone VersionAssetsConfigHTMLHandling = "none"` - `NotFoundHandling VersionAssetsConfigNotFoundHandling` Determines the response when a request does not match a static asset, and there is no Worker script. - `const VersionAssetsConfigNotFoundHandlingNone VersionAssetsConfigNotFoundHandling = "none"` - `const VersionAssetsConfigNotFoundHandling404Page VersionAssetsConfigNotFoundHandling = "404-page"` - `const VersionAssetsConfigNotFoundHandlingSinglePageApplication VersionAssetsConfigNotFoundHandling = "single-page-application"` - `RunWorkerFirst VersionAssetsConfigRunWorkerFirstUnion` 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 VersionAssetsConfigRunWorkerFirstArray []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` - `JWT string` Token provided upon successful upload of all files from a registered manifest. - `Bindings []VersionBinding` 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 VersionBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAITypeAI VersionBindingsWorkersBindingKindAIType = "ai"` - `type VersionBindingsWorkersBindingKindAISearch 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 VersionBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchTypeAISearch VersionBindingsWorkersBindingKindAISearchType = "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 VersionBindingsWorkersBindingKindAISearchNamespace 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 VersionBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace VersionBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type VersionBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine VersionBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type VersionBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAssetsTypeAssets VersionBindingsWorkersBindingKindAssetsType = "assets"` - `type VersionBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindBrowserTypeBrowser VersionBindingsWorkersBindingKindBrowserType = "browser"` - `type VersionBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindD1TypeD1 VersionBindingsWorkersBindingKindD1Type = "d1"` - `type VersionBindingsWorkersBindingKindDataBlob 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 VersionBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDataBlobTypeDataBlob VersionBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type VersionBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type VersionBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace VersionBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound VersionBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []VersionBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker VersionBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` 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 VersionBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace VersionBindingsWorkersBindingKindDurableObjectNamespaceType = "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 VersionBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindHyperdriveTypeHyperdrive VersionBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type VersionBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type VersionBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindInheritTypeInherit VersionBindingsWorkersBindingKindInheritType = "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 VersionBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindImagesTypeImages VersionBindingsWorkersBindingKindImagesType = "images"` - `type VersionBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindJsonTypeJson VersionBindingsWorkersBindingKindJsonType = "json"` - `type VersionBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type VersionBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindKVNamespaceTypeKVNamespace VersionBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type VersionBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMediaTypeMedia VersionBindingsWorkersBindingKindMediaType = "media"` - `type VersionBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate VersionBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type VersionBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type VersionBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPlainTextTypePlainText VersionBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type VersionBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type VersionBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPipelinesTypePipelines VersionBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type VersionBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type VersionBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindQueueTypeQueue VersionBindingsWorkersBindingKindQueueType = "queue"` - `type VersionBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple VersionBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type VersionBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindRatelimitTypeRatelimit VersionBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type VersionBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindR2BucketTypeR2Bucket VersionBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction VersionBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionEu VersionBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedramp VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type VersionBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type VersionBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretTextTypeSecretText VersionBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type VersionBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSendEmailTypeSendEmail VersionBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type VersionBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type VersionBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindServiceTypeService VersionBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type VersionBindingsWorkersBindingKindTextBlob 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 VersionBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindTextBlobTypeTextBlob VersionBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type VersionBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVectorizeTypeVectorize VersionBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type VersionBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata VersionBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type VersionBindingsWorkersBindingKindSecretsStoreSecret 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 VersionBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret VersionBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type VersionBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format VersionBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const VersionBindingsWorkersBindingKindSecretKeyFormatRaw VersionBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatPkcs8 VersionBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatSpki VersionBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatJwk VersionBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretKeyTypeSecretKey VersionBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []VersionBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const VersionBindingsWorkersBindingKindSecretKeyUsageEncrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDecrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageSign VersionBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageVerify VersionBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveKey VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveBits VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageWrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageUnwrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "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 VersionBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWorkflowTypeWorkflow VersionBindingsWorkersBindingKindWorkflowType = "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 VersionBindingsWorkersBindingKindWasmModule 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 VersionBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWasmModuleTypeWasmModule VersionBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type VersionBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type VersionBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCServiceTypeVPCService VersionBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type VersionBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork VersionBindingsWorkersBindingKindVPCNetworkType = "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 VersionLimits` Resource limits enforced at runtime. - `CPUMs int64` CPU time limit in milliseconds. - `MainModule string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `Migrations VersionMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `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 VersionMigrationsWorkersMultipleStepMigrations 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` - `Modules []VersionModule` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `ContentBase64 string` The base64-encoded module content. - `ContentType string` The content type of the module. - `Name string` The name of the module. - `Placement VersionPlacement` 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 VersionPlacementMode struct{…}` - `Mode VersionPlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const VersionPlacementModeModeSmart VersionPlacementModeMode = "smart"` - `type VersionPlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Target []VersionPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type VersionPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type VersionPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Source string` The client used to create the version. - `StartupTimeMs int64` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `UsageModel VersionUsageModel` Usage model for the version. - `const VersionUsageModelStandard VersionUsageModel = "standard"` - `const VersionUsageModelBundled VersionUsageModel = "bundled"` - `const VersionUsageModelUnbound VersionUsageModel = "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.Beta.Workers.Versions.List( context.TODO(), "worker_id", workers.BetaWorkerVersionListParams{ 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": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_on": "2019-12-27T18:11:19.117Z", "number": 0, "urls": [ "https://9387e76d-my-worker.my-subdomain.workers.dev" ], "annotations": { "workers/message": "Fixed bug.", "workers/tag": "v1.0.1", "workers/triggered_by": "upload" }, "assets": { "config": { "html_handling": "auto-trailing-slash", "not_found_handling": "404-page", "run_worker_first": [ "string" ] }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "main_module": "index.js", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get Version `client.Workers.Beta.Workers.Versions.Get(ctx, workerID, versionID, params) (*Version, error)` **get** `/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}` Get details about a specific version. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `versionID string` Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version. - `params BetaWorkerVersionGetParams` - `AccountID param.Field[string]` Path param: Identifier. - `Include param.Field[BetaWorkerVersionGetParamsInclude]` Query param: Whether to include the `modules` property of the version in the response, which contains code and sourcemap content and may add several megabytes to the response size. - `const BetaWorkerVersionGetParamsIncludeModules BetaWorkerVersionGetParamsInclude = "modules"` ### Returns - `type Version struct{…}` - `ID string` Version identifier. - `CreatedOn Time` When the version was created. - `Number int64` The integer version number, starting from one. - `URLs []string` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `Annotations VersionAnnotations` Metadata about the version. - `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. - `Assets VersionAssets` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `Config VersionAssetsConfig` Configuration for assets within a Worker. - `HTMLHandling VersionAssetsConfigHTMLHandling` Determines the redirects and rewrites of requests for HTML content. - `const VersionAssetsConfigHTMLHandlingAutoTrailingSlash VersionAssetsConfigHTMLHandling = "auto-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingForceTrailingSlash VersionAssetsConfigHTMLHandling = "force-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingDropTrailingSlash VersionAssetsConfigHTMLHandling = "drop-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingNone VersionAssetsConfigHTMLHandling = "none"` - `NotFoundHandling VersionAssetsConfigNotFoundHandling` Determines the response when a request does not match a static asset, and there is no Worker script. - `const VersionAssetsConfigNotFoundHandlingNone VersionAssetsConfigNotFoundHandling = "none"` - `const VersionAssetsConfigNotFoundHandling404Page VersionAssetsConfigNotFoundHandling = "404-page"` - `const VersionAssetsConfigNotFoundHandlingSinglePageApplication VersionAssetsConfigNotFoundHandling = "single-page-application"` - `RunWorkerFirst VersionAssetsConfigRunWorkerFirstUnion` 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 VersionAssetsConfigRunWorkerFirstArray []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` - `JWT string` Token provided upon successful upload of all files from a registered manifest. - `Bindings []VersionBinding` 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 VersionBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAITypeAI VersionBindingsWorkersBindingKindAIType = "ai"` - `type VersionBindingsWorkersBindingKindAISearch 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 VersionBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchTypeAISearch VersionBindingsWorkersBindingKindAISearchType = "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 VersionBindingsWorkersBindingKindAISearchNamespace 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 VersionBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace VersionBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type VersionBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine VersionBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type VersionBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAssetsTypeAssets VersionBindingsWorkersBindingKindAssetsType = "assets"` - `type VersionBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindBrowserTypeBrowser VersionBindingsWorkersBindingKindBrowserType = "browser"` - `type VersionBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindD1TypeD1 VersionBindingsWorkersBindingKindD1Type = "d1"` - `type VersionBindingsWorkersBindingKindDataBlob 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 VersionBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDataBlobTypeDataBlob VersionBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type VersionBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type VersionBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace VersionBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound VersionBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []VersionBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker VersionBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` 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 VersionBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace VersionBindingsWorkersBindingKindDurableObjectNamespaceType = "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 VersionBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindHyperdriveTypeHyperdrive VersionBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type VersionBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type VersionBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindInheritTypeInherit VersionBindingsWorkersBindingKindInheritType = "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 VersionBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindImagesTypeImages VersionBindingsWorkersBindingKindImagesType = "images"` - `type VersionBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindJsonTypeJson VersionBindingsWorkersBindingKindJsonType = "json"` - `type VersionBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type VersionBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindKVNamespaceTypeKVNamespace VersionBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type VersionBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMediaTypeMedia VersionBindingsWorkersBindingKindMediaType = "media"` - `type VersionBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate VersionBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type VersionBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type VersionBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPlainTextTypePlainText VersionBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type VersionBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type VersionBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPipelinesTypePipelines VersionBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type VersionBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type VersionBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindQueueTypeQueue VersionBindingsWorkersBindingKindQueueType = "queue"` - `type VersionBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple VersionBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type VersionBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindRatelimitTypeRatelimit VersionBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type VersionBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindR2BucketTypeR2Bucket VersionBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction VersionBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionEu VersionBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedramp VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type VersionBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type VersionBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretTextTypeSecretText VersionBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type VersionBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSendEmailTypeSendEmail VersionBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type VersionBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type VersionBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindServiceTypeService VersionBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type VersionBindingsWorkersBindingKindTextBlob 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 VersionBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindTextBlobTypeTextBlob VersionBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type VersionBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVectorizeTypeVectorize VersionBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type VersionBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata VersionBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type VersionBindingsWorkersBindingKindSecretsStoreSecret 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 VersionBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret VersionBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type VersionBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format VersionBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const VersionBindingsWorkersBindingKindSecretKeyFormatRaw VersionBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatPkcs8 VersionBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatSpki VersionBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatJwk VersionBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretKeyTypeSecretKey VersionBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []VersionBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const VersionBindingsWorkersBindingKindSecretKeyUsageEncrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDecrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageSign VersionBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageVerify VersionBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveKey VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveBits VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageWrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageUnwrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "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 VersionBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWorkflowTypeWorkflow VersionBindingsWorkersBindingKindWorkflowType = "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 VersionBindingsWorkersBindingKindWasmModule 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 VersionBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWasmModuleTypeWasmModule VersionBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type VersionBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type VersionBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCServiceTypeVPCService VersionBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type VersionBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork VersionBindingsWorkersBindingKindVPCNetworkType = "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 VersionLimits` Resource limits enforced at runtime. - `CPUMs int64` CPU time limit in milliseconds. - `MainModule string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `Migrations VersionMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `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 VersionMigrationsWorkersMultipleStepMigrations 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` - `Modules []VersionModule` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `ContentBase64 string` The base64-encoded module content. - `ContentType string` The content type of the module. - `Name string` The name of the module. - `Placement VersionPlacement` 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 VersionPlacementMode struct{…}` - `Mode VersionPlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const VersionPlacementModeModeSmart VersionPlacementModeMode = "smart"` - `type VersionPlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Target []VersionPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type VersionPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type VersionPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Source string` The client used to create the version. - `StartupTimeMs int64` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `UsageModel VersionUsageModel` Usage model for the version. - `const VersionUsageModelStandard VersionUsageModel = "standard"` - `const VersionUsageModelBundled VersionUsageModel = "bundled"` - `const VersionUsageModelUnbound VersionUsageModel = "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"), ) version, err := client.Workers.Beta.Workers.Versions.Get( context.TODO(), "worker_id", "version_id", workers.BetaWorkerVersionGetParams{ 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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_on": "2019-12-27T18:11:19.117Z", "number": 0, "urls": [ "https://9387e76d-my-worker.my-subdomain.workers.dev" ], "annotations": { "workers/message": "Fixed bug.", "workers/tag": "v1.0.1", "workers/triggered_by": "upload" }, "assets": { "config": { "html_handling": "auto-trailing-slash", "not_found_handling": "404-page", "run_worker_first": [ "string" ] }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "main_module": "index.js", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" }, "success": true } ``` ## Create Version `client.Workers.Beta.Workers.Versions.New(ctx, workerID, params) (*Version, error)` **post** `/accounts/{account_id}/workers/workers/{worker_id}/versions` Create a new version. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `params BetaWorkerVersionNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Version param.Field[Version]` Body param - `Deploy param.Field[bool]` Query param: If true, a deployment will be created that sends 100% of traffic to the new version. ### Returns - `type Version struct{…}` - `ID string` Version identifier. - `CreatedOn Time` When the version was created. - `Number int64` The integer version number, starting from one. - `URLs []string` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `Annotations VersionAnnotations` Metadata about the version. - `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. - `Assets VersionAssets` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `Config VersionAssetsConfig` Configuration for assets within a Worker. - `HTMLHandling VersionAssetsConfigHTMLHandling` Determines the redirects and rewrites of requests for HTML content. - `const VersionAssetsConfigHTMLHandlingAutoTrailingSlash VersionAssetsConfigHTMLHandling = "auto-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingForceTrailingSlash VersionAssetsConfigHTMLHandling = "force-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingDropTrailingSlash VersionAssetsConfigHTMLHandling = "drop-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingNone VersionAssetsConfigHTMLHandling = "none"` - `NotFoundHandling VersionAssetsConfigNotFoundHandling` Determines the response when a request does not match a static asset, and there is no Worker script. - `const VersionAssetsConfigNotFoundHandlingNone VersionAssetsConfigNotFoundHandling = "none"` - `const VersionAssetsConfigNotFoundHandling404Page VersionAssetsConfigNotFoundHandling = "404-page"` - `const VersionAssetsConfigNotFoundHandlingSinglePageApplication VersionAssetsConfigNotFoundHandling = "single-page-application"` - `RunWorkerFirst VersionAssetsConfigRunWorkerFirstUnion` 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 VersionAssetsConfigRunWorkerFirstArray []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` - `JWT string` Token provided upon successful upload of all files from a registered manifest. - `Bindings []VersionBinding` 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 VersionBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAITypeAI VersionBindingsWorkersBindingKindAIType = "ai"` - `type VersionBindingsWorkersBindingKindAISearch 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 VersionBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchTypeAISearch VersionBindingsWorkersBindingKindAISearchType = "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 VersionBindingsWorkersBindingKindAISearchNamespace 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 VersionBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace VersionBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type VersionBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine VersionBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type VersionBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAssetsTypeAssets VersionBindingsWorkersBindingKindAssetsType = "assets"` - `type VersionBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindBrowserTypeBrowser VersionBindingsWorkersBindingKindBrowserType = "browser"` - `type VersionBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindD1TypeD1 VersionBindingsWorkersBindingKindD1Type = "d1"` - `type VersionBindingsWorkersBindingKindDataBlob 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 VersionBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDataBlobTypeDataBlob VersionBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type VersionBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type VersionBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace VersionBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound VersionBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []VersionBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker VersionBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` 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 VersionBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace VersionBindingsWorkersBindingKindDurableObjectNamespaceType = "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 VersionBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindHyperdriveTypeHyperdrive VersionBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type VersionBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type VersionBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindInheritTypeInherit VersionBindingsWorkersBindingKindInheritType = "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 VersionBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindImagesTypeImages VersionBindingsWorkersBindingKindImagesType = "images"` - `type VersionBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindJsonTypeJson VersionBindingsWorkersBindingKindJsonType = "json"` - `type VersionBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type VersionBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindKVNamespaceTypeKVNamespace VersionBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type VersionBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMediaTypeMedia VersionBindingsWorkersBindingKindMediaType = "media"` - `type VersionBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate VersionBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type VersionBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type VersionBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPlainTextTypePlainText VersionBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type VersionBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type VersionBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPipelinesTypePipelines VersionBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type VersionBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type VersionBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindQueueTypeQueue VersionBindingsWorkersBindingKindQueueType = "queue"` - `type VersionBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple VersionBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type VersionBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindRatelimitTypeRatelimit VersionBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type VersionBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindR2BucketTypeR2Bucket VersionBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction VersionBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionEu VersionBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedramp VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type VersionBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type VersionBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretTextTypeSecretText VersionBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type VersionBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSendEmailTypeSendEmail VersionBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type VersionBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type VersionBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindServiceTypeService VersionBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type VersionBindingsWorkersBindingKindTextBlob 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 VersionBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindTextBlobTypeTextBlob VersionBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type VersionBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVectorizeTypeVectorize VersionBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type VersionBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata VersionBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type VersionBindingsWorkersBindingKindSecretsStoreSecret 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 VersionBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret VersionBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type VersionBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format VersionBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const VersionBindingsWorkersBindingKindSecretKeyFormatRaw VersionBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatPkcs8 VersionBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatSpki VersionBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatJwk VersionBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretKeyTypeSecretKey VersionBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []VersionBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const VersionBindingsWorkersBindingKindSecretKeyUsageEncrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDecrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageSign VersionBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageVerify VersionBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveKey VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveBits VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageWrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageUnwrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "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 VersionBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWorkflowTypeWorkflow VersionBindingsWorkersBindingKindWorkflowType = "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 VersionBindingsWorkersBindingKindWasmModule 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 VersionBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWasmModuleTypeWasmModule VersionBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type VersionBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type VersionBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCServiceTypeVPCService VersionBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type VersionBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork VersionBindingsWorkersBindingKindVPCNetworkType = "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 VersionLimits` Resource limits enforced at runtime. - `CPUMs int64` CPU time limit in milliseconds. - `MainModule string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `Migrations VersionMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `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 VersionMigrationsWorkersMultipleStepMigrations 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` - `Modules []VersionModule` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `ContentBase64 string` The base64-encoded module content. - `ContentType string` The content type of the module. - `Name string` The name of the module. - `Placement VersionPlacement` 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 VersionPlacementMode struct{…}` - `Mode VersionPlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const VersionPlacementModeModeSmart VersionPlacementModeMode = "smart"` - `type VersionPlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Target []VersionPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type VersionPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type VersionPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Source string` The client used to create the version. - `StartupTimeMs int64` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `UsageModel VersionUsageModel` Usage model for the version. - `const VersionUsageModelStandard VersionUsageModel = "standard"` - `const VersionUsageModelBundled VersionUsageModel = "bundled"` - `const VersionUsageModelUnbound VersionUsageModel = "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"), ) version, err := client.Workers.Beta.Workers.Versions.New( context.TODO(), "worker_id", workers.BetaWorkerVersionNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Version: workers.VersionParam{ }, }, ) 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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_on": "2019-12-27T18:11:19.117Z", "number": 0, "urls": [ "https://9387e76d-my-worker.my-subdomain.workers.dev" ], "annotations": { "workers/message": "Fixed bug.", "workers/tag": "v1.0.1", "workers/triggered_by": "upload" }, "assets": { "config": { "html_handling": "auto-trailing-slash", "not_found_handling": "404-page", "run_worker_first": [ "string" ] }, "jwt": "jwt" }, "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "main_module": "index.js", "migrations": {}, "modules": [ { "content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==", "content_type": "application/javascript+module", "name": "index.js" } ], "placement": { "mode": "smart" }, "source": "wrangler", "startup_time_ms": 10, "usage_model": "standard" }, "success": true } ``` ## Delete Version `client.Workers.Beta.Workers.Versions.Delete(ctx, workerID, versionID, body) (*BetaWorkerVersionDeleteResponse, error)` **delete** `/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}` Delete a version. ### Parameters - `workerID string` Identifier for the Worker, which can be ID or name. - `versionID string` Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version. - `body BetaWorkerVersionDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type BetaWorkerVersionDeleteResponse struct{…}` - `Errors []BetaWorkerVersionDeleteResponseError` - `Code int64` - `Message string` - `DocumentationURL string` - `Source BetaWorkerVersionDeleteResponseErrorsSource` - `Pointer string` - `Messages []BetaWorkerVersionDeleteResponseMessage` - `Code int64` - `Message string` - `DocumentationURL string` - `Source BetaWorkerVersionDeleteResponseMessagesSource` - `Pointer string` - `Success BetaWorkerVersionDeleteResponseSuccess` Whether the API call was successful. - `const BetaWorkerVersionDeleteResponseSuccessTrue BetaWorkerVersionDeleteResponseSuccess = 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"), ) version, err := client.Workers.Beta.Workers.Versions.Delete( context.TODO(), "worker_id", "version_id", workers.BetaWorkerVersionDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", version.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 ### Version - `type Version struct{…}` - `ID string` Version identifier. - `CreatedOn Time` When the version was created. - `Number int64` The integer version number, starting from one. - `URLs []string` All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. - `Annotations VersionAnnotations` Metadata about the version. - `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. - `Assets VersionAssets` Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `Config VersionAssetsConfig` Configuration for assets within a Worker. - `HTMLHandling VersionAssetsConfigHTMLHandling` Determines the redirects and rewrites of requests for HTML content. - `const VersionAssetsConfigHTMLHandlingAutoTrailingSlash VersionAssetsConfigHTMLHandling = "auto-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingForceTrailingSlash VersionAssetsConfigHTMLHandling = "force-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingDropTrailingSlash VersionAssetsConfigHTMLHandling = "drop-trailing-slash"` - `const VersionAssetsConfigHTMLHandlingNone VersionAssetsConfigHTMLHandling = "none"` - `NotFoundHandling VersionAssetsConfigNotFoundHandling` Determines the response when a request does not match a static asset, and there is no Worker script. - `const VersionAssetsConfigNotFoundHandlingNone VersionAssetsConfigNotFoundHandling = "none"` - `const VersionAssetsConfigNotFoundHandling404Page VersionAssetsConfigNotFoundHandling = "404-page"` - `const VersionAssetsConfigNotFoundHandlingSinglePageApplication VersionAssetsConfigNotFoundHandling = "single-page-application"` - `RunWorkerFirst VersionAssetsConfigRunWorkerFirstUnion` 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 VersionAssetsConfigRunWorkerFirstArray []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` - `JWT string` Token provided upon successful upload of all files from a registered manifest. - `Bindings []VersionBinding` 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 VersionBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAITypeAI VersionBindingsWorkersBindingKindAIType = "ai"` - `type VersionBindingsWorkersBindingKindAISearch 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 VersionBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchTypeAISearch VersionBindingsWorkersBindingKindAISearchType = "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 VersionBindingsWorkersBindingKindAISearchNamespace 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 VersionBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace VersionBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type VersionBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine VersionBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type VersionBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindAssetsTypeAssets VersionBindingsWorkersBindingKindAssetsType = "assets"` - `type VersionBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindBrowserTypeBrowser VersionBindingsWorkersBindingKindBrowserType = "browser"` - `type VersionBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindD1TypeD1 VersionBindingsWorkersBindingKindD1Type = "d1"` - `type VersionBindingsWorkersBindingKindDataBlob 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 VersionBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDataBlobTypeDataBlob VersionBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type VersionBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type VersionBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace VersionBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound VersionBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []VersionBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker VersionBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` 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 VersionBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace VersionBindingsWorkersBindingKindDurableObjectNamespaceType = "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 VersionBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindHyperdriveTypeHyperdrive VersionBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type VersionBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type VersionBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindInheritTypeInherit VersionBindingsWorkersBindingKindInheritType = "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 VersionBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindImagesTypeImages VersionBindingsWorkersBindingKindImagesType = "images"` - `type VersionBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindJsonTypeJson VersionBindingsWorkersBindingKindJsonType = "json"` - `type VersionBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type VersionBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindKVNamespaceTypeKVNamespace VersionBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type VersionBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMediaTypeMedia VersionBindingsWorkersBindingKindMediaType = "media"` - `type VersionBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate VersionBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type VersionBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type VersionBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPlainTextTypePlainText VersionBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type VersionBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type VersionBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindPipelinesTypePipelines VersionBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type VersionBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type VersionBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindQueueTypeQueue VersionBindingsWorkersBindingKindQueueType = "queue"` - `type VersionBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple VersionBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type VersionBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindRatelimitTypeRatelimit VersionBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type VersionBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindR2BucketTypeR2Bucket VersionBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction VersionBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionEu VersionBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedramp VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const VersionBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh VersionBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type VersionBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type VersionBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretTextTypeSecretText VersionBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type VersionBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSendEmailTypeSendEmail VersionBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type VersionBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type VersionBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindServiceTypeService VersionBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type VersionBindingsWorkersBindingKindTextBlob 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 VersionBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindTextBlobTypeTextBlob VersionBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type VersionBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVectorizeTypeVectorize VersionBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type VersionBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata VersionBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type VersionBindingsWorkersBindingKindSecretsStoreSecret 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 VersionBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret VersionBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type VersionBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format VersionBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const VersionBindingsWorkersBindingKindSecretKeyFormatRaw VersionBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatPkcs8 VersionBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatSpki VersionBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const VersionBindingsWorkersBindingKindSecretKeyFormatJwk VersionBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindSecretKeyTypeSecretKey VersionBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []VersionBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const VersionBindingsWorkersBindingKindSecretKeyUsageEncrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDecrypt VersionBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageSign VersionBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageVerify VersionBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveKey VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageDeriveBits VersionBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageWrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const VersionBindingsWorkersBindingKindSecretKeyUsageUnwrapKey VersionBindingsWorkersBindingKindSecretKeyUsage = "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 VersionBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWorkflowTypeWorkflow VersionBindingsWorkersBindingKindWorkflowType = "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 VersionBindingsWorkersBindingKindWasmModule 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 VersionBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindWasmModuleTypeWasmModule VersionBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type VersionBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type VersionBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCServiceTypeVPCService VersionBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type VersionBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type VersionBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const VersionBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork VersionBindingsWorkersBindingKindVPCNetworkType = "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 VersionLimits` Resource limits enforced at runtime. - `CPUMs int64` CPU time limit in milliseconds. - `MainModule string` The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler). - `Migrations VersionMigrations` Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. - `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 VersionMigrationsWorkersMultipleStepMigrations 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` - `Modules []VersionModule` Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`. - `ContentBase64 string` The base64-encoded module content. - `ContentType string` The content type of the module. - `Name string` The name of the module. - `Placement VersionPlacement` 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 VersionPlacementMode struct{…}` - `Mode VersionPlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const VersionPlacementModeModeSmart VersionPlacementModeMode = "smart"` - `type VersionPlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type VersionPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `type VersionPlacementObject struct{…}` - `Mode VersionPlacementObjectMode` Targeted placement mode. - `const VersionPlacementObjectModeTargeted VersionPlacementObjectMode = "targeted"` - `Target []VersionPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type VersionPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type VersionPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type VersionPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Source string` The client used to create the version. - `StartupTimeMs int64` Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). - `UsageModel VersionUsageModel` Usage model for the version. - `const VersionUsageModelStandard VersionUsageModel = "standard"` - `const VersionUsageModelBundled VersionUsageModel = "bundled"` - `const VersionUsageModelUnbound VersionUsageModel = "unbound"`