# Workers
## Domain Types
### Migration Step
- `type MigrationStep struct{…}`
- `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`
### Single Step Migration
- `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`
### Worker Metadata
- `type WorkerMetadata struct{…}`
JSON-encoded metadata about the uploaded parts and Worker configuration.
- `BodyPart string`
Name of the part in the multipart request that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker.
- `MainModule string`
Name of the part in the multipart request that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
# 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"`
# Routes
## List Routes
`client.Workers.Routes.List(ctx, query) (*SinglePage[RouteListResponse], error)`
**get** `/zones/{zone_id}/workers/routes`
Returns routes for a zone.
### Parameters
- `query RouteListParams`
- `ZoneID param.Field[string]`
Identifier.
### Returns
- `type RouteListResponse struct{…}`
- `ID string`
Identifier.
- `Pattern string`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script string`
Name of the script to run if the route matches.
### 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.Routes.List(context.TODO(), workers.RouteListParams{
ZoneID: 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": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
}
],
"success": true
}
```
## Get Route
`client.Workers.Routes.Get(ctx, routeID, query) (*RouteGetResponse, error)`
**get** `/zones/{zone_id}/workers/routes/{route_id}`
Returns information about a route, including URL pattern and Worker.
### Parameters
- `routeID string`
Identifier.
- `query RouteGetParams`
- `ZoneID param.Field[string]`
Identifier.
### Returns
- `type RouteGetResponse struct{…}`
- `ID string`
Identifier.
- `Pattern string`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script string`
Name of the script to run if the route matches.
### 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"),
)
route, err := client.Workers.Routes.Get(
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
workers.RouteGetParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", route.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
},
"success": true
}
```
## Create Route
`client.Workers.Routes.New(ctx, params) (*RouteNewResponse, error)`
**post** `/zones/{zone_id}/workers/routes`
Creates a route that maps a URL pattern to a Worker.
### Parameters
- `params RouteNewParams`
- `ZoneID param.Field[string]`
Path param: Identifier.
- `Pattern param.Field[string]`
Body param: Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script param.Field[string]`
Body param: Name of the script to run if the route matches.
### Returns
- `type RouteNewResponse struct{…}`
- `ID string`
Identifier.
- `Pattern string`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script string`
Name of the script to run if the route matches.
### 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"),
)
route, err := client.Workers.Routes.New(context.TODO(), workers.RouteNewParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Pattern: cloudflare.F("example.com/*"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", route.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
},
"success": true
}
```
## Update Route
`client.Workers.Routes.Update(ctx, routeID, params) (*RouteUpdateResponse, error)`
**put** `/zones/{zone_id}/workers/routes/{route_id}`
Updates the URL pattern or Worker associated with a route.
### Parameters
- `routeID string`
Identifier.
- `params RouteUpdateParams`
- `ZoneID param.Field[string]`
Path param: Identifier.
- `Pattern param.Field[string]`
Body param: Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script param.Field[string]`
Body param: Name of the script to run if the route matches.
### Returns
- `type RouteUpdateResponse struct{…}`
- `ID string`
Identifier.
- `Pattern string`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script string`
Name of the script to run if the route matches.
### 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"),
)
route, err := client.Workers.Routes.Update(
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
workers.RouteUpdateParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Pattern: cloudflare.F("example.com/*"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", route.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
},
"success": true
}
```
## Delete Route
`client.Workers.Routes.Delete(ctx, routeID, body) (*RouteDeleteResponse, error)`
**delete** `/zones/{zone_id}/workers/routes/{route_id}`
Deletes a route.
### Parameters
- `routeID string`
Identifier.
- `body RouteDeleteParams`
- `ZoneID param.Field[string]`
Identifier.
### Returns
- `type RouteDeleteResponse struct{…}`
- `ID string`
Identifier.
### 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"),
)
route, err := client.Workers.Routes.Delete(
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
workers.RouteDeleteParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", route.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353"
},
"success": true
}
```
# Assets
# Upload
## Upload Assets
`client.Workers.Assets.Upload.New(ctx, params) (*AssetUploadNewResponse, error)`
**post** `/accounts/{account_id}/workers/assets/upload`
Upload assets ahead of creating a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.
### Parameters
- `params AssetUploadNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Base64 param.Field[AssetUploadNewParamsBase64]`
Query param: Whether the file contents are base64-encoded. Must be `true`.
- `const AssetUploadNewParamsBase64True AssetUploadNewParamsBase64 = true`
- `Body param.Field[map[string, string]]`
Body param
### Returns
- `type AssetUploadNewResponse struct{…}`
- `JWT string`
A "completion" JWT which can be redeemed when creating a Worker version.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
)
upload, err := client.Workers.Assets.Upload.New(context.TODO(), workers.AssetUploadNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Base64: cloudflare.F(workers.AssetUploadNewParamsBase64True),
Body: map[string]string{
"foo": "string",
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", upload.JWT)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"jwt": "jwt"
}
}
```
# Scripts
## List Workers
`client.Workers.Scripts.List(ctx, params) (*SinglePage[ScriptListResponse], error)`
**get** `/accounts/{account_id}/workers/scripts`
Fetch a list of uploaded workers.
### Parameters
- `params ScriptListParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Tags param.Field[string]`
Query param: Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.
### Returns
- `type ScriptListResponse struct{…}`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `CreatedOn Time`
When the script was created.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptListResponseNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptListResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptListResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptListResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptListResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptListResponsePlacementObject struct{…}`
- `Mode ScriptListResponsePlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectModeSmart ScriptListResponsePlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptListResponsePlacementObject struct{…}`
- `Mode ScriptListResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptListResponsePlacementObjectModeTargeted ScriptListResponsePlacementObjectMode = "targeted"`
- `Target []ScriptListResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptListResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptListResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptListResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptListResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptListResponsePlacementObjectStatusSuccess ScriptListResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptListResponsePlacementObjectStatusUnsupportedApplication ScriptListResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementObjectStatusInsufficientInvocations ScriptListResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptListResponsePlacementMode`
- `const ScriptListResponsePlacementModeSmart ScriptListResponsePlacementMode = "smart"`
- `const ScriptListResponsePlacementModeTargeted ScriptListResponsePlacementMode = "targeted"`
- `PlacementStatus ScriptListResponsePlacementStatus`
- `const ScriptListResponsePlacementStatusSuccess ScriptListResponsePlacementStatus = "SUCCESS"`
- `const ScriptListResponsePlacementStatusUnsupportedApplication ScriptListResponsePlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptListResponsePlacementStatusInsufficientInvocations ScriptListResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Routes []ScriptListResponseRoute`
Routes associated with the Worker.
- `ID string`
Identifier.
- `Pattern string`
Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior).
- `Script string`
Name of the script to run if the route matches.
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptListResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptListResponseUsageModelStandard ScriptListResponseUsageModel = "standard"`
- `const ScriptListResponseUsageModelBundled ScriptListResponseUsageModel = "bundled"`
- `const ScriptListResponseUsageModelUnbound ScriptListResponseUsageModel = "unbound"`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
page, err := client.Workers.Scripts.List(context.TODO(), workers.ScriptListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "my-workers-script",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2017-01-01T00:00:00Z",
"etag": "ea95132c15732412d22c1476fa83f27a",
"handlers": [
"fetch",
"scheduled"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2017-01-01T00:00:00Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"routes": [
{
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"pattern": "example.com/*",
"script": "my-workers-script"
}
],
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
}
],
"success": true
}
```
## Search Workers
`client.Workers.Scripts.Search(ctx, params) (*[]ScriptSearchResponse, error)`
**get** `/accounts/{account_id}/workers/scripts-search`
Search for Workers in an account.
### Parameters
- `params ScriptSearchParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `ID param.Field[string]`
Query param: Worker ID (also called tag) to search for. Only exact matches are returned.
- `Name param.Field[string]`
Query param: Worker name to search for. Both exact and partial matches are returned.
- `OrderBy param.Field[ScriptSearchParamsOrderBy]`
Query param: Property to sort results by. Results are sorted in ascending order.
- `const ScriptSearchParamsOrderByCreatedOn ScriptSearchParamsOrderBy = "created_on"`
- `const ScriptSearchParamsOrderByModifiedOn ScriptSearchParamsOrderBy = "modified_on"`
- `const ScriptSearchParamsOrderByName ScriptSearchParamsOrderBy = "name"`
- `Page param.Field[int64]`
Query param: Current page.
- `PerPage param.Field[int64]`
Query param: Items per page.
### Returns
- `type ScriptSearchResponseEnvelopeResult []ScriptSearchResponse`
- `ID string`
Identifier.
- `CreatedOn Time`
When the script was created.
- `ModifiedOn Time`
When the script was last modified.
- `ScriptName string`
Name of the script, used in URLs and route configuration.
- `EnvironmentIsDefault bool`
Whether the environment is the default environment.
- `EnvironmentName string`
Name of the environment.
- `ServiceName string`
Name of the service.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.Workers.Scripts.Search(context.TODO(), workers.ScriptSearchParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"created_on": "2017-01-01T00:00:00Z",
"modified_on": "2017-01-01T00:00:00Z",
"script_name": "this-is_my_script-01",
"environment_is_default": true,
"environment_name": "production",
"service_name": "my-service"
}
],
"success": true,
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}
```
## Download Worker
`client.Workers.Scripts.Get(ctx, scriptName, query) (*string, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}`
Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptGetResponse string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
script, err := client.Workers.Scripts.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script)
}
```
## Upload Worker Module
`client.Workers.Scripts.Update(ctx, scriptName, params) (*ScriptUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}`
Upload a worker module. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Metadata param.Field[ScriptUpdateParamsMetadata]`
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
- `Annotations ScriptUpdateParamsMetadataAnnotations`
Annotations for the version created by this upload.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `Assets ScriptUpdateParamsMetadataAssets`
Configuration for assets within a Worker.
- `Config ScriptUpdateParamsMetadataAssetsConfig`
Configuration for assets within a Worker.
- `Headers string`
The contents of a _headers file (used to attach custom headers on asset responses).
- `Redirects string`
The contents of a _redirects file (used to apply redirects or proxy paths ahead of asset serving).
- `HTMLHandling ScriptUpdateParamsMetadataAssetsConfigHTMLHandling`
Determines the redirects and rewrites of requests for HTML content.
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingAutoTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "auto-trailing-slash"`
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingForceTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "force-trailing-slash"`
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingDropTrailingSlash ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "drop-trailing-slash"`
- `const ScriptUpdateParamsMetadataAssetsConfigHTMLHandlingNone ScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "none"`
- `NotFoundHandling ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling`
Determines the response when a request does not match a static asset, and there is no Worker script.
- `const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingNone ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "none"`
- `const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling404Page ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "404-page"`
- `const ScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingSinglePageApplication ScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "single-page-application"`
- `RunWorkerFirst ScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstUnion`
Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules.
- `type ScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstArray []string`
Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules.
- `UnionBool`
- `ServeDirectly bool`
When true and the incoming request matches an asset, that will be served instead of invoking the Worker script. When false, requests will always invoke the Worker script.
- `JWT string`
Token provided upon successful upload of all files from a registered manifest.
- `Bindings []ScriptUpdateParamsMetadataBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAITypeAI ScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchTypeAISearch ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsTypeAssets ScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserTypeBrowser ScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1TypeD1 ScriptUpdateParamsMetadataBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritTypeInherit ScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesTypeImages ScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonTypeJson ScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaTypeMedia ScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextTypePlainText ScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesTypePipelines ScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueTypeQueue ScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextTypeSecretText ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceTypeService ScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeTypeVectorize ScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatRaw ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatSpki ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatJwk ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageSign ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageVerify ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `BodyPart string`
Name of the uploaded file that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `KeepAssets bool`
Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token.
- `KeepBindings []string`
List of binding types to keep from previous_upload.
- `Limits ScriptUpdateParamsMetadataLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MainModule string`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
- `Migrations ScriptUpdateParamsMetadataMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptUpdateParamsMetadataMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptUpdateParamsMetadataObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptUpdateParamsMetadataObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptUpdateParamsMetadataObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptUpdateParamsMetadataPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectModeSmart ScriptUpdateParamsMetadataPlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateParamsMetadataPlacementObject struct{…}`
- `Mode ScriptUpdateParamsMetadataPlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateParamsMetadataPlacementObjectModeTargeted ScriptUpdateParamsMetadataPlacementObjectMode = "targeted"`
- `Target []ScriptUpdateParamsMetadataPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptUpdateParamsMetadataPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptUpdateParamsMetadataPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptUpdateParamsMetadataPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateParamsMetadataPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateParamsMetadataPlacementObjectStatusSuccess ScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication ScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations ScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tags []string`
List of strings to use as tags for this Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUpdateParamsMetadataUsageModel`
Usage model for the Worker invocations.
- `const ScriptUpdateParamsMetadataUsageModelStandard ScriptUpdateParamsMetadataUsageModel = "standard"`
- `const ScriptUpdateParamsMetadataUsageModelBundled ScriptUpdateParamsMetadataUsageModel = "bundled"`
- `const ScriptUpdateParamsMetadataUsageModelUnbound ScriptUpdateParamsMetadataUsageModel = "unbound"`
- `BindingsInherit param.Field[ScriptUpdateParamsBindingsInherit]`
Query param: When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.
- `const ScriptUpdateParamsBindingsInheritStrict ScriptUpdateParamsBindingsInherit = "strict"`
- `Files param.Field[[]Reader]`
Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
### Returns
- `type ScriptUpdateResponse struct{…}`
- `StartupTimeMs int64`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `CreatedOn Time`
When the script was created.
- `EntryPoint string`
The entry point for the script.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptUpdateResponseNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptUpdateResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptUpdateResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptUpdateResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptUpdateResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Mode ScriptUpdateResponsePlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectModeSmart ScriptUpdateResponsePlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Mode ScriptUpdateResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptUpdateResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptUpdateResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptUpdateResponsePlacementObject struct{…}`
- `Mode ScriptUpdateResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptUpdateResponsePlacementObjectModeTargeted ScriptUpdateResponsePlacementObjectMode = "targeted"`
- `Target []ScriptUpdateResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptUpdateResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptUpdateResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptUpdateResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptUpdateResponsePlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptUpdateResponsePlacementObjectStatusSuccess ScriptUpdateResponsePlacementObjectStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementObjectStatusUnsupportedApplication ScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementObjectStatusInsufficientInvocations ScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptUpdateResponsePlacementMode`
- `const ScriptUpdateResponsePlacementModeSmart ScriptUpdateResponsePlacementMode = "smart"`
- `const ScriptUpdateResponsePlacementModeTargeted ScriptUpdateResponsePlacementMode = "targeted"`
- `PlacementStatus ScriptUpdateResponsePlacementStatus`
- `const ScriptUpdateResponsePlacementStatusSuccess ScriptUpdateResponsePlacementStatus = "SUCCESS"`
- `const ScriptUpdateResponsePlacementStatusUnsupportedApplication ScriptUpdateResponsePlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptUpdateResponsePlacementStatusInsufficientInvocations ScriptUpdateResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUpdateResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptUpdateResponseUsageModelStandard ScriptUpdateResponseUsageModel = "standard"`
- `const ScriptUpdateResponseUsageModelBundled ScriptUpdateResponseUsageModel = "bundled"`
- `const ScriptUpdateResponseUsageModelUnbound ScriptUpdateResponseUsageModel = "unbound"`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
script, err := client.Workers.Scripts.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Metadata: cloudflare.F(workers.ScriptUpdateParamsMetadata{
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"startup_time_ms": 10,
"id": "this-is_my_script-01",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2022-05-05T05:15:11.602148Z",
"entry_point": "index.js",
"etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1",
"handlers": [
"fetch"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2022-05-20T19:02:56.446492Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## Delete Worker
`client.Workers.Scripts.Delete(ctx, scriptName, params) (*ScriptDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}`
Delete your worker. This call has no response body on a successful delete.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptDeleteParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Force param.Field[bool]`
Query param: If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.
### Returns
- `type ScriptDeleteResponse interface{…}`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
script, err := client.Workers.Scripts.Delete(
context.TODO(),
"this-is_my_script-01",
workers.ScriptDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {}
}
```
## Domain Types
### Script
- `type Script struct{…}`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `CreatedOn Time`
When the script was created.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Target []ScriptPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptPlacementMode`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"`
- `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"`
- `PlacementStatus ScriptPlacementStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"`
- `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUsageModel`
Usage model for the Worker invocations.
- `const ScriptUsageModelStandard ScriptUsageModel = "standard"`
- `const ScriptUsageModelBundled ScriptUsageModel = "bundled"`
- `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"`
### Script Setting
- `type ScriptSetting struct{…}`
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Observability ScriptSettingObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptSettingObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptSettingObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
# Assets
# Upload
## Create Assets Upload Session
`client.Workers.Scripts.Assets.Upload.New(ctx, scriptName, params) (*ScriptAssetUploadNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session`
Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptAssetUploadNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Manifest param.Field[map[string, ScriptAssetUploadNewParamsManifest]]`
Body param: A manifest ([path]: {hash, size}) map of files to upload. As an example, `/blog/hello-world.html` would be a valid path key.
- `Hash string`
The hash of the file.
- `Size int64`
The size of the file in bytes.
### Returns
- `type ScriptAssetUploadNewResponse struct{…}`
- `Buckets [][]string`
The requests to make to upload assets.
- `JWT string`
A JWT to use as authentication for uploading assets.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
upload, err := client.Workers.Scripts.Assets.Upload.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptAssetUploadNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Manifest: cloudflare.F(map[string]workers.ScriptAssetUploadNewParamsManifest{
"foo": workers.ScriptAssetUploadNewParamsManifest{
Hash: cloudflare.F("hash"),
Size: cloudflare.F(int64(0)),
},
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", upload.Buckets)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"buckets": [
[
"string"
]
],
"jwt": "jwt"
}
}
```
# Subdomain
## Get Worker subdomain
`client.Workers.Scripts.Subdomain.Get(ctx, scriptName, query) (*ScriptSubdomainGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Get if the Worker is available on the workers.dev subdomain.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptSubdomainGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSubdomainGetResponse struct{…}`
- `Enabled bool`
Whether the Worker is available on the workers.dev subdomain.
- `PreviewsEnabled bool`
Whether the Worker's Preview URLs are available on the workers.dev subdomain.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
subdomain, err := client.Workers.Scripts.Subdomain.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSubdomainGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Enabled)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Post Worker subdomain
`client.Workers.Scripts.Subdomain.New(ctx, scriptName, params) (*ScriptSubdomainNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Enable or disable the Worker on the workers.dev subdomain.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptSubdomainNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Enabled param.Field[bool]`
Body param: Whether the Worker should be available on the workers.dev subdomain.
- `PreviewsEnabled param.Field[bool]`
Body param: Whether the Worker's Preview URLs should be available on the workers.dev subdomain.
### Returns
- `type ScriptSubdomainNewResponse struct{…}`
- `Enabled bool`
Whether the Worker is available on the workers.dev subdomain.
- `PreviewsEnabled bool`
Whether the Worker's Preview URLs are available on the workers.dev subdomain.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
subdomain, err := client.Workers.Scripts.Subdomain.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSubdomainNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Enabled: cloudflare.F(true),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Enabled)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
## Delete Worker subdomain
`client.Workers.Scripts.Subdomain.Delete(ctx, scriptName, body) (*ScriptSubdomainDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/subdomain`
Disable all workers.dev subdomains for a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `body ScriptSubdomainDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSubdomainDeleteResponse struct{…}`
- `Enabled bool`
Whether the Worker is available on the workers.dev subdomain.
- `PreviewsEnabled bool`
Whether the Worker's Preview URLs are available on the workers.dev subdomain.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
subdomain, err := client.Workers.Scripts.Subdomain.Delete(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSubdomainDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Enabled)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"enabled": false,
"previews_enabled": false
},
"success": true
}
```
# Schedules
## Get Cron Triggers
`client.Workers.Scripts.Schedules.Get(ctx, scriptName, query) (*ScriptScheduleGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/schedules`
Fetches Cron Triggers for a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptScheduleGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptScheduleGetResponse struct{…}`
- `Schedules []ScriptScheduleGetResponseSchedule`
- `Cron string`
- `CreatedOn string`
- `ModifiedOn string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
schedule, err := client.Workers.Scripts.Schedules.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScheduleGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", schedule.Schedules)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"schedules": [
{
"cron": "*/30 * * * *",
"created_on": "created_on",
"modified_on": "modified_on"
}
]
},
"success": true
}
```
## Update Cron Triggers
`client.Workers.Scripts.Schedules.Update(ctx, scriptName, params) (*ScriptScheduleUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/schedules`
Updates Cron Triggers for a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptScheduleUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Body param.Field[[]ScriptScheduleUpdateParamsBody]`
Body param
- `Cron string`
- `CreatedOn string`
- `ModifiedOn string`
### Returns
- `type ScriptScheduleUpdateResponse struct{…}`
- `Schedules []ScriptScheduleUpdateResponseSchedule`
- `Cron string`
- `CreatedOn string`
- `ModifiedOn string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
schedule, err := client.Workers.Scripts.Schedules.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScheduleUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: []workers.ScriptScheduleUpdateParamsBody{workers.ScriptScheduleUpdateParamsBody{
Cron: cloudflare.F("*/30 * * * *"),
}},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", schedule.Schedules)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"schedules": [
{
"cron": "*/30 * * * *",
"created_on": "created_on",
"modified_on": "modified_on"
}
]
},
"success": true
}
```
# Tail
## List Tails
`client.Workers.Scripts.Tail.Get(ctx, scriptName, query) (*ScriptTailGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/tails`
Get list of tails currently deployed on a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptTailGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptTailGetResponse struct{…}`
- `ID string`
Identifier.
- `ExpiresAt string`
- `URL string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
tail, err := client.Workers.Scripts.Tail.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptTailGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tail.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"expires_at": "expires_at",
"url": "url"
},
"success": true
}
```
## Start Tail
`client.Workers.Scripts.Tail.New(ctx, scriptName, params) (*ScriptTailNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/tails`
Starts a tail that receives logs and exception from a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptTailNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Body param.Field[unknown]`
Body param
### Returns
- `type ScriptTailNewResponse struct{…}`
- `ID string`
Identifier.
- `ExpiresAt string`
- `URL string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
tail, err := client.Workers.Scripts.Tail.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptTailNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: map[string]interface{}{
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tail.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"expires_at": "expires_at",
"url": "url"
},
"success": true
}
```
## Delete Tail
`client.Workers.Scripts.Tail.Delete(ctx, scriptName, id, body) (*ScriptTailDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}`
Deletes a tail from a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `id string`
Identifier.
- `body ScriptTailDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptTailDeleteResponse struct{…}`
- `Errors []ScriptTailDeleteResponseError`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptTailDeleteResponseErrorsSource`
- `Pointer string`
- `Messages []ScriptTailDeleteResponseMessage`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptTailDeleteResponseMessagesSource`
- `Pointer string`
- `Success ScriptTailDeleteResponseSuccess`
Whether the API call was successful.
- `const ScriptTailDeleteResponseSuccessTrue ScriptTailDeleteResponseSuccess = true`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
tail, err := client.Workers.Scripts.Tail.Delete(
context.TODO(),
"this-is_my_script-01",
"023e105f4ecef8ad9ca31a8372d0c353",
workers.ScriptTailDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tail.Errors)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true
}
```
## Domain Types
### Consumer Script
- `type ConsumerScript struct{…}`
A reference to a script that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
# Content
## Get script content
`client.Workers.Scripts.Content.Get(ctx, scriptName, query) (*Response, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/content/v2`
Fetch script content only.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptContentGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptContentGetResponse interface{…}`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
content, err := client.Workers.Scripts.Content.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptContentGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", content)
}
```
## Put script content
`client.Workers.Scripts.Content.Update(ctx, scriptName, params) (*Script, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/content`
Put script content without touching config or metadata.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptContentUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Metadata param.Field[ScriptContentUpdateParamsMetadata]`
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
- `BodyPart string`
Name of the uploaded file that contains the Worker script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker.
- `MainModule string`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
- `Files param.Field[[]Reader]`
Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
- `CfWorkerBodyPart param.Field[string]`
Header param: The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.
- `CfWorkerMainModulePart param.Field[string]`
Header param: The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.
### Returns
- `type Script struct{…}`
- `ID string`
The name used to identify the script.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `CreatedOn Time`
When the script was created.
- `Etag string`
Hashed script content, can be used in a If-None-Match header when updating.
- `Handlers []string`
The names of handlers exported as part of the default export.
- `HasAssets bool`
Whether a Worker contains assets.
- `HasModules bool`
Whether a Worker contains modules.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `ModifiedOn Time`
When the script was last modified.
- `NamedHandlers []ScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the export.
- `Observability ScriptObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `type ScriptPlacementObject struct{…}`
- `Mode ScriptPlacementObjectMode`
Targeted placement mode.
- `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"`
- `Target []ScriptPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `LastAnalyzedAt Time`
The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `Status ScriptPlacementObjectStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"`
- `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"`
- `PlacementMode ScriptPlacementMode`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"`
- `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"`
- `PlacementStatus ScriptPlacementStatus`
Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"`
- `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"`
- `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"`
- `Tag string`
The immutable ID of the script.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptUsageModel`
Usage model for the Worker invocations.
- `const ScriptUsageModelStandard ScriptUsageModel = "standard"`
- `const ScriptUsageModelBundled ScriptUsageModel = "bundled"`
- `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
script, err := client.Workers.Scripts.Content.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptContentUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Metadata: cloudflare.F(workers.ScriptContentUpdateParamsMetadata{
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", script.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "my-workers-script",
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"created_on": "2017-01-01T00:00:00Z",
"etag": "ea95132c15732412d22c1476fa83f27a",
"handlers": [
"fetch",
"scheduled"
],
"has_assets": false,
"has_modules": false,
"last_deployed_from": "wrangler",
"logpush": false,
"migration_tag": "v1",
"modified_on": "2017-01-01T00:00:00Z",
"named_handlers": [
{
"handlers": [
"class"
],
"name": "MyDurableObject"
}
],
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart",
"last_analyzed_at": "2025-01-01T00:00:00Z",
"status": "SUCCESS"
},
"placement_mode": "smart",
"placement_status": "SUCCESS",
"tag": "e8f70fdbc8b1fb0b8ddb1af166186758",
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
# Settings
## Get Script Settings
`client.Workers.Scripts.Settings.Get(ctx, scriptName, query) (*ScriptSetting, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/script-settings`
Get script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Includes Logpush and Tail Consumers.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptSettingGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSetting struct{…}`
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Observability ScriptSettingObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptSettingObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptSettingObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
scriptSetting, err := client.Workers.Scripts.Settings.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSettingGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scriptSetting.Logpush)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
]
},
"success": true
}
```
## Patch Script Settings
`client.Workers.Scripts.Settings.Edit(ctx, scriptName, params) (*ScriptSetting, error)`
**patch** `/accounts/{account_id}/workers/scripts/{script_name}/script-settings`
Patch script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). Including but not limited to Logpush and Tail Consumers.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptSettingEditParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `ScriptSetting param.Field[ScriptSetting]`
Body param
### Returns
- `type ScriptSetting struct{…}`
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Observability ScriptSettingObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptSettingObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptSettingObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
scriptSetting, err := client.Workers.Scripts.Settings.Edit(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSettingEditParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
ScriptSetting: workers.ScriptSettingParam{
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scriptSetting.Logpush)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
]
},
"success": true
}
```
# Deployments
## List Deployments
`client.Workers.Scripts.Deployments.List(ctx, scriptName, query) (*ScriptDeploymentListResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/deployments`
List of Worker Deployments. The first deployment in the list is the latest deployment actively serving traffic.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptDeploymentListParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptDeploymentListResponse struct{…}`
- `Deployments []Deployment`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
deployments, err := client.Workers.Scripts.Deployments.List(
context.TODO(),
"this-is_my_script-01",
workers.ScriptDeploymentListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployments.Deployments)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"deployments": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
}
]
},
"success": true
}
```
## Create Deployment
`client.Workers.Scripts.Deployments.New(ctx, scriptName, params) (*Deployment, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/deployments`
Deployments configure how [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) are deployed to traffic. A deployment can consist of one or two versions of a Worker.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptDeploymentNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Deployment param.Field[Deployment]`
Body param
- `Force param.Field[bool]`
Query param: If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed.
### Returns
- `type Deployment struct{…}`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
deployment, err := client.Workers.Scripts.Deployments.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptDeploymentNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Deployment: workers.DeploymentParam{
Strategy: cloudflare.F(workers.DeploymentStrategyPercentage),
Versions: cloudflare.F([]workers.DeploymentVersionParam{workers.DeploymentVersionParam{
Percentage: cloudflare.F(100.000000),
VersionID: cloudflare.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}}),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployment.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
},
"success": true
}
```
## Get Deployment
`client.Workers.Scripts.Deployments.Get(ctx, scriptName, deploymentID, query) (*Deployment, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}`
Get information about a Worker Deployment.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `deploymentID string`
- `query ScriptDeploymentGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type Deployment struct{…}`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
deployment, err := client.Workers.Scripts.Deployments.Get(
context.TODO(),
"this-is_my_script-01",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
workers.ScriptDeploymentGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployment.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"source": "api",
"strategy": "percentage",
"versions": [
{
"percentage": 100,
"version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
],
"annotations": {
"workers/message": "Deploy bug fix.",
"workers/triggered_by": "deployment"
},
"author_email": "dev@stainless.com"
},
"success": true
}
```
## Delete Deployment
`client.Workers.Scripts.Deployments.Delete(ctx, scriptName, deploymentID, body) (*ScriptDeploymentDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}`
Delete a Worker Deployment. The latest deployment, which is actively serving traffic, cannot be deleted. All other deployments can be deleted.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `deploymentID string`
- `body ScriptDeploymentDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptDeploymentDeleteResponse struct{…}`
- `Errors []ScriptDeploymentDeleteResponseError`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptDeploymentDeleteResponseErrorsSource`
- `Pointer string`
- `Messages []ScriptDeploymentDeleteResponseMessage`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source ScriptDeploymentDeleteResponseMessagesSource`
- `Pointer string`
- `Success ScriptDeploymentDeleteResponseSuccess`
Whether the API call was successful.
- `const ScriptDeploymentDeleteResponseSuccessTrue ScriptDeploymentDeleteResponseSuccess = true`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
deployment, err := client.Workers.Scripts.Deployments.Delete(
context.TODO(),
"this-is_my_script-01",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
workers.ScriptDeploymentDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deployment.Errors)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true
}
```
## Domain Types
### Deployment
- `type Deployment struct{…}`
- `ID string`
- `CreatedOn Time`
- `Source string`
- `Strategy DeploymentStrategy`
- `const DeploymentStrategyPercentage DeploymentStrategy = "percentage"`
- `Versions []DeploymentVersion`
- `Percentage float64`
- `VersionID string`
- `Annotations DeploymentAnnotations`
- `WorkersMessage string`
Human-readable message about the deployment. Truncated to 100 bytes.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the deployment.
- `AuthorEmail string`
# Versions
## List Versions
`client.Workers.Scripts.Versions.List(ctx, scriptName, params) (*V4PagePagination[ScriptVersionListResponse], error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/versions`
List of Worker Versions. The first version in the list is the latest version.
### Parameters
- `scriptName string`
Name of the script.
- `params ScriptVersionListParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Deployable param.Field[bool]`
Query param: Only return versions that can be used in a deployment. Ignores pagination.
- `Page param.Field[int64]`
Query param: Current page.
- `PerPage param.Field[int64]`
Query param: Items per-page.
### Returns
- `type ScriptVersionListResponse struct{…}`
- `ID string`
Unique identifier for the version.
- `Metadata ScriptVersionListResponseMetadata`
- `AuthorEmail string`
Email of the user who created the version.
- `AuthorID string`
Identifier of the user who created the version.
- `CreatedOn string`
When the version was created.
- `HasPreview bool`
Whether the version can be previewed.
- `ModifiedOn string`
When the version was last modified.
- `Source ScriptVersionListResponseMetadataSource`
The source of the version upload.
- `const ScriptVersionListResponseMetadataSourceUnknown ScriptVersionListResponseMetadataSource = "unknown"`
- `const ScriptVersionListResponseMetadataSourceAPI ScriptVersionListResponseMetadataSource = "api"`
- `const ScriptVersionListResponseMetadataSourceWrangler ScriptVersionListResponseMetadataSource = "wrangler"`
- `const ScriptVersionListResponseMetadataSourceTerraform ScriptVersionListResponseMetadataSource = "terraform"`
- `const ScriptVersionListResponseMetadataSourceDash ScriptVersionListResponseMetadataSource = "dash"`
- `const ScriptVersionListResponseMetadataSourceDashTemplate ScriptVersionListResponseMetadataSource = "dash_template"`
- `const ScriptVersionListResponseMetadataSourceIntegration ScriptVersionListResponseMetadataSource = "integration"`
- `const ScriptVersionListResponseMetadataSourceQuickEditor ScriptVersionListResponseMetadataSource = "quick_editor"`
- `const ScriptVersionListResponseMetadataSourcePlayground ScriptVersionListResponseMetadataSource = "playground"`
- `const ScriptVersionListResponseMetadataSourceWorkersci ScriptVersionListResponseMetadataSource = "workersci"`
- `Number float64`
Sequential version number.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
page, err := client.Workers.Scripts.Versions.List(
context.TODO(),
"this-is_my_script-01",
workers.ScriptVersionListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"items": [
{
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1
}
]
},
"success": true
}
```
## Get Version Detail
`client.Workers.Scripts.Versions.Get(ctx, scriptName, versionID, query) (*ScriptVersionGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}`
Retrieves detailed information about a specific version of a Workers script.
### Parameters
- `scriptName string`
Name of the script.
- `versionID string`
- `query ScriptVersionGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptVersionGetResponse struct{…}`
- `Resources ScriptVersionGetResponseResources`
- `Bindings []ScriptVersionGetResponseResourcesBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAITypeAI ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchTypeAISearch ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssetsTypeAssets ScriptVersionGetResponseResourcesBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowserTypeBrowser ScriptVersionGetResponseResourcesBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1TypeD1 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptVersionGetResponseResourcesBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInheritTypeInherit ScriptVersionGetResponseResourcesBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImagesTypeImages ScriptVersionGetResponseResourcesBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJsonTypeJson ScriptVersionGetResponseResourcesBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptVersionGetResponseResourcesBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMediaTypeMedia ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptVersionGetResponseResourcesBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainTextTypePlainText ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelinesTypePipelines ScriptVersionGetResponseResourcesBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueueTypeQueue ScriptVersionGetResponseResourcesBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptVersionGetResponseResourcesBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptVersionGetResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretTextTypeSecretText ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindServiceTypeService ScriptVersionGetResponseResourcesBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptVersionGetResponseResourcesBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorizeTypeVectorize ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatRaw ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatSpki ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormatJwk ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageSign ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageVerify ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptVersionGetResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptVersionGetResponseResourcesBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptVersionGetResponseResourcesBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `Script ScriptVersionGetResponseResourcesScript`
- `Etag string`
Hashed script content
- `Handlers []string`
The names of handlers exported as part of the default export.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `NamedHandlers []ScriptVersionGetResponseResourcesScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the exported class or entrypoint.
- `ScriptRuntime ScriptVersionGetResponseResourcesScriptRuntime`
Runtime configuration for the Worker.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime.
- `Limits ScriptVersionGetResponseResourcesScriptRuntimeLimits`
Resource limits for the Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `UsageModel ScriptVersionGetResponseResourcesScriptRuntimeUsageModel`
Usage model for the Worker invocations.
- `const ScriptVersionGetResponseResourcesScriptRuntimeUsageModelBundled ScriptVersionGetResponseResourcesScriptRuntimeUsageModel = "bundled"`
- `const ScriptVersionGetResponseResourcesScriptRuntimeUsageModelUnbound ScriptVersionGetResponseResourcesScriptRuntimeUsageModel = "unbound"`
- `const ScriptVersionGetResponseResourcesScriptRuntimeUsageModelStandard ScriptVersionGetResponseResourcesScriptRuntimeUsageModel = "standard"`
- `ID string`
Unique identifier for the version.
- `Metadata ScriptVersionGetResponseMetadata`
- `AuthorEmail string`
Email of the user who created the version.
- `AuthorID string`
Identifier of the user who created the version.
- `CreatedOn string`
When the version was created.
- `HasPreview bool`
Whether the version can be previewed.
- `ModifiedOn string`
When the version was last modified.
- `Source ScriptVersionGetResponseMetadataSource`
The source of the version upload.
- `const ScriptVersionGetResponseMetadataSourceUnknown ScriptVersionGetResponseMetadataSource = "unknown"`
- `const ScriptVersionGetResponseMetadataSourceAPI ScriptVersionGetResponseMetadataSource = "api"`
- `const ScriptVersionGetResponseMetadataSourceWrangler ScriptVersionGetResponseMetadataSource = "wrangler"`
- `const ScriptVersionGetResponseMetadataSourceTerraform ScriptVersionGetResponseMetadataSource = "terraform"`
- `const ScriptVersionGetResponseMetadataSourceDash ScriptVersionGetResponseMetadataSource = "dash"`
- `const ScriptVersionGetResponseMetadataSourceDashTemplate ScriptVersionGetResponseMetadataSource = "dash_template"`
- `const ScriptVersionGetResponseMetadataSourceIntegration ScriptVersionGetResponseMetadataSource = "integration"`
- `const ScriptVersionGetResponseMetadataSourceQuickEditor ScriptVersionGetResponseMetadataSource = "quick_editor"`
- `const ScriptVersionGetResponseMetadataSourcePlayground ScriptVersionGetResponseMetadataSource = "playground"`
- `const ScriptVersionGetResponseMetadataSourceWorkersci ScriptVersionGetResponseMetadataSource = "workersci"`
- `Number float64`
Sequential version number.
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
version, err := client.Workers.Scripts.Versions.Get(
context.TODO(),
"this-is_my_script-01",
"bcf48806-b317-4351-9ee7-36e7d557d4de",
workers.ScriptVersionGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", version.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"resources": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"script": {
"etag": "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794",
"handlers": [
"fetch"
],
"last_deployed_from": "api",
"named_handlers": [
{
"handlers": [
"fetch"
],
"name": "MyClass"
}
]
},
"script_runtime": {
"compatibility_date": "2022-11-08",
"compatibility_flags": [
"x"
],
"limits": {
"cpu_ms": 50
},
"migration_tag": "v1",
"usage_model": "standard"
}
},
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1
},
"success": true
}
```
## Upload Version
`client.Workers.Scripts.Versions.New(ctx, scriptName, params) (*ScriptVersionNewResponse, error)`
**post** `/accounts/{account_id}/workers/scripts/{script_name}/versions`
Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.
### Parameters
- `scriptName string`
Name of the script.
- `params ScriptVersionNewParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Metadata param.Field[ScriptVersionNewParamsMetadata]`
Body param: JSON-encoded metadata about the uploaded parts and Worker configuration.
- `MainModule string`
Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker, which is required for Version Upload.
- `Annotations ScriptVersionNewParamsMetadataAnnotations`
- `WorkersAlias string`
Associated alias for a version.
- `WorkersMessage string`
Human-readable message about the version. Truncated to 100 bytes.
- `WorkersTag string`
User-provided identifier for the version.
- `Bindings []ScriptVersionNewParamsMetadataBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAITypeAI ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchTypeAISearch ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssetsTypeAssets ScriptVersionNewParamsMetadataBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowserTypeBrowser ScriptVersionNewParamsMetadataBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1TypeD1 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptVersionNewParamsMetadataBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInheritTypeInherit ScriptVersionNewParamsMetadataBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImagesTypeImages ScriptVersionNewParamsMetadataBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJsonTypeJson ScriptVersionNewParamsMetadataBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptVersionNewParamsMetadataBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMediaTypeMedia ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptVersionNewParamsMetadataBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainTextTypePlainText ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelinesTypePipelines ScriptVersionNewParamsMetadataBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueueTypeQueue ScriptVersionNewParamsMetadataBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptVersionNewParamsMetadataBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptVersionNewParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretTextTypeSecretText ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindServiceTypeService ScriptVersionNewParamsMetadataBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptVersionNewParamsMetadataBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorizeTypeVectorize ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatRaw ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatSpki ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormatJwk ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageSign ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageVerify ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptVersionNewParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptVersionNewParamsMetadataBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptVersionNewParamsMetadataBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `KeepBindings []string`
List of binding types to keep from previous_upload.
- `UsageModel ScriptVersionNewParamsMetadataUsageModel`
Usage model for the Worker invocations.
- `const ScriptVersionNewParamsMetadataUsageModelStandard ScriptVersionNewParamsMetadataUsageModel = "standard"`
- `const ScriptVersionNewParamsMetadataUsageModelBundled ScriptVersionNewParamsMetadataUsageModel = "bundled"`
- `const ScriptVersionNewParamsMetadataUsageModelUnbound ScriptVersionNewParamsMetadataUsageModel = "unbound"`
- `BindingsInherit param.Field[ScriptVersionNewParamsBindingsInherit]`
Query param: When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the Worker. Without this, unresolvable inherit bindings are silently dropped.
- `const ScriptVersionNewParamsBindingsInheritStrict ScriptVersionNewParamsBindingsInherit = "strict"`
- `Files param.Field[[]Reader]`
Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.
### Returns
- `type ScriptVersionNewResponse struct{…}`
- `Resources ScriptVersionNewResponseResources`
- `Bindings []ScriptVersionNewResponseResourcesBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAITypeAI ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchTypeAISearch ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssetsTypeAssets ScriptVersionNewResponseResourcesBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowserTypeBrowser ScriptVersionNewResponseResourcesBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1TypeD1 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptVersionNewResponseResourcesBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInheritTypeInherit ScriptVersionNewResponseResourcesBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImagesTypeImages ScriptVersionNewResponseResourcesBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJsonTypeJson ScriptVersionNewResponseResourcesBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptVersionNewResponseResourcesBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMediaTypeMedia ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptVersionNewResponseResourcesBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainTextTypePlainText ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelinesTypePipelines ScriptVersionNewResponseResourcesBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueueTypeQueue ScriptVersionNewResponseResourcesBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptVersionNewResponseResourcesBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptVersionNewResponseResourcesBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretTextTypeSecretText ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindServiceTypeService ScriptVersionNewResponseResourcesBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptVersionNewResponseResourcesBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorizeTypeVectorize ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatRaw ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatSpki ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormatJwk ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageSign ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageVerify ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptVersionNewResponseResourcesBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptVersionNewResponseResourcesBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptVersionNewResponseResourcesBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `Script ScriptVersionNewResponseResourcesScript`
- `Etag string`
Hashed script content
- `Handlers []string`
The names of handlers exported as part of the default export.
- `LastDeployedFrom string`
The client most recently used to deploy this Worker.
- `NamedHandlers []ScriptVersionNewResponseResourcesScriptNamedHandler`
Named exports, such as Durable Object class implementations and named entrypoints.
- `Handlers []string`
The names of handlers exported as part of the named export.
- `Name string`
The name of the exported class or entrypoint.
- `ScriptRuntime ScriptVersionNewResponseResourcesScriptRuntime`
Runtime configuration for the Worker.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime.
- `Limits ScriptVersionNewResponseResourcesScriptRuntimeLimits`
Resource limits for the Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `MigrationTag string`
The tag of the Durable Object migration that was most recently applied for this Worker.
- `UsageModel ScriptVersionNewResponseResourcesScriptRuntimeUsageModel`
Usage model for the Worker invocations.
- `const ScriptVersionNewResponseResourcesScriptRuntimeUsageModelBundled ScriptVersionNewResponseResourcesScriptRuntimeUsageModel = "bundled"`
- `const ScriptVersionNewResponseResourcesScriptRuntimeUsageModelUnbound ScriptVersionNewResponseResourcesScriptRuntimeUsageModel = "unbound"`
- `const ScriptVersionNewResponseResourcesScriptRuntimeUsageModelStandard ScriptVersionNewResponseResourcesScriptRuntimeUsageModel = "standard"`
- `ID string`
Unique identifier for the version.
- `Metadata ScriptVersionNewResponseMetadata`
- `AuthorEmail string`
Email of the user who created the version.
- `AuthorID string`
Identifier of the user who created the version.
- `CreatedOn string`
When the version was created.
- `HasPreview bool`
Whether the version can be previewed.
- `ModifiedOn string`
When the version was last modified.
- `Source ScriptVersionNewResponseMetadataSource`
The source of the version upload.
- `const ScriptVersionNewResponseMetadataSourceUnknown ScriptVersionNewResponseMetadataSource = "unknown"`
- `const ScriptVersionNewResponseMetadataSourceAPI ScriptVersionNewResponseMetadataSource = "api"`
- `const ScriptVersionNewResponseMetadataSourceWrangler ScriptVersionNewResponseMetadataSource = "wrangler"`
- `const ScriptVersionNewResponseMetadataSourceTerraform ScriptVersionNewResponseMetadataSource = "terraform"`
- `const ScriptVersionNewResponseMetadataSourceDash ScriptVersionNewResponseMetadataSource = "dash"`
- `const ScriptVersionNewResponseMetadataSourceDashTemplate ScriptVersionNewResponseMetadataSource = "dash_template"`
- `const ScriptVersionNewResponseMetadataSourceIntegration ScriptVersionNewResponseMetadataSource = "integration"`
- `const ScriptVersionNewResponseMetadataSourceQuickEditor ScriptVersionNewResponseMetadataSource = "quick_editor"`
- `const ScriptVersionNewResponseMetadataSourcePlayground ScriptVersionNewResponseMetadataSource = "playground"`
- `const ScriptVersionNewResponseMetadataSourceWorkersci ScriptVersionNewResponseMetadataSource = "workersci"`
- `Number float64`
Sequential version number.
- `StartupTimeMs int64`
Time in milliseconds spent on [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time).
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
version, err := client.Workers.Scripts.Versions.New(
context.TODO(),
"this-is_my_script-01",
workers.ScriptVersionNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Metadata: cloudflare.F(workers.ScriptVersionNewParamsMetadata{
MainModule: cloudflare.F("worker.js"),
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", version.ID)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"resources": {
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"script": {
"etag": "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794",
"handlers": [
"fetch"
],
"last_deployed_from": "api",
"named_handlers": [
{
"handlers": [
"fetch"
],
"name": "MyClass"
}
]
},
"script_runtime": {
"compatibility_date": "2022-11-08",
"compatibility_flags": [
"x"
],
"limits": {
"cpu_ms": 50
},
"migration_tag": "v1",
"usage_model": "standard"
}
},
"id": "18f97339-c287-4872-9bdd-e2135c07ec12",
"metadata": {
"author_email": "user@example.com",
"author_id": "408cbcdfd4dda4617efef40b04d168a1",
"created_on": "2022-11-08T17:19:29.176266Z",
"hasPreview": true,
"modified_on": "2022-11-08T17:19:29.176266Z",
"source": "api"
},
"number": 1,
"startup_time_ms": 10
},
"success": true
}
```
# Secrets
## List script secrets
`client.Workers.Scripts.Secrets.List(ctx, scriptName, query) (*SinglePage[ScriptSecretListResponse], error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/secrets`
List secrets bound to a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptSecretListParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptSecretListResponse interface{…}`
A secret value accessible through a binding.
- `type ScriptSecretListResponseWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptSecretListResponseWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptSecretListResponseWorkersBindingKindSecretTextTypeSecretText ScriptSecretListResponseWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptSecretListResponseWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptSecretListResponseWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatRaw ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatPkcs8 ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatSpki ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyFormatJwk ScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptSecretListResponseWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyTypeSecretKey ScriptSecretListResponseWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptSecretListResponseWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageEncrypt ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageDecrypt ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageSign ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageVerify ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageDeriveKey ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageDeriveBits ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageWrapKey ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptSecretListResponseWorkersBindingKindSecretKeyUsageUnwrapKey ScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
page, err := client.Workers.Scripts.Secrets.List(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSecretListParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": [
{
"name": "myBinding",
"type": "secret_text"
}
]
}
```
## Get secret binding
`client.Workers.Scripts.Secrets.Get(ctx, scriptName, secretName, params) (*ScriptSecretGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}`
Get a given secret binding (value omitted) on a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `secretName string`
A JavaScript variable name for the secret binding.
- `params ScriptSecretGetParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `URLEncoded param.Field[bool]`
Query param: Flag that indicates whether the secret name is URL encoded.
### Returns
- `type ScriptSecretGetResponse interface{…}`
A secret value accessible through a binding.
- `type ScriptSecretGetResponseWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptSecretGetResponseWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptSecretGetResponseWorkersBindingKindSecretTextTypeSecretText ScriptSecretGetResponseWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptSecretGetResponseWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatRaw ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatPkcs8 ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatSpki ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyFormatJwk ScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptSecretGetResponseWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyTypeSecretKey ScriptSecretGetResponseWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageEncrypt ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDecrypt ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageSign ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageVerify ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDeriveKey ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDeriveBits ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageWrapKey ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptSecretGetResponseWorkersBindingKindSecretKeyUsageUnwrapKey ScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
secret, err := client.Workers.Scripts.Secrets.Get(
context.TODO(),
"this-is_my_script-01",
"mySecret",
workers.ScriptSecretGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"name": "myBinding",
"type": "secret_text"
}
}
```
## Add script secret
`client.Workers.Scripts.Secrets.Update(ctx, scriptName, params) (*ScriptSecretUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/scripts/{script_name}/secrets`
Add a secret to a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptSecretUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Name param.Field[string]`
Body param: A JavaScript variable name for the binding.
- `Text param.Field[string]`
Body param: The secret value to use.
- `Type param.Field[ScriptSecretUpdateParamsWorkersBindingKindSecretTextType]`
Body param: The kind of resource that the binding provides.
- `const ScriptSecretUpdateParamsWorkersBindingKindSecretTextTypeSecretText ScriptSecretUpdateParamsWorkersBindingKindSecretTextType = "secret_text"`
### Returns
- `type ScriptSecretUpdateResponse interface{…}`
A secret value accessible through a binding.
- `type ScriptSecretUpdateResponseWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptSecretUpdateResponseWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretTextTypeSecretText ScriptSecretUpdateResponseWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptSecretUpdateResponseWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatRaw ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatPkcs8 ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatSpki ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatJwk ScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptSecretUpdateResponseWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyTypeSecretKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageEncrypt ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDecrypt ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageSign ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageVerify ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDeriveKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDeriveBits ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageWrapKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageUnwrapKey ScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
secret, err := client.Workers.Scripts.Secrets.Update(
context.TODO(),
"this-is_my_script-01",
workers.ScriptSecretUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: workers.ScriptSecretUpdateParamsBodyWorkersBindingKindSecretText{
Name: cloudflare.F("myBinding"),
Text: cloudflare.F("My secret."),
Type: cloudflare.F(workers.ScriptSecretUpdateParamsBodyWorkersBindingKindSecretTextTypeSecretText),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"name": "myBinding",
"type": "secret_text"
}
}
```
## Delete script secret
`client.Workers.Scripts.Secrets.Delete(ctx, scriptName, secretName, params) (*ScriptSecretDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}`
Remove a secret from a script.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `secretName string`
A JavaScript variable name for the secret binding.
- `params ScriptSecretDeleteParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `URLEncoded param.Field[bool]`
Query param: Flag that indicates whether the secret name is URL encoded.
### Returns
- `type ScriptSecretDeleteResponse interface{…}`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
secret, err := client.Workers.Scripts.Secrets.Delete(
context.TODO(),
"this-is_my_script-01",
"mySecret",
workers.ScriptSecretDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {}
}
```
# Script And Version Settings
## Get Settings
`client.Workers.Scripts.ScriptAndVersionSettings.Get(ctx, scriptName, query) (*ScriptScriptAndVersionSettingGetResponse, error)`
**get** `/accounts/{account_id}/workers/scripts/{script_name}/settings`
Get metadata and config, such as bindings or usage model.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `query ScriptScriptAndVersionSettingGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type ScriptScriptAndVersionSettingGetResponse struct{…}`
- `Annotations ScriptScriptAndVersionSettingGetResponseAnnotations`
Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `Bindings []ScriptScriptAndVersionSettingGetResponseBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAITypeAI ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchTypeAISearch ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssetsTypeAssets ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowserTypeBrowser ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1TypeD1 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInheritTypeInherit ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImagesTypeImages ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJsonTypeJson ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMediaTypeMedia ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainTextTypePlainText ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelinesTypePipelines ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueueTypeQueue ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretTextTypeSecretText ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindServiceTypeService ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorizeTypeVectorize ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatRaw ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatSpki ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatJwk ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageSign ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageVerify ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptScriptAndVersionSettingGetResponseBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `Limits ScriptScriptAndVersionSettingGetResponseLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Migrations ScriptScriptAndVersionSettingGetResponseMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptScriptAndVersionSettingGetResponseMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptScriptAndVersionSettingGetResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptScriptAndVersionSettingGetResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptScriptAndVersionSettingGetResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptScriptAndVersionSettingGetResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptScriptAndVersionSettingGetResponsePlacementMode struct{…}`
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementModeMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptScriptAndVersionSettingGetResponsePlacementModeModeSmart ScriptScriptAndVersionSettingGetResponsePlacementModeMode = "smart"`
- `type ScriptScriptAndVersionSettingGetResponsePlacementRegion struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingGetResponsePlacementHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingGetResponsePlacementHost struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingGetResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingGetResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingGetResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingGetResponsePlacementObjectMode = "targeted"`
- `Target []ScriptScriptAndVersionSettingGetResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptScriptAndVersionSettingGetResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingGetResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptScriptAndVersionSettingGetResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptScriptAndVersionSettingGetResponseUsageModelStandard ScriptScriptAndVersionSettingGetResponseUsageModel = "standard"`
- `const ScriptScriptAndVersionSettingGetResponseUsageModelBundled ScriptScriptAndVersionSettingGetResponseUsageModel = "bundled"`
- `const ScriptScriptAndVersionSettingGetResponseUsageModelUnbound ScriptScriptAndVersionSettingGetResponseUsageModel = "unbound"`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
scriptAndVersionSetting, err := client.Workers.Scripts.ScriptAndVersionSettings.Get(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScriptAndVersionSettingGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scriptAndVersionSetting.Annotations)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
## Patch Settings
`client.Workers.Scripts.ScriptAndVersionSettings.Edit(ctx, scriptName, params) (*ScriptScriptAndVersionSettingEditResponse, error)`
**patch** `/accounts/{account_id}/workers/scripts/{script_name}/settings`
Patch metadata or config, such as bindings or usage model.
### Parameters
- `scriptName string`
Name of the script, used in URLs and route configuration.
- `params ScriptScriptAndVersionSettingEditParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Settings param.Field[ScriptScriptAndVersionSettingEditParamsSettings]`
Body param
- `Annotations ScriptScriptAndVersionSettingEditParamsSettingsAnnotations`
Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `Bindings []ScriptScriptAndVersionSettingEditParamsSettingsBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAITypeAI ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchTypeAISearch ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsTypeAssets ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserTypeBrowser ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1TypeD1 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritTypeInherit ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesTypeImages ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJsonTypeJson ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaTypeMedia ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextTypePlainText ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesTypePipelines ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueueTypeQueue ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextTypeSecretText ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindServiceTypeService ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeTypeVectorize ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatRaw ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatSpki ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatJwk ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageSign ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageVerify ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptScriptAndVersionSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `Limits ScriptScriptAndVersionSettingEditParamsSettingsLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Migrations ScriptScriptAndVersionSettingEditParamsSettingsMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptScriptAndVersionSettingEditParamsSettingsMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptScriptAndVersionSettingEditParamsSettingsObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptScriptAndVersionSettingEditParamsSettingsObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptScriptAndVersionSettingEditParamsSettingsObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptScriptAndVersionSettingEditParamsSettingsPlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementMode struct{…}`
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementModeMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementModeModeSmart ScriptScriptAndVersionSettingEditParamsSettingsPlacementModeMode = "smart"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementRegion struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementHost struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectModeTargeted ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectMode = "targeted"`
- `Target []ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditParamsSettingsPlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptScriptAndVersionSettingEditParamsSettingsUsageModel`
Usage model for the Worker invocations.
- `const ScriptScriptAndVersionSettingEditParamsSettingsUsageModelStandard ScriptScriptAndVersionSettingEditParamsSettingsUsageModel = "standard"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsUsageModelBundled ScriptScriptAndVersionSettingEditParamsSettingsUsageModel = "bundled"`
- `const ScriptScriptAndVersionSettingEditParamsSettingsUsageModelUnbound ScriptScriptAndVersionSettingEditParamsSettingsUsageModel = "unbound"`
### Returns
- `type ScriptScriptAndVersionSettingEditResponse struct{…}`
- `Annotations ScriptScriptAndVersionSettingEditResponseAnnotations`
Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
- `WorkersMessage string`
Human-readable message about the version.
- `WorkersTag string`
User-provided identifier for the version.
- `WorkersTriggeredBy string`
Operation that triggered the creation of the version. This is read-only and set by the server.
- `Bindings []ScriptScriptAndVersionSettingEditResponseBinding`
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAI struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAIType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAITypeAI ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAIType = "ai"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearch struct{…}`
- `InstanceName string`
The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchTypeAISearch ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchType = "ai_search"`
- `Namespace string`
The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngine struct{…}`
- `Dataset string`
The name of the dataset to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssets struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssetsType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssetsTypeAssets ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindAssetsType = "assets"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowser struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowserType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowserTypeBrowser ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindBrowserType = "browser"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1 struct{…}`
- `ID string`
Identifier of the D1 database to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1Type`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1TypeD1 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindD1Type = "d1"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the data content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlobTypeDataBlob ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDataBlobType = "data_blob"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Namespace string`
The name of the dispatch namespace.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"`
- `Outbound ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutbound`
Outbound worker.
- `Params []ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParam`
Pass information from the Dispatch Worker to the Outbound Worker through the parameters.
- `Name string`
Name of the parameter.
- `Worker ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundWorker`
Outbound worker.
- `Entrypoint string`
Entrypoint to invoke on the outbound worker.
- `Environment string`
Environment of the outbound worker.
- `Service string`
Name of the outbound worker.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"`
- `ClassName string`
The exported class name of the Durable Object.
- `DispatchNamespace string`
The dispatch namespace the Durable Object script belongs to.
- `Environment string`
The environment of the script_name to bind to.
- `NamespaceID string`
Namespace identifier tag.
- `ScriptName string`
The script where the Durable Object is defined, if it is external to this Worker.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdrive struct{…}`
- `ID string`
Identifier of the Hyperdrive connection to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdriveType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdriveTypeHyperdrive ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindHyperdriveType = "hyperdrive"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInherit struct{…}`
- `Name string`
The name of the inherited binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInheritType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInheritTypeInherit ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindInheritType = "inherit"`
- `OldName string`
The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions.
- `VersionID string`
Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImages struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImagesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImagesTypeImages ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindImagesType = "images"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJson struct{…}`
- `Json unknown`
JSON data to use.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJsonType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJsonTypeJson ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindJsonType = "json"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespace struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Namespace identifier tag.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespaceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespaceTypeKVNamespace ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMedia struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMediaType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMediaTypeMedia ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMediaType = "media"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificate struct{…}`
- `CertificateID string`
Identifier of the certificate to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificateType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The text value to use.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainTextTypePlainText ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPlainTextType = "plain_text"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelines struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Pipeline string`
Name of the Pipeline to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelinesType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelinesTypePipelines ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindPipelinesType = "pipelines"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueue struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `QueueName string`
Name of the Queue to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueueType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueueTypeQueue ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindQueueType = "queue"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimit struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `NamespaceID string`
Identifier of the rate limit namespace to bind to.
- `Simple ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitSimple`
The rate limit configuration.
- `Limit float64`
The limit (requests per period).
- `Period int64`
The period in seconds.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitTypeRatelimit ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindRatelimitType = "ratelimit"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2Bucket struct{…}`
- `BucketName string`
R2 bucket to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketTypeR2Bucket ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketType = "r2_bucket"`
- `Jurisdiction ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction`
The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionEu ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "eu"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionFedramp ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretText struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Text string`
The secret value to use.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretTextType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretTextTypeSecretText ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretTextType = "secret_text"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmail struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmailType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmailTypeSendEmail ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSendEmailType = "send_email"`
- `AllowedDestinationAddresses []string`
List of allowed destination addresses.
- `AllowedSenderAddresses []string`
List of allowed sender addresses.
- `DestinationAddress string`
Destination address for the email.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Service string`
Name of Worker to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindServiceTypeService ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindServiceType = "service"`
- `Entrypoint string`
Entrypoint to invoke on the target Worker.
- `Environment string`
Optional environment if the Worker utilizes one.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlob struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the text content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlobType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlobTypeTextBlob ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindTextBlobType = "text_blob"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorize struct{…}`
- `IndexName string`
Name of the Vectorize index to bind to.
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorizeType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorizeTypeVectorize ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVectorizeType = "vectorize"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadata struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadataType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVersionMetadataType = "version_metadata"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecret struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `SecretName string`
Name of the secret in the store.
- `StoreID string`
ID of the store containing the secret.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKey struct{…}`
- `Algorithm unknown`
Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
- `Format ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat`
Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatRaw ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "raw"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatPkcs8 ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatSpki ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "spki"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatJwk ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "jwk"`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyTypeSecretKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyType = "secret_key"`
- `Usages []ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage`
Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageEncrypt ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "encrypt"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDecrypt ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "decrypt"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageSign ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "sign"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageVerify ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "verify"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDeriveKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDeriveBits ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageWrapKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"`
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageUnwrapKey ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"`
- `KeyBase64 string`
Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".
- `KeyJwk unknown`
Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk".
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflow struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflowType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflowTypeWorkflow ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWorkflowType = "workflow"`
- `WorkflowName string`
Name of the Workflow to bind to.
- `ClassName string`
Class name of the Workflow. Should only be provided if the Workflow belongs to this script.
- `ScriptName string`
Script name that contains the Workflow. If not provided, defaults to this script name.
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModule struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Part string`
The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModuleType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModuleTypeWasmModule ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindWasmModuleType = "wasm_module"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCService struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `ServiceID string`
Identifier of the VPC service to bind to.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCServiceType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCServiceTypeVPCService ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCServiceType = "vpc_service"`
- `type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetwork struct{…}`
- `Name string`
A JavaScript variable name for the binding.
- `Type ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetworkType`
The kind of resource that the binding provides.
- `const ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork ScriptScriptAndVersionSettingEditResponseBindingsWorkersBindingKindVPCNetworkType = "vpc_network"`
- `NetworkID string`
Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
- `TunnelID string`
UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.
- `CompatibilityDate string`
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- `CompatibilityFlags []string`
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
- `Limits ScriptScriptAndVersionSettingEditResponseLimits`
Limits to apply for this Worker.
- `CPUMs int64`
The amount of CPU time this Worker can use in milliseconds.
- `Logpush bool`
Whether Logpush is turned on for the Worker.
- `Migrations ScriptScriptAndVersionSettingEditResponseMigrations`
Migrations to apply for Durable Objects associated with this Worker.
- `type SingleStepMigration struct{…}`
A single set of migrations to apply.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `RenamedClasses []SingleStepMigrationRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []SingleStepMigrationTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `type ScriptScriptAndVersionSettingEditResponseMigrationsWorkersMultipleStepMigrations struct{…}`
- `NewTag string`
Tag to set as the latest migration tag.
- `OldTag string`
Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected.
- `Steps []MigrationStep`
Migrations to apply in order.
- `DeletedClasses []string`
A list of classes to delete Durable Object namespaces from.
- `NewClasses []string`
A list of classes to create Durable Object namespaces from.
- `NewSqliteClasses []string`
A list of classes to create Durable Object namespaces with SQLite from.
- `RenamedClasses []MigrationStepRenamedClass`
A list of classes with Durable Object namespaces that were renamed.
- `From string`
- `To string`
- `TransferredClasses []MigrationStepTransferredClass`
A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.
- `From string`
- `FromScript string`
- `To string`
- `Observability ScriptScriptAndVersionSettingEditResponseObservability`
Observability settings for the Worker.
- `Enabled bool`
Whether observability is enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Logs ScriptScriptAndVersionSettingEditResponseObservabilityLogs`
Log settings for the Worker.
- `Enabled bool`
Whether logs are enabled for the Worker.
- `InvocationLogs bool`
Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker.
- `Destinations []string`
A list of destinations where logs will be exported to.
- `HeadSamplingRate float64`
The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether log persistence is enabled for the Worker.
- `Traces ScriptScriptAndVersionSettingEditResponseObservabilityTraces`
Trace settings for the Worker.
- `Destinations []string`
A list of destinations where traces will be exported to.
- `Enabled bool`
Whether traces are enabled for the Worker.
- `HeadSamplingRate float64`
The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
- `Persist bool`
Whether trace persistence is enabled for the Worker.
- `Placement ScriptScriptAndVersionSettingEditResponsePlacement`
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
- `type ScriptScriptAndVersionSettingEditResponsePlacementMode struct{…}`
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementModeMode`
Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- `const ScriptScriptAndVersionSettingEditResponsePlacementModeModeSmart ScriptScriptAndVersionSettingEditResponsePlacementModeMode = "smart"`
- `type ScriptScriptAndVersionSettingEditResponsePlacementRegion struct{…}`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditResponsePlacementHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditResponsePlacementHost struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `Region string`
Cloud region for targeted placement in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Host string`
TCP host and port for targeted placement.
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `type ScriptScriptAndVersionSettingEditResponsePlacementObject struct{…}`
- `Mode ScriptScriptAndVersionSettingEditResponsePlacementObjectMode`
Targeted placement mode.
- `const ScriptScriptAndVersionSettingEditResponsePlacementObjectModeTargeted ScriptScriptAndVersionSettingEditResponsePlacementObjectMode = "targeted"`
- `Target []ScriptScriptAndVersionSettingEditResponsePlacementObjectTarget`
Array of placement targets (currently limited to single target).
- `type ScriptScriptAndVersionSettingEditResponsePlacementObjectTargetRegion struct{…}`
- `Region string`
Cloud region in format 'provider:region'.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObjectTargetHostname struct{…}`
- `Hostname string`
HTTP hostname for targeted placement.
- `type ScriptScriptAndVersionSettingEditResponsePlacementObjectTargetHost struct{…}`
- `Host string`
TCP host:port for targeted placement.
- `Tags []string`
Tags associated with the Worker.
- `TailConsumers []ConsumerScript`
List of Workers that will consume logs from the attached Worker.
- `Service string`
Name of Worker that is to be the consumer.
- `Environment string`
Optional environment if the Worker utilizes one.
- `Namespace string`
Optional dispatch namespace the script belongs to.
- `UsageModel ScriptScriptAndVersionSettingEditResponseUsageModel`
Usage model for the Worker invocations.
- `const ScriptScriptAndVersionSettingEditResponseUsageModelStandard ScriptScriptAndVersionSettingEditResponseUsageModel = "standard"`
- `const ScriptScriptAndVersionSettingEditResponseUsageModelBundled ScriptScriptAndVersionSettingEditResponseUsageModel = "bundled"`
- `const ScriptScriptAndVersionSettingEditResponseUsageModelUnbound ScriptScriptAndVersionSettingEditResponseUsageModel = "unbound"`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.Workers.Scripts.ScriptAndVersionSettings.Edit(
context.TODO(),
"this-is_my_script-01",
workers.ScriptScriptAndVersionSettingEditParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Annotations)
}
```
#### Response
```json
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"logpush": false,
"observability": {
"enabled": true,
"head_sampling_rate": 0.1,
"logs": {
"enabled": true,
"invocation_logs": true,
"destinations": [
"cloudflare"
],
"head_sampling_rate": 0.1,
"persist": true
},
"traces": {
"destinations": [
"cloudflare"
],
"enabled": true,
"head_sampling_rate": 0.1,
"persist": true
}
},
"placement": {
"mode": "smart"
},
"tags": [
"my-team",
"my-public-api"
],
"tail_consumers": [
{
"service": "my-log-consumer",
"environment": "production",
"namespace": "my-namespace"
}
],
"usage_model": "standard"
},
"success": true
}
```
# Account Settings
## Fetch Worker Account Settings
`client.Workers.AccountSettings.Get(ctx, query) (*AccountSettingGetResponse, error)`
**get** `/accounts/{account_id}/workers/account-settings`
Fetches Worker account settings for an account.
### Parameters
- `query AccountSettingGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type AccountSettingGetResponse struct{…}`
- `DefaultUsageModel string`
- `GreenCompute bool`
### 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"),
)
accountSetting, err := client.Workers.AccountSettings.Get(context.TODO(), workers.AccountSettingGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accountSetting.DefaultUsageModel)
}
```
#### 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": {
"default_usage_model": "default_usage_model",
"green_compute": true
},
"success": true
}
```
## Create Worker Account Settings
`client.Workers.AccountSettings.Update(ctx, params) (*AccountSettingUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/account-settings`
Creates Worker account settings for an account.
### Parameters
- `params AccountSettingUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `DefaultUsageModel param.Field[string]`
Body param
- `GreenCompute param.Field[bool]`
Body param
### Returns
- `type AccountSettingUpdateResponse struct{…}`
- `DefaultUsageModel string`
- `GreenCompute bool`
### 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"),
)
accountSetting, err := client.Workers.AccountSettings.Update(context.TODO(), workers.AccountSettingUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accountSetting.DefaultUsageModel)
}
```
#### 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": {
"default_usage_model": "default_usage_model",
"green_compute": true
},
"success": true
}
```
# Domains
## List Domains
`client.Workers.Domains.List(ctx, params) (*SinglePage[DomainListResponse], error)`
**get** `/accounts/{account_id}/workers/domains`
Lists all domains for an account.
### Parameters
- `params DomainListParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Environment param.Field[string]`
Query param: Worker environment associated with the domain.
- `Hostname param.Field[string]`
Query param: Hostname of the domain.
- `Service param.Field[string]`
Query param: Name of the Worker associated with the domain.
- `ZoneID param.Field[string]`
Query param: ID of the zone containing the domain hostname.
- `ZoneName param.Field[string]`
Query param: Name of the zone containing the domain hostname.
### Returns
- `type DomainListResponse struct{…}`
- `ID string`
Immutable ID of the domain.
- `CERTID string`
ID of the TLS certificate issued for the domain.
- `Environment string`
Worker environment associated with the domain.
- `Hostname string`
Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.
- `Service string`
Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.
- `ZoneID string`
ID of the zone containing the domain hostname.
- `ZoneName string`
Name of the zone containing the domain hostname.
### 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.Domains.List(context.TODO(), workers.DomainListParams{
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": "dbe10b4bc17c295377eabd600e1787fd",
"cert_id": "9fdf92c8-64c2-4a3d-b1af-e15304961145",
"environment": "production",
"hostname": "app.example.com",
"service": "my-worker",
"zone_id": "593c9c94de529bbbfaac7c53ced0447d",
"zone_name": "example.com"
}
],
"success": true,
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}
```
## Get Domain
`client.Workers.Domains.Get(ctx, domainID, query) (*DomainGetResponse, error)`
**get** `/accounts/{account_id}/workers/domains/{domain_id}`
Gets information about a domain.
### Parameters
- `domainID string`
ID of the domain.
- `query DomainGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type DomainGetResponse struct{…}`
- `ID string`
Immutable ID of the domain.
- `CERTID string`
ID of the TLS certificate issued for the domain.
- `Environment string`
Worker environment associated with the domain.
- `Hostname string`
Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.
- `Service string`
Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.
- `ZoneID string`
ID of the zone containing the domain hostname.
- `ZoneName string`
Name of the zone containing the domain hostname.
### 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"),
)
domain, err := client.Workers.Domains.Get(
context.TODO(),
"dbe10b4bc17c295377eabd600e1787fd",
workers.DomainGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", domain.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": "dbe10b4bc17c295377eabd600e1787fd",
"cert_id": "9fdf92c8-64c2-4a3d-b1af-e15304961145",
"environment": "production",
"hostname": "app.example.com",
"service": "my-worker",
"zone_id": "593c9c94de529bbbfaac7c53ced0447d",
"zone_name": "example.com"
},
"success": true
}
```
## Attach Domain
`client.Workers.Domains.Update(ctx, params) (*DomainUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/domains`
Attaches a domain that routes traffic to a Worker.
### Parameters
- `params DomainUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Hostname param.Field[string]`
Body param: Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.
- `Service param.Field[string]`
Body param: Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.
- `Environment param.Field[string]`
Body param: Worker environment associated with the domain.
- `ZoneID param.Field[string]`
Body param: ID of the zone containing the domain hostname.
- `ZoneName param.Field[string]`
Body param: Name of the zone containing the domain hostname.
### Returns
- `type DomainUpdateResponse struct{…}`
- `ID string`
Immutable ID of the domain.
- `CERTID string`
ID of the TLS certificate issued for the domain.
- `Environment string`
Worker environment associated with the domain.
- `Hostname string`
Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.
- `Service string`
Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.
- `ZoneID string`
ID of the zone containing the domain hostname.
- `ZoneName string`
Name of the zone containing the domain hostname.
### 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"),
)
domain, err := client.Workers.Domains.Update(context.TODO(), workers.DomainUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Hostname: cloudflare.F("app.example.com"),
Service: cloudflare.F("my-worker"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", domain.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": "dbe10b4bc17c295377eabd600e1787fd",
"cert_id": "9fdf92c8-64c2-4a3d-b1af-e15304961145",
"environment": "production",
"hostname": "app.example.com",
"service": "my-worker",
"zone_id": "593c9c94de529bbbfaac7c53ced0447d",
"zone_name": "example.com"
},
"success": true
}
```
## Detach Domain
`client.Workers.Domains.Delete(ctx, domainID, body) (*DomainDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/domains/{domain_id}`
Detaches a domain from a Worker. Both the Worker and all of its previews are no longer routable using this domain.
### Parameters
- `domainID string`
ID of the domain.
- `body DomainDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type DomainDeleteResponse struct{…}`
- `Errors []DomainDeleteResponseError`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source DomainDeleteResponseErrorsSource`
- `Pointer string`
- `Messages []DomainDeleteResponseMessage`
- `Code int64`
- `Message string`
- `DocumentationURL string`
- `Source DomainDeleteResponseMessagesSource`
- `Pointer string`
- `Success DomainDeleteResponseSuccess`
Whether the API call was successful.
- `const DomainDeleteResponseSuccessTrue DomainDeleteResponseSuccess = 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"),
)
domain, err := client.Workers.Domains.Delete(
context.TODO(),
"dbe10b4bc17c295377eabd600e1787fd",
workers.DomainDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", domain.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
}
```
# Subdomains
## Get Subdomain
`client.Workers.Subdomains.Get(ctx, query) (*SubdomainGetResponse, error)`
**get** `/accounts/{account_id}/workers/subdomain`
Returns a Workers subdomain for an account.
### Parameters
- `query SubdomainGetParams`
- `AccountID param.Field[string]`
Identifier.
### Returns
- `type SubdomainGetResponse struct{…}`
- `Subdomain string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
subdomain, err := client.Workers.Subdomains.Get(context.TODO(), workers.SubdomainGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Subdomain)
}
```
#### 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": {
"subdomain": "my-subdomain"
},
"success": true
}
```
## Create Subdomain
`client.Workers.Subdomains.Update(ctx, params) (*SubdomainUpdateResponse, error)`
**put** `/accounts/{account_id}/workers/subdomain`
Creates a Workers subdomain for an account.
### Parameters
- `params SubdomainUpdateParams`
- `AccountID param.Field[string]`
Path param: Identifier.
- `Subdomain param.Field[string]`
Body param
### Returns
- `type SubdomainUpdateResponse struct{…}`
- `Subdomain string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
subdomain, err := client.Workers.Subdomains.Update(context.TODO(), workers.SubdomainUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Subdomain: cloudflare.F("my-subdomain"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subdomain.Subdomain)
}
```
#### 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": {
"subdomain": "my-subdomain"
},
"success": true
}
```
## Delete Subdomain
`client.Workers.Subdomains.Delete(ctx, body) error`
**delete** `/accounts/{account_id}/workers/subdomain`
Deletes a Workers subdomain for an account.
### Parameters
- `body SubdomainDeleteParams`
- `AccountID param.Field[string]`
Identifier.
### Example
```go
package main
import (
"context"
"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"),
)
err := client.Workers.Subdomains.Delete(context.TODO(), workers.SubdomainDeleteParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
})
if err != nil {
panic(err.Error())
}
}
```
# Observability
# Telemetry
## List keys
`client.Workers.Observability.Telemetry.Keys(ctx, params) (*SinglePage[ObservabilityTelemetryKeysResponse], error)`
**post** `/accounts/{account_id}/workers/observability/telemetry/keys`
List all the keys in your telemetry events.
### Parameters
- `params ObservabilityTelemetryKeysParams`
- `AccountID param.Field[string]`
Path param: Your Cloudflare account ID.
- `Datasets param.Field[[]string]`
Body param: Leave this empty to use the default datasets
- `Filters param.Field[[]ObservabilityTelemetryKeysParamsFilter]`
Body param: Apply filters to narrow key discovery. Supports nested groups via kind: 'group'. Maximum nesting depth is 4.
- `type ObservabilityTelemetryKeysParamsFiltersObject struct{…}`
- `FilterCombination ObservabilityTelemetryKeysParamsFiltersObjectFilterCombination`
- `const ObservabilityTelemetryKeysParamsFiltersObjectFilterCombinationAnd ObservabilityTelemetryKeysParamsFiltersObjectFilterCombination = "and"`
- `const ObservabilityTelemetryKeysParamsFiltersObjectFilterCombinationOr ObservabilityTelemetryKeysParamsFiltersObjectFilterCombination = "or"`
- `const ObservabilityTelemetryKeysParamsFiltersObjectFilterCombinationAndUppercase ObservabilityTelemetryKeysParamsFiltersObjectFilterCombination = "AND"`
- `const ObservabilityTelemetryKeysParamsFiltersObjectFilterCombinationOrUppercase ObservabilityTelemetryKeysParamsFiltersObjectFilterCombination = "OR"`
- `Filters []unknown`
- `Kind ObservabilityTelemetryKeysParamsFiltersObjectKind`
- `const ObservabilityTelemetryKeysParamsFiltersObjectKindGroup ObservabilityTelemetryKeysParamsFiltersObjectKind = "group"`
- `type ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeaf struct{…}`
Filtering best practices: use observability_keys and observability_values to confirm available fields and values. If searching for errors, filter for $metadata.error exists.
- `Key string`
Filter field name. IMPORTANT: do not guess keys. Always use verified keys from previous query results or the observability_keys response. Preferred keys: $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, $metadata.error.
- `Operation ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationIncludes ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "includes"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationNotIncludes ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "not_includes"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationStartsWith ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "starts_with"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationRegex ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "regex"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationExists ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "exists"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationIsNull ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "is_null"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationIn ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "in"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationNotIn ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "not_in"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationEq ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "eq"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationNeq ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "neq"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationGt ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "gt"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationGte ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "gte"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationLt ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "lt"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationLte ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "lte"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationEquals ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "="`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationNotEquals ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "!="`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationGreater ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = ">"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationGreaterOrEquals ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = ">="`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationLess ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "<"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationLessOrEquals ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "<="`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationIncludesUppercase ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "INCLUDES"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationDoesNotInclude ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_INCLUDE"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationMatchRegex ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "MATCH_REGEX"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationExistsUppercase ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "EXISTS"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationDoesNotExist ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_EXIST"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationInUppercase ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "IN"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationNotInUppercase ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "NOT_IN"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperationStartsWithUppercase ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafOperation = "STARTS_WITH"`
- `Type ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafType`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafTypeString ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafType = "string"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafTypeNumber ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafType = "number"`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafTypeBoolean ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafType = "boolean"`
- `Kind ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafKind`
- `const ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafKindFilter ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafKind = "filter"`
- `Value ObservabilityTelemetryKeysParamsFiltersWorkersObservabilityFilterLeafValueUnion`
Filter comparison value. IMPORTANT: must match actual values in your logs. Verify using previous query results or the /values endpoint. Ensure value type matches the field type. String comparisons are case-sensitive unless using specific operations. Regex uses ClickHouse RE2 syntax (no lookaheads/lookbehinds); examples: ^5\d{2}$ for HTTP 5xx, \bERROR\b for word boundary.
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `From param.Field[float64]`
Body param
- `KeyNeedle param.Field[ObservabilityTelemetryKeysParamsKeyNeedle]`
Body param: If the user suggests a key, use this to narrow down the list of keys returned. Make sure matchCase is false to avoid case sensitivity issues.
- `Value ObservabilityTelemetryKeysParamsKeyNeedleValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `IsRegex bool`
- `MatchCase bool`
- `Limit param.Field[float64]`
Body param: Advanced usage: set limit=1000+ to retrieve comprehensive key options without needing additional filtering.
- `Needle param.Field[ObservabilityTelemetryKeysParamsNeedle]`
Body param: Search for a specific substring in any of the events
- `Value ObservabilityTelemetryKeysParamsNeedleValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `IsRegex bool`
- `MatchCase bool`
- `To param.Field[float64]`
Body param
### Returns
- `type ObservabilityTelemetryKeysResponse struct{…}`
- `Key string`
- `LastSeenAt float64`
- `Type ObservabilityTelemetryKeysResponseType`
- `const ObservabilityTelemetryKeysResponseTypeString ObservabilityTelemetryKeysResponseType = "string"`
- `const ObservabilityTelemetryKeysResponseTypeBoolean ObservabilityTelemetryKeysResponseType = "boolean"`
- `const ObservabilityTelemetryKeysResponseTypeNumber ObservabilityTelemetryKeysResponseType = "number"`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
page, err := client.Workers.Observability.Telemetry.Keys(context.TODO(), workers.ObservabilityTelemetryKeysParams{
AccountID: cloudflare.F("account_id"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Successful request"
}
],
"result": [
{
"key": "key",
"lastSeenAt": 0,
"type": "string"
}
],
"success": true
}
```
## Run a query
`client.Workers.Observability.Telemetry.Query(ctx, params) (*ObservabilityTelemetryQueryResponse, error)`
**post** `/accounts/{account_id}/workers/observability/telemetry/query`
Run a temporary or saved query.
### Parameters
- `params ObservabilityTelemetryQueryParams`
- `AccountID param.Field[string]`
Path param: Your Cloudflare account ID.
- `QueryID param.Field[string]`
Body param: Unique identifier for the query to execute
- `Timeframe param.Field[ObservabilityTelemetryQueryParamsTimeframe]`
Body param: Timeframe for your query using Unix timestamps in milliseconds. Provide from/to epoch ms; narrower timeframes provide faster responses and more specific results.
- `From float64`
Start timestamp for the query timeframe (Unix timestamp in milliseconds)
- `To float64`
End timestamp for the query timeframe (Unix timestamp in milliseconds)
- `Chart param.Field[bool]`
Body param: Whether to include timeseties data in the response
- `Compare param.Field[bool]`
Body param: Whether to include comparison data with previous time periods
- `Dry param.Field[bool]`
Body param: Whether to perform a dry run without saving the results of the query. Useful for validation
- `Granularity param.Field[float64]`
Body param: This is only used when the view is calculations. Leaving it empty lets Workers Observability detect the correct granularity.
- `IgnoreSeries param.Field[bool]`
Body param: Whether to ignore time-series data in the results and return only aggregated values
- `Limit param.Field[float64]`
Body param: Use this limit to cap the number of events returned when the view is events.
- `Offset param.Field[string]`
Body param: Cursor pagination for event/trace/invocation views. Pass the last item's $metadata.id as the next offset.
- `OffsetBy param.Field[float64]`
Body param: Numeric offset for pattern results (top-N list). Use with limit to page pattern groups; not used by cursor pagination.
- `OffsetDirection param.Field[string]`
Body param: Direction for offset-based pagination (e.g., 'next', 'prev')
- `Parameters param.Field[ObservabilityTelemetryQueryParamsParameters]`
Body param: Optional parameters to pass to the query execution
- `Calculations []ObservabilityTelemetryQueryParamsParametersCalculation`
Create Calculations to compute as part of the query.
- `Operator ObservabilityTelemetryQueryParamsParametersCalculationsOperator`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorUniq ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "uniq"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorCount ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "count"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorMax ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "max"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorMin ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "min"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorSum ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "sum"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorAvg ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "avg"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorMedian ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "median"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP001 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p001"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP01 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p01"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP05 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p05"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP10 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p10"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP25 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p25"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP75 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p75"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP90 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p90"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP95 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p95"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP99 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p99"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP999 ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "p999"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorStddev ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "stddev"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorVariance ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "variance"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorCountDistinct ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "COUNT_DISTINCT"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorCountUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "COUNT"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorMaxUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "MAX"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorMinUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "MIN"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorSumUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "SUM"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorAvgUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "AVG"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorMedianUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "MEDIAN"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP001Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P001"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP01Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P01"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP05Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P05"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP10Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P10"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP25Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P25"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP75Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P75"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP90Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P90"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP95Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P95"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP99Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P99"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorP999Uppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "P999"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorStddevUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "STDDEV"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsOperatorVarianceUppercase ObservabilityTelemetryQueryParamsParametersCalculationsOperator = "VARIANCE"`
- `Alias string`
- `Key string`
The key to use for the calculation. This key must exist in the logs. Use the observability_keys response to confirm. Do not guess keys.
- `KeyType ObservabilityTelemetryQueryParamsParametersCalculationsKeyType`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsKeyTypeString ObservabilityTelemetryQueryParamsParametersCalculationsKeyType = "string"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsKeyTypeNumber ObservabilityTelemetryQueryParamsParametersCalculationsKeyType = "number"`
- `const ObservabilityTelemetryQueryParamsParametersCalculationsKeyTypeBoolean ObservabilityTelemetryQueryParamsParametersCalculationsKeyType = "boolean"`
- `Datasets []string`
Set the Datasets to query. Leave it empty to query all the datasets.
- `FilterCombination ObservabilityTelemetryQueryParamsParametersFilterCombination`
Set a Flag to describe how to combine the filters on the query.
- `const ObservabilityTelemetryQueryParamsParametersFilterCombinationAnd ObservabilityTelemetryQueryParamsParametersFilterCombination = "and"`
- `const ObservabilityTelemetryQueryParamsParametersFilterCombinationOr ObservabilityTelemetryQueryParamsParametersFilterCombination = "or"`
- `const ObservabilityTelemetryQueryParamsParametersFilterCombinationAndUppercase ObservabilityTelemetryQueryParamsParametersFilterCombination = "AND"`
- `const ObservabilityTelemetryQueryParamsParametersFilterCombinationOrUppercase ObservabilityTelemetryQueryParamsParametersFilterCombination = "OR"`
- `Filters []ObservabilityTelemetryQueryParamsParametersFilter`
Configure the Filters to apply to the query. Supports nested groups via kind: 'group'. Maximum nesting depth is 4.
- `type ObservabilityTelemetryQueryParamsParametersFiltersObject struct{…}`
- `FilterCombination ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombination`
- `const ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombinationAnd ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombination = "and"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombinationOr ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombination = "or"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombinationAndUppercase ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombination = "AND"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombinationOrUppercase ObservabilityTelemetryQueryParamsParametersFiltersObjectFilterCombination = "OR"`
- `Filters []unknown`
- `Kind ObservabilityTelemetryQueryParamsParametersFiltersObjectKind`
- `const ObservabilityTelemetryQueryParamsParametersFiltersObjectKindGroup ObservabilityTelemetryQueryParamsParametersFiltersObjectKind = "group"`
- `type ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeaf struct{…}`
Filtering best practices: use observability_keys and observability_values to confirm available fields and values. If searching for errors, filter for $metadata.error exists.
- `Key string`
Filter field name. IMPORTANT: do not guess keys. Always use verified keys from previous query results or the observability_keys response. Preferred keys: $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, $metadata.error.
- `Operation ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationIncludes ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "includes"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationNotIncludes ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "not_includes"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationStartsWith ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "starts_with"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationRegex ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "regex"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationExists ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "exists"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationIsNull ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "is_null"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationIn ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "in"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationNotIn ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "not_in"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationEq ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "eq"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationNeq ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "neq"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationGt ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "gt"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationGte ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "gte"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationLt ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "lt"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationLte ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "lte"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationEquals ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "="`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationNotEquals ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "!="`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationGreater ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = ">"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationGreaterOrEquals ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = ">="`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationLess ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "<"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationLessOrEquals ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "<="`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationIncludesUppercase ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "INCLUDES"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationDoesNotInclude ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_INCLUDE"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationMatchRegex ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "MATCH_REGEX"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationExistsUppercase ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "EXISTS"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationDoesNotExist ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_EXIST"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationInUppercase ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "IN"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationNotInUppercase ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "NOT_IN"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperationStartsWithUppercase ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafOperation = "STARTS_WITH"`
- `Type ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafType`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafTypeString ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafType = "string"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafTypeNumber ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafType = "number"`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafTypeBoolean ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafType = "boolean"`
- `Kind ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafKind`
- `const ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafKindFilter ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafKind = "filter"`
- `Value ObservabilityTelemetryQueryParamsParametersFiltersWorkersObservabilityFilterLeafValueUnion`
Filter comparison value. IMPORTANT: must match actual values in your logs. Verify using previous query results or the /values endpoint. Ensure value type matches the field type. String comparisons are case-sensitive unless using specific operations. Regex uses ClickHouse RE2 syntax (no lookaheads/lookbehinds); examples: ^5\d{2}$ for HTTP 5xx, \bERROR\b for word boundary.
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `GroupBys []ObservabilityTelemetryQueryParamsParametersGroupBy`
Define how to group the results of the query.
- `Type ObservabilityTelemetryQueryParamsParametersGroupBysType`
- `const ObservabilityTelemetryQueryParamsParametersGroupBysTypeString ObservabilityTelemetryQueryParamsParametersGroupBysType = "string"`
- `const ObservabilityTelemetryQueryParamsParametersGroupBysTypeNumber ObservabilityTelemetryQueryParamsParametersGroupBysType = "number"`
- `const ObservabilityTelemetryQueryParamsParametersGroupBysTypeBoolean ObservabilityTelemetryQueryParamsParametersGroupBysType = "boolean"`
- `Value string`
- `Havings []ObservabilityTelemetryQueryParamsParametersHaving`
Configure the Having clauses that filter on calculations in the query result.
- `Key string`
- `Operation ObservabilityTelemetryQueryParamsParametersHavingsOperation`
- `const ObservabilityTelemetryQueryParamsParametersHavingsOperationEq ObservabilityTelemetryQueryParamsParametersHavingsOperation = "eq"`
- `const ObservabilityTelemetryQueryParamsParametersHavingsOperationNeq ObservabilityTelemetryQueryParamsParametersHavingsOperation = "neq"`
- `const ObservabilityTelemetryQueryParamsParametersHavingsOperationGt ObservabilityTelemetryQueryParamsParametersHavingsOperation = "gt"`
- `const ObservabilityTelemetryQueryParamsParametersHavingsOperationGte ObservabilityTelemetryQueryParamsParametersHavingsOperation = "gte"`
- `const ObservabilityTelemetryQueryParamsParametersHavingsOperationLt ObservabilityTelemetryQueryParamsParametersHavingsOperation = "lt"`
- `const ObservabilityTelemetryQueryParamsParametersHavingsOperationLte ObservabilityTelemetryQueryParamsParametersHavingsOperation = "lte"`
- `Value float64`
- `Limit int64`
Set a limit on the number of results / records returned by the query
- `Needle ObservabilityTelemetryQueryParamsParametersNeedle`
Define an expression to search using full-text search.
- `Value ObservabilityTelemetryQueryParamsParametersNeedleValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `IsRegex bool`
- `MatchCase bool`
- `OrderBy ObservabilityTelemetryQueryParamsParametersOrderBy`
Configure the order of the results returned by the query.
- `Value string`
Configure which Calculation to order the results by.
- `Order ObservabilityTelemetryQueryParamsParametersOrderByOrder`
Set the order of the results
- `const ObservabilityTelemetryQueryParamsParametersOrderByOrderAsc ObservabilityTelemetryQueryParamsParametersOrderByOrder = "asc"`
- `const ObservabilityTelemetryQueryParamsParametersOrderByOrderDesc ObservabilityTelemetryQueryParamsParametersOrderByOrder = "desc"`
- `View param.Field[ObservabilityTelemetryQueryParamsView]`
Body param: Examples by view type. Events: show errors for a worker in the last 30 minutes. Calculations: p99 of wall time or count by status code. Invocations: find a specific request that resulted in a 500.
- `const ObservabilityTelemetryQueryParamsViewTraces ObservabilityTelemetryQueryParamsView = "traces"`
- `const ObservabilityTelemetryQueryParamsViewEvents ObservabilityTelemetryQueryParamsView = "events"`
- `const ObservabilityTelemetryQueryParamsViewCalculations ObservabilityTelemetryQueryParamsView = "calculations"`
- `const ObservabilityTelemetryQueryParamsViewInvocations ObservabilityTelemetryQueryParamsView = "invocations"`
- `const ObservabilityTelemetryQueryParamsViewRequests ObservabilityTelemetryQueryParamsView = "requests"`
- `const ObservabilityTelemetryQueryParamsViewAgents ObservabilityTelemetryQueryParamsView = "agents"`
### Returns
- `type ObservabilityTelemetryQueryResponse struct{…}`
- `Run ObservabilityTelemetryQueryResponseRun`
A Workers Observability Query Object
- `ID string`
- `AccountID string`
- `Dry bool`
- `Granularity float64`
- `Query ObservabilityTelemetryQueryResponseRunQuery`
- `ID string`
- `Adhoc bool`
If the query wasn't explcitly saved
- `Created string`
- `CreatedBy string`
- `Description string`
- `Name string`
Query name
- `Parameters ObservabilityTelemetryQueryResponseRunQueryParameters`
- `Calculations []ObservabilityTelemetryQueryResponseRunQueryParametersCalculation`
Create Calculations to compute as part of the query.
- `Operator ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorUniq ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "uniq"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorCount ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "count"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorMax ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "max"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorMin ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "min"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorSum ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "sum"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorAvg ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "avg"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorMedian ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "median"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP001 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p001"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP01 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p01"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP05 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p05"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP10 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p10"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP25 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p25"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP75 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p75"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP90 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p90"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP95 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p95"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP99 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p99"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP999 ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "p999"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorStddev ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "stddev"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorVariance ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "variance"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorCountDistinct ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "COUNT_DISTINCT"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorCountUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "COUNT"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorMaxUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "MAX"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorMinUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "MIN"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorSumUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "SUM"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorAvgUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "AVG"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorMedianUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "MEDIAN"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP001Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P001"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP01Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P01"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP05Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P05"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP10Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P10"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP25Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P25"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP75Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P75"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP90Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P90"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP95Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P95"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP99Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P99"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorP999Uppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "P999"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorStddevUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "STDDEV"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperatorVarianceUppercase ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsOperator = "VARIANCE"`
- `Alias string`
- `Key string`
- `KeyType ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyType`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyTypeString ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyType = "string"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyTypeNumber ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyType = "number"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyTypeBoolean ObservabilityTelemetryQueryResponseRunQueryParametersCalculationsKeyType = "boolean"`
- `Datasets []string`
Set the Datasets to query. Leave it empty to query all the datasets.
- `FilterCombination ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombination`
Set a Flag to describe how to combine the filters on the query.
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombinationAnd ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombination = "and"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombinationOr ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombination = "or"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombinationAndUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombination = "AND"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombinationOrUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFilterCombination = "OR"`
- `Filters []ObservabilityTelemetryQueryResponseRunQueryParametersFilter`
Configure the Filters to apply to the query. Supports nested groups via kind: 'group'.
- `type ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObject struct{…}`
- `FilterCombination ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombination`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombinationAnd ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombination = "and"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombinationOr ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombination = "or"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombinationAndUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombination = "AND"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombinationOrUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectFilterCombination = "OR"`
- `Filters []unknown`
- `Kind ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectKind`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectKindGroup ObservabilityTelemetryQueryResponseRunQueryParametersFiltersObjectKind = "group"`
- `type ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeaf struct{…}`
Filtering best practices: use observability_keys and observability_values to confirm available fields and values. If searching for errors, filter for $metadata.error exists.
- `Key string`
Filter field name. IMPORTANT: do not guess keys. Always use verified keys from previous query results or the observability_keys response. Preferred keys: $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, $metadata.error.
- `Operation ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationIncludes ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "includes"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationNotIncludes ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "not_includes"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationStartsWith ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "starts_with"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationRegex ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "regex"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationExists ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "exists"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationIsNull ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "is_null"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationIn ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "in"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationNotIn ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "not_in"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationEq ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "eq"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationNeq ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "neq"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationGt ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "gt"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationGte ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "gte"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationLt ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "lt"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationLte ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "lte"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationEquals ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "="`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationNotEquals ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "!="`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationGreater ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = ">"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationGreaterOrEquals ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = ">="`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationLess ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "<"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationLessOrEquals ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "<="`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationIncludesUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "INCLUDES"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationDoesNotInclude ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_INCLUDE"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationMatchRegex ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "MATCH_REGEX"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationExistsUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "EXISTS"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationDoesNotExist ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_EXIST"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationInUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "IN"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationNotInUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "NOT_IN"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperationStartsWithUppercase ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafOperation = "STARTS_WITH"`
- `Type ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafType`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafTypeString ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafType = "string"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafTypeNumber ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafType = "number"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafTypeBoolean ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafType = "boolean"`
- `Kind ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafKind`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafKindFilter ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafKind = "filter"`
- `Value ObservabilityTelemetryQueryResponseRunQueryParametersFiltersWorkersObservabilityFilterLeafValueUnion`
Filter comparison value. IMPORTANT: must match actual values in your logs. Verify using previous query results or the /values endpoint. Ensure value type matches the field type. String comparisons are case-sensitive unless using specific operations. Regex uses ClickHouse RE2 syntax (no lookaheads/lookbehinds); examples: ^5\d{2}$ for HTTP 5xx, \bERROR\b for word boundary.
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `GroupBys []ObservabilityTelemetryQueryResponseRunQueryParametersGroupBy`
Define how to group the results of the query.
- `Type ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysType`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysTypeString ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysType = "string"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysTypeNumber ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysType = "number"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysTypeBoolean ObservabilityTelemetryQueryResponseRunQueryParametersGroupBysType = "boolean"`
- `Value string`
- `Havings []ObservabilityTelemetryQueryResponseRunQueryParametersHaving`
Configure the Having clauses that filter on calculations in the query result.
- `Key string`
- `Operation ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperationEq ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation = "eq"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperationNeq ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation = "neq"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperationGt ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation = "gt"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperationGte ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation = "gte"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperationLt ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation = "lt"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperationLte ObservabilityTelemetryQueryResponseRunQueryParametersHavingsOperation = "lte"`
- `Value float64`
- `Limit int64`
Set a limit on the number of results / records returned by the query
- `Needle ObservabilityTelemetryQueryResponseRunQueryParametersNeedle`
Define an expression to search using full-text search.
- `Value ObservabilityTelemetryQueryResponseRunQueryParametersNeedleValue`
- `IsRegex bool`
- `MatchCase bool`
- `OrderBy ObservabilityTelemetryQueryResponseRunQueryParametersOrderBy`
Configure the order of the results returned by the query.
- `Value string`
Configure which Calculation to order the results by.
- `Order ObservabilityTelemetryQueryResponseRunQueryParametersOrderByOrder`
Set the order of the results
- `const ObservabilityTelemetryQueryResponseRunQueryParametersOrderByOrderAsc ObservabilityTelemetryQueryResponseRunQueryParametersOrderByOrder = "asc"`
- `const ObservabilityTelemetryQueryResponseRunQueryParametersOrderByOrderDesc ObservabilityTelemetryQueryResponseRunQueryParametersOrderByOrder = "desc"`
- `Updated string`
- `UpdatedBy string`
- `Status ObservabilityTelemetryQueryResponseRunStatus`
- `const ObservabilityTelemetryQueryResponseRunStatusStarted ObservabilityTelemetryQueryResponseRunStatus = "STARTED"`
- `const ObservabilityTelemetryQueryResponseRunStatusCompleted ObservabilityTelemetryQueryResponseRunStatus = "COMPLETED"`
- `Timeframe ObservabilityTelemetryQueryResponseRunTimeframe`
Time range for the query execution
- `From float64`
Start timestamp for the query timeframe (Unix timestamp in milliseconds)
- `To float64`
End timestamp for the query timeframe (Unix timestamp in milliseconds)
- `UserID string`
- `Created string`
- `Statistics ObservabilityTelemetryQueryResponseRunStatistics`
- `BytesRead float64`
Number of uncompressed bytes read from the table.
- `Elapsed float64`
Time in seconds for the query to run.
- `RowsRead float64`
Number of rows scanned from the table.
- `AbrLevel float64`
The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the ABR level is 1
- `Updated string`
- `Statistics ObservabilityTelemetryQueryResponseStatistics`
The statistics object contains information about query performance from the database, it does not include any network latency
- `BytesRead float64`
Number of uncompressed bytes read from the table.
- `Elapsed float64`
Time in seconds for the query to run.
- `RowsRead float64`
Number of rows scanned from the table.
- `AbrLevel float64`
The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the ABR level is 1
- `Agents []ObservabilityTelemetryQueryResponseAgent`
- `AgentClass string`
- `EventTypeCounts map[string, float64]`
- `FirstEventMs float64`
- `HasErrors bool`
- `LastEventMs float64`
- `Namespace string`
- `Service string`
- `TotalEvents float64`
- `Calculations []ObservabilityTelemetryQueryResponseCalculation`
- `Aggregates []ObservabilityTelemetryQueryResponseCalculationsAggregate`
- `Count float64`
- `Interval float64`
- `SampleInterval float64`
- `Value float64`
- `Groups []ObservabilityTelemetryQueryResponseCalculationsAggregatesGroup`
- `Key string`
- `Value ObservabilityTelemetryQueryResponseCalculationsAggregatesGroupsValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `Calculation string`
- `Series []ObservabilityTelemetryQueryResponseCalculationsSeries`
- `Data []ObservabilityTelemetryQueryResponseCalculationsSeriesData`
- `Count float64`
- `Interval float64`
- `SampleInterval float64`
- `Value float64`
- `FirstSeen string`
- `Groups []ObservabilityTelemetryQueryResponseCalculationsSeriesDataGroup`
- `Key string`
- `Value ObservabilityTelemetryQueryResponseCalculationsSeriesDataGroupsValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `LastSeen string`
- `Time string`
- `Alias string`
- `Compare []ObservabilityTelemetryQueryResponseCompare`
- `Aggregates []ObservabilityTelemetryQueryResponseCompareAggregate`
- `Count float64`
- `Interval float64`
- `SampleInterval float64`
- `Value float64`
- `Groups []ObservabilityTelemetryQueryResponseCompareAggregatesGroup`
- `Key string`
- `Value ObservabilityTelemetryQueryResponseCompareAggregatesGroupsValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `Calculation string`
- `Series []ObservabilityTelemetryQueryResponseCompareSeries`
- `Data []ObservabilityTelemetryQueryResponseCompareSeriesData`
- `Count float64`
- `Interval float64`
- `SampleInterval float64`
- `Value float64`
- `FirstSeen string`
- `Groups []ObservabilityTelemetryQueryResponseCompareSeriesDataGroup`
- `Key string`
- `Value ObservabilityTelemetryQueryResponseCompareSeriesDataGroupsValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `LastSeen string`
- `Time string`
- `Alias string`
- `Events ObservabilityTelemetryQueryResponseEvents`
- `Count float64`
- `Events []ObservabilityTelemetryQueryResponseEventsEvent`
- `Metadata ObservabilityTelemetryQueryResponseEventsEventsMetadata`
- `ID string`
Unique event ID. Use as the cursor for offset-based pagination.
- `Account string`
- `CloudService string`
- `ColdStart int64`
- `Cost int64`
- `Duration int64`
- `EndTime int64`
- `Error string`
- `ErrorTemplate string`
- `Fingerprint string`
- `Level string`
- `Message string`
- `MessageTemplate string`
- `MetricName string`
- `Origin string`
- `ParentSpanID string`
- `Provider string`
- `Region string`
- `RequestID string`
- `Service string`
- `SpanID string`
- `SpanName string`
- `StackID string`
- `StartTime int64`
- `StatusCode int64`
- `TraceDuration int64`
- `TraceID string`
- `TransactionName string`
- `Trigger string`
- `Type string`
- `URL string`
- `Dataset string`
- `Source unknown`
- `unknown`
- `Timestamp int64`
- `Containers unknown`
Cloudflare Containers event information enriches your logs so you can easily identify and debug issues.
- `Workers ObservabilityTelemetryQueryResponseEventsEventsWorkers`
Cloudflare Workers event information enriches your logs so you can easily identify and debug issues.
- `type ObservabilityTelemetryQueryResponseEventsEventsWorkersObject struct{…}`
- `EventType ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeFetch ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "fetch"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeScheduled ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "scheduled"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeAlarm ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "alarm"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeCron ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "cron"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeQueue ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "queue"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeEmail ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "email"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeTail ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "tail"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeRpc ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "rpc"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeWebsocket ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "websocket"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeWorkflow ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "workflow"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeUnknown ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "unknown"`
- `RequestID string`
- `ScriptName string`
- `DurableObjectID string`
- `Entrypoint string`
- `Event map[string, unknown]`
- `ExecutionModel ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModel`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModelDurableObject ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModel = "durableObject"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModelStateless ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModel = "stateless"`
- `Outcome string`
- `ScriptVersion ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectScriptVersion`
- `ID string`
- `Message string`
- `Tag string`
- `Truncated bool`
- `type ObservabilityTelemetryQueryResponseEventsEventsWorkersObject struct{…}`
- `CPUTimeMs float64`
- `EventType ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeFetch ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "fetch"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeScheduled ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "scheduled"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeAlarm ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "alarm"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeCron ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "cron"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeQueue ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "queue"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeEmail ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "email"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeTail ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "tail"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeRpc ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "rpc"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeWebsocket ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "websocket"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeWorkflow ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "workflow"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventTypeUnknown ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectEventType = "unknown"`
- `Outcome string`
- `RequestID string`
- `ScriptName string`
- `WallTimeMs float64`
- `DiagnosticsChannelEvents []ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectDiagnosticsChannelEvent`
- `Channel string`
- `Message string`
- `Timestamp float64`
- `DispatchNamespace string`
- `DurableObjectID string`
- `Entrypoint string`
- `Event map[string, unknown]`
- `ExecutionModel ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModel`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModelDurableObject ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModel = "durableObject"`
- `const ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModelStateless ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectExecutionModel = "stateless"`
- `ScriptVersion ObservabilityTelemetryQueryResponseEventsEventsWorkersObjectScriptVersion`
- `ID string`
- `Message string`
- `Tag string`
- `Truncated bool`
- `Fields []ObservabilityTelemetryQueryResponseEventsField`
- `Key string`
- `Type string`
- `Series []ObservabilityTelemetryQueryResponseEventsSeries`
- `Data []ObservabilityTelemetryQueryResponseEventsSeriesData`
- `Aggregates ObservabilityTelemetryQueryResponseEventsSeriesDataAggregates`
- `Count int64`
- `Interval float64`
- `FirstSeen string`
- `LastSeen string`
- `Bin unknown`
- `Count float64`
- `Interval float64`
- `SampleInterval float64`
- `Errors float64`
- `Groups map[string, ObservabilityTelemetryQueryResponseEventsSeriesDataGroupsUnion]`
Groups in the query results.
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `Time string`
- `Invocations map[string, []ObservabilityTelemetryQueryResponseInvocation]`
- `Metadata ObservabilityTelemetryQueryResponseInvocationsMetadata`
- `ID string`
Unique event ID. Use as the cursor for offset-based pagination.
- `Account string`
- `CloudService string`
- `ColdStart int64`
- `Cost int64`
- `Duration int64`
- `EndTime int64`
- `Error string`
- `ErrorTemplate string`
- `Fingerprint string`
- `Level string`
- `Message string`
- `MessageTemplate string`
- `MetricName string`
- `Origin string`
- `ParentSpanID string`
- `Provider string`
- `Region string`
- `RequestID string`
- `Service string`
- `SpanID string`
- `SpanName string`
- `StackID string`
- `StartTime int64`
- `StatusCode int64`
- `TraceDuration int64`
- `TraceID string`
- `TransactionName string`
- `Trigger string`
- `Type string`
- `URL string`
- `Dataset string`
- `Source unknown`
- `unknown`
- `Timestamp int64`
- `Containers unknown`
Cloudflare Containers event information enriches your logs so you can easily identify and debug issues.
- `Workers ObservabilityTelemetryQueryResponseInvocationsWorkers`
Cloudflare Workers event information enriches your logs so you can easily identify and debug issues.
- `type ObservabilityTelemetryQueryResponseInvocationsWorkersObject struct{…}`
- `EventType ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeFetch ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "fetch"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeScheduled ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "scheduled"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeAlarm ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "alarm"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeCron ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "cron"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeQueue ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "queue"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeEmail ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "email"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeTail ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "tail"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeRpc ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "rpc"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeWebsocket ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "websocket"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeWorkflow ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "workflow"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeUnknown ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "unknown"`
- `RequestID string`
- `ScriptName string`
- `DurableObjectID string`
- `Entrypoint string`
- `Event map[string, unknown]`
- `ExecutionModel ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModel`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModelDurableObject ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModel = "durableObject"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModelStateless ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModel = "stateless"`
- `Outcome string`
- `ScriptVersion ObservabilityTelemetryQueryResponseInvocationsWorkersObjectScriptVersion`
- `ID string`
- `Message string`
- `Tag string`
- `Truncated bool`
- `type ObservabilityTelemetryQueryResponseInvocationsWorkersObject struct{…}`
- `CPUTimeMs float64`
- `EventType ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeFetch ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "fetch"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeScheduled ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "scheduled"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeAlarm ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "alarm"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeCron ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "cron"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeQueue ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "queue"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeEmail ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "email"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeTail ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "tail"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeRpc ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "rpc"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeWebsocket ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "websocket"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeWorkflow ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "workflow"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventTypeUnknown ObservabilityTelemetryQueryResponseInvocationsWorkersObjectEventType = "unknown"`
- `Outcome string`
- `RequestID string`
- `ScriptName string`
- `WallTimeMs float64`
- `DiagnosticsChannelEvents []ObservabilityTelemetryQueryResponseInvocationsWorkersObjectDiagnosticsChannelEvent`
- `Channel string`
- `Message string`
- `Timestamp float64`
- `DispatchNamespace string`
- `DurableObjectID string`
- `Entrypoint string`
- `Event map[string, unknown]`
- `ExecutionModel ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModel`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModelDurableObject ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModel = "durableObject"`
- `const ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModelStateless ObservabilityTelemetryQueryResponseInvocationsWorkersObjectExecutionModel = "stateless"`
- `ScriptVersion ObservabilityTelemetryQueryResponseInvocationsWorkersObjectScriptVersion`
- `ID string`
- `Message string`
- `Tag string`
- `Truncated bool`
- `Traces []ObservabilityTelemetryQueryResponseTrace`
- `RootSpanName string`
- `RootTransactionName string`
- `Service []string`
- `Spans float64`
- `TraceDurationMs float64`
- `TraceEndMs float64`
- `TraceID string`
- `TraceStartMs float64`
- `Errors []string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
response, err := client.Workers.Observability.Telemetry.Query(context.TODO(), workers.ObservabilityTelemetryQueryParams{
AccountID: cloudflare.F("account_id"),
QueryID: cloudflare.F("queryId"),
Timeframe: cloudflare.F(workers.ObservabilityTelemetryQueryParamsTimeframe{
From: cloudflare.F(0.000000),
To: cloudflare.F(0.000000),
}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Run)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Successful request"
}
],
"result": {
"run": {
"id": "id",
"accountId": "accountId",
"dry": true,
"granularity": 0,
"query": {
"id": "id",
"adhoc": true,
"created": "created",
"createdBy": "createdBy",
"description": "Query description",
"name": "x",
"parameters": {
"calculations": [
{
"operator": "uniq",
"alias": "alias",
"key": "key",
"keyType": "string"
}
],
"datasets": [
"string"
],
"filterCombination": "and",
"filters": [
{
"filterCombination": "and",
"filters": [
{}
],
"kind": "group"
}
],
"groupBys": [
{
"type": "string",
"value": "value"
}
],
"havings": [
{
"key": "key",
"operation": "eq",
"value": 0
}
],
"limit": 0,
"needle": {
"value": {
"0": "s",
"1": "t",
"2": "r",
"3": "i",
"4": "n",
"5": "g"
},
"isRegex": true,
"matchCase": true
},
"orderBy": {
"value": "value",
"order": "asc"
}
},
"updated": "updated",
"updatedBy": "updatedBy"
},
"status": "STARTED",
"timeframe": {
"from": 0,
"to": 0
},
"userId": "userId",
"created": "created",
"statistics": {
"bytes_read": 0,
"elapsed": 0,
"rows_read": 0,
"abr_level": 0
},
"updated": "updated"
},
"statistics": {
"bytes_read": 0,
"elapsed": 0,
"rows_read": 0,
"abr_level": 0
},
"agents": [
{
"agentClass": "agentClass",
"eventTypeCounts": {
"foo": 0
},
"firstEventMs": 0,
"hasErrors": true,
"lastEventMs": 0,
"namespace": "namespace",
"service": "service",
"totalEvents": 0
}
],
"calculations": [
{
"aggregates": [
{
"count": 0,
"interval": 0,
"sampleInterval": 0,
"value": 0,
"groups": [
{
"key": "key",
"value": "string"
}
]
}
],
"calculation": "calculation",
"series": [
{
"data": [
{
"count": 0,
"interval": 0,
"sampleInterval": 0,
"value": 0,
"firstSeen": "firstSeen",
"groups": [
{
"key": "key",
"value": "string"
}
],
"lastSeen": "lastSeen"
}
],
"time": "time"
}
],
"alias": "alias"
}
],
"compare": [
{
"aggregates": [
{
"count": 0,
"interval": 0,
"sampleInterval": 0,
"value": 0,
"groups": [
{
"key": "key",
"value": "string"
}
]
}
],
"calculation": "calculation",
"series": [
{
"data": [
{
"count": 0,
"interval": 0,
"sampleInterval": 0,
"value": 0,
"firstSeen": "firstSeen",
"groups": [
{
"key": "key",
"value": "string"
}
],
"lastSeen": "lastSeen"
}
],
"time": "time"
}
],
"alias": "alias"
}
],
"events": {
"count": 0,
"events": [
{
"$metadata": {
"id": "id",
"account": "account",
"cloudService": "cloudService",
"coldStart": 1,
"cost": 1,
"duration": 1,
"endTime": 0,
"error": "error",
"errorTemplate": "errorTemplate",
"fingerprint": "fingerprint",
"level": "level",
"message": "message",
"messageTemplate": "messageTemplate",
"metricName": "metricName",
"origin": "origin",
"parentSpanId": "parentSpanId",
"provider": "provider",
"region": "region",
"requestId": "requestId",
"service": "service",
"spanId": "spanId",
"spanName": "spanName",
"stackId": "stackId",
"startTime": 0,
"statusCode": 1,
"traceDuration": 1,
"traceId": "traceId",
"transactionName": "transactionName",
"trigger": "trigger",
"type": "type",
"url": "url"
},
"dataset": "dataset",
"source": "string",
"timestamp": 0,
"$containers": {},
"$workers": {
"eventType": "fetch",
"requestId": "requestId",
"scriptName": "scriptName",
"durableObjectId": "durableObjectId",
"entrypoint": "entrypoint",
"event": {
"foo": "bar"
},
"executionModel": "durableObject",
"outcome": "outcome",
"scriptVersion": {
"id": "id",
"message": "message",
"tag": "tag"
},
"truncated": true
}
}
],
"fields": [
{
"key": "key",
"type": "type"
}
],
"series": [
{
"data": [
{
"aggregates": {
"_count": 1,
"_interval": 1,
"_firstSeen": "_firstSeen",
"_lastSeen": "_lastSeen",
"bin": {}
},
"count": 0,
"interval": 0,
"sampleInterval": 0,
"errors": 0,
"groups": {
"foo": "string"
}
}
],
"time": "time"
}
]
},
"invocations": {
"foo": [
{
"$metadata": {
"id": "id",
"account": "account",
"cloudService": "cloudService",
"coldStart": 1,
"cost": 1,
"duration": 1,
"endTime": 0,
"error": "error",
"errorTemplate": "errorTemplate",
"fingerprint": "fingerprint",
"level": "level",
"message": "message",
"messageTemplate": "messageTemplate",
"metricName": "metricName",
"origin": "origin",
"parentSpanId": "parentSpanId",
"provider": "provider",
"region": "region",
"requestId": "requestId",
"service": "service",
"spanId": "spanId",
"spanName": "spanName",
"stackId": "stackId",
"startTime": 0,
"statusCode": 1,
"traceDuration": 1,
"traceId": "traceId",
"transactionName": "transactionName",
"trigger": "trigger",
"type": "type",
"url": "url"
},
"dataset": "dataset",
"source": "string",
"timestamp": 0,
"$containers": {},
"$workers": {
"eventType": "fetch",
"requestId": "requestId",
"scriptName": "scriptName",
"durableObjectId": "durableObjectId",
"entrypoint": "entrypoint",
"event": {
"foo": "bar"
},
"executionModel": "durableObject",
"outcome": "outcome",
"scriptVersion": {
"id": "id",
"message": "message",
"tag": "tag"
},
"truncated": true
}
}
]
},
"traces": [
{
"rootSpanName": "rootSpanName",
"rootTransactionName": "rootTransactionName",
"service": [
"string"
],
"spans": 0,
"traceDurationMs": 0,
"traceEndMs": 0,
"traceId": "traceId",
"traceStartMs": 0,
"errors": [
"string"
]
}
]
},
"success": true
}
```
## List values
`client.Workers.Observability.Telemetry.Values(ctx, params) (*SinglePage[ObservabilityTelemetryValuesResponse], error)`
**post** `/accounts/{account_id}/workers/observability/telemetry/values`
List unique values found in your events.
### Parameters
- `params ObservabilityTelemetryValuesParams`
- `AccountID param.Field[string]`
Path param: Your Cloudflare account ID.
- `Datasets param.Field[[]string]`
Body param: Leave this empty to use the default datasets
- `Key param.Field[string]`
Body param
- `Timeframe param.Field[ObservabilityTelemetryValuesParamsTimeframe]`
Body param
- `From float64`
- `To float64`
- `Type param.Field[ObservabilityTelemetryValuesParamsType]`
Body param
- `const ObservabilityTelemetryValuesParamsTypeString ObservabilityTelemetryValuesParamsType = "string"`
- `const ObservabilityTelemetryValuesParamsTypeBoolean ObservabilityTelemetryValuesParamsType = "boolean"`
- `const ObservabilityTelemetryValuesParamsTypeNumber ObservabilityTelemetryValuesParamsType = "number"`
- `Filters param.Field[[]ObservabilityTelemetryValuesParamsFilter]`
Body param: Apply filters before listing values. Supports nested groups via kind: 'group'. Maximum nesting depth is 4.
- `type ObservabilityTelemetryValuesParamsFiltersObject struct{…}`
- `FilterCombination ObservabilityTelemetryValuesParamsFiltersObjectFilterCombination`
- `const ObservabilityTelemetryValuesParamsFiltersObjectFilterCombinationAnd ObservabilityTelemetryValuesParamsFiltersObjectFilterCombination = "and"`
- `const ObservabilityTelemetryValuesParamsFiltersObjectFilterCombinationOr ObservabilityTelemetryValuesParamsFiltersObjectFilterCombination = "or"`
- `const ObservabilityTelemetryValuesParamsFiltersObjectFilterCombinationAndUppercase ObservabilityTelemetryValuesParamsFiltersObjectFilterCombination = "AND"`
- `const ObservabilityTelemetryValuesParamsFiltersObjectFilterCombinationOrUppercase ObservabilityTelemetryValuesParamsFiltersObjectFilterCombination = "OR"`
- `Filters []unknown`
- `Kind ObservabilityTelemetryValuesParamsFiltersObjectKind`
- `const ObservabilityTelemetryValuesParamsFiltersObjectKindGroup ObservabilityTelemetryValuesParamsFiltersObjectKind = "group"`
- `type ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeaf struct{…}`
Filtering best practices: use observability_keys and observability_values to confirm available fields and values. If searching for errors, filter for $metadata.error exists.
- `Key string`
Filter field name. IMPORTANT: do not guess keys. Always use verified keys from previous query results or the observability_keys response. Preferred keys: $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, $metadata.error.
- `Operation ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationIncludes ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "includes"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationNotIncludes ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "not_includes"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationStartsWith ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "starts_with"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationRegex ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "regex"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationExists ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "exists"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationIsNull ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "is_null"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationIn ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "in"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationNotIn ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "not_in"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationEq ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "eq"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationNeq ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "neq"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationGt ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "gt"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationGte ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "gte"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationLt ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "lt"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationLte ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "lte"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationEquals ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "="`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationNotEquals ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "!="`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationGreater ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = ">"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationGreaterOrEquals ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = ">="`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationLess ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "<"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationLessOrEquals ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "<="`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationIncludesUppercase ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "INCLUDES"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationDoesNotInclude ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_INCLUDE"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationMatchRegex ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "MATCH_REGEX"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationExistsUppercase ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "EXISTS"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationDoesNotExist ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "DOES_NOT_EXIST"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationInUppercase ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "IN"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationNotInUppercase ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "NOT_IN"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperationStartsWithUppercase ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafOperation = "STARTS_WITH"`
- `Type ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafType`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafTypeString ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafType = "string"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafTypeNumber ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafType = "number"`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafTypeBoolean ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafType = "boolean"`
- `Kind ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafKind`
- `const ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafKindFilter ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafKind = "filter"`
- `Value ObservabilityTelemetryValuesParamsFiltersWorkersObservabilityFilterLeafValueUnion`
Filter comparison value. IMPORTANT: must match actual values in your logs. Verify using previous query results or the /values endpoint. Ensure value type matches the field type. String comparisons are case-sensitive unless using specific operations. Regex uses ClickHouse RE2 syntax (no lookaheads/lookbehinds); examples: ^5\d{2}$ for HTTP 5xx, \bERROR\b for word boundary.
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `Limit param.Field[float64]`
Body param
- `Needle param.Field[ObservabilityTelemetryValuesParamsNeedle]`
Body param: Search for a specific substring in the event.
- `Value ObservabilityTelemetryValuesParamsNeedleValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
- `IsRegex bool`
- `MatchCase bool`
### Returns
- `type ObservabilityTelemetryValuesResponse struct{…}`
- `Dataset string`
- `Key string`
- `Type ObservabilityTelemetryValuesResponseType`
- `const ObservabilityTelemetryValuesResponseTypeString ObservabilityTelemetryValuesResponseType = "string"`
- `const ObservabilityTelemetryValuesResponseTypeBoolean ObservabilityTelemetryValuesResponseType = "boolean"`
- `const ObservabilityTelemetryValuesResponseTypeNumber ObservabilityTelemetryValuesResponseType = "number"`
- `Value ObservabilityTelemetryValuesResponseValueUnion`
- `UnionString`
- `UnionFloat`
- `UnionBool`
### 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
page, err := client.Workers.Observability.Telemetry.Values(context.TODO(), workers.ObservabilityTelemetryValuesParams{
AccountID: cloudflare.F("account_id"),
Datasets: cloudflare.F([]string{"string"}),
Key: cloudflare.F("key"),
Timeframe: cloudflare.F(workers.ObservabilityTelemetryValuesParamsTimeframe{
From: cloudflare.F(0.000000),
To: cloudflare.F(0.000000),
}),
Type: cloudflare.F(workers.ObservabilityTelemetryValuesParamsTypeString),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Successful request"
}
],
"result": [
{
"dataset": "dataset",
"key": "key",
"type": "string",
"value": "string"
}
],
"success": true
}
```
# Destinations
## Get Destinations
`client.Workers.Observability.Destinations.List(ctx, params) (*SinglePage[ObservabilityDestinationListResponse], error)`
**get** `/accounts/{account_id}/workers/observability/destinations`
List your Workers Observability Telemetry Destinations.
### Parameters
- `params ObservabilityDestinationListParams`
- `AccountID param.Field[string]`
Path param: Your Cloudflare account ID.
- `Order param.Field[ObservabilityDestinationListParamsOrder]`
Query param
- `const ObservabilityDestinationListParamsOrderAsc ObservabilityDestinationListParamsOrder = "asc"`
- `const ObservabilityDestinationListParamsOrderDesc ObservabilityDestinationListParamsOrder = "desc"`
- `OrderBy param.Field[ObservabilityDestinationListParamsOrderBy]`
Query param
- `const ObservabilityDestinationListParamsOrderByCreated ObservabilityDestinationListParamsOrderBy = "created"`
- `const ObservabilityDestinationListParamsOrderByUpdated ObservabilityDestinationListParamsOrderBy = "updated"`
- `Page param.Field[float64]`
Query param
- `PerPage param.Field[float64]`
Query param
### Returns
- `type ObservabilityDestinationListResponse struct{…}`
- `Configuration ObservabilityDestinationListResponseConfiguration`
- `DestinationConf string`
- `Headers map[string, string]`
- `JobStatus ObservabilityDestinationListResponseConfigurationJobStatus`
- `ErrorMessage string`
- `LastComplete string`
- `LastError string`
- `LogpushDataset ObservabilityDestinationListResponseConfigurationLogpushDataset`
- `const ObservabilityDestinationListResponseConfigurationLogpushDatasetOpentelemetryTraces ObservabilityDestinationListResponseConfigurationLogpushDataset = "opentelemetry-traces"`
- `const ObservabilityDestinationListResponseConfigurationLogpushDatasetOpentelemetryLogs ObservabilityDestinationListResponseConfigurationLogpushDataset = "opentelemetry-logs"`
- `Type ObservabilityDestinationListResponseConfigurationType`
- `const ObservabilityDestinationListResponseConfigurationTypeLogpush ObservabilityDestinationListResponseConfigurationType = "logpush"`
- `URL string`
- `Enabled bool`
- `Name string`
- `Scripts []string`
- `Slug string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
page, err := client.Workers.Observability.Destinations.List(context.TODO(), workers.ObservabilityDestinationListParams{
AccountID: cloudflare.F("account_id"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Successful request"
}
],
"result": [
{
"configuration": {
"destination_conf": "destination_conf",
"headers": {
"foo": "string"
},
"jobStatus": {
"error_message": "error_message",
"last_complete": "last_complete",
"last_error": "last_error"
},
"logpushDataset": "opentelemetry-traces",
"type": "logpush",
"url": "url"
},
"enabled": true,
"name": "name",
"scripts": [
"string"
],
"slug": "slug"
}
],
"success": true
}
```
## Create Destination
`client.Workers.Observability.Destinations.New(ctx, params) (*ObservabilityDestinationNewResponse, error)`
**post** `/accounts/{account_id}/workers/observability/destinations`
Create a new Workers Observability Telemetry Destination.
### Parameters
- `params ObservabilityDestinationNewParams`
- `AccountID param.Field[string]`
Path param: Your Cloudflare account ID.
- `Configuration param.Field[ObservabilityDestinationNewParamsConfiguration]`
Body param
- `Headers map[string, string]`
- `LogpushDataset ObservabilityDestinationNewParamsConfigurationLogpushDataset`
- `const ObservabilityDestinationNewParamsConfigurationLogpushDatasetOpentelemetryTraces ObservabilityDestinationNewParamsConfigurationLogpushDataset = "opentelemetry-traces"`
- `const ObservabilityDestinationNewParamsConfigurationLogpushDatasetOpentelemetryLogs ObservabilityDestinationNewParamsConfigurationLogpushDataset = "opentelemetry-logs"`
- `Type ObservabilityDestinationNewParamsConfigurationType`
- `const ObservabilityDestinationNewParamsConfigurationTypeLogpush ObservabilityDestinationNewParamsConfigurationType = "logpush"`
- `URL string`
- `Enabled param.Field[bool]`
Body param
- `Name param.Field[string]`
Body param
- `SkipPreflightCheck param.Field[bool]`
Body param
### Returns
- `type ObservabilityDestinationNewResponse struct{…}`
- `Configuration ObservabilityDestinationNewResponseConfiguration`
- `DestinationConf string`
- `LogpushDataset ObservabilityDestinationNewResponseConfigurationLogpushDataset`
- `const ObservabilityDestinationNewResponseConfigurationLogpushDatasetOpentelemetryTraces ObservabilityDestinationNewResponseConfigurationLogpushDataset = "opentelemetry-traces"`
- `const ObservabilityDestinationNewResponseConfigurationLogpushDatasetOpentelemetryLogs ObservabilityDestinationNewResponseConfigurationLogpushDataset = "opentelemetry-logs"`
- `LogpushJob float64`
- `Type ObservabilityDestinationNewResponseConfigurationType`
- `const ObservabilityDestinationNewResponseConfigurationTypeLogpush ObservabilityDestinationNewResponseConfigurationType = "logpush"`
- `URL string`
- `Enabled bool`
- `Name string`
- `Scripts []string`
- `Slug string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
destination, err := client.Workers.Observability.Destinations.New(context.TODO(), workers.ObservabilityDestinationNewParams{
AccountID: cloudflare.F("account_id"),
Configuration: cloudflare.F(workers.ObservabilityDestinationNewParamsConfiguration{
Headers: cloudflare.F(map[string]string{
"foo": "string",
}),
LogpushDataset: cloudflare.F(workers.ObservabilityDestinationNewParamsConfigurationLogpushDatasetOpentelemetryTraces),
Type: cloudflare.F(workers.ObservabilityDestinationNewParamsConfigurationTypeLogpush),
URL: cloudflare.F("url"),
}),
Enabled: cloudflare.F(true),
Name: cloudflare.F("name"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", destination.Configuration)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Resource created"
}
],
"result": {
"configuration": {
"destination_conf": "destination_conf",
"logpushDataset": "opentelemetry-traces",
"logpushJob": 0,
"type": "logpush",
"url": "url"
},
"enabled": true,
"name": "name",
"scripts": [
"string"
],
"slug": "slug"
},
"success": true
}
```
## Update Destination
`client.Workers.Observability.Destinations.Update(ctx, slug, params) (*ObservabilityDestinationUpdateResponse, error)`
**patch** `/accounts/{account_id}/workers/observability/destinations/{slug}`
Update an existing Workers Observability Telemetry Destination.
### Parameters
- `slug string`
- `params ObservabilityDestinationUpdateParams`
- `AccountID param.Field[string]`
Path param: Your Cloudflare account ID.
- `Configuration param.Field[ObservabilityDestinationUpdateParamsConfiguration]`
Body param
- `Headers map[string, string]`
- `Type ObservabilityDestinationUpdateParamsConfigurationType`
- `const ObservabilityDestinationUpdateParamsConfigurationTypeLogpush ObservabilityDestinationUpdateParamsConfigurationType = "logpush"`
- `URL string`
- `Enabled param.Field[bool]`
Body param
### Returns
- `type ObservabilityDestinationUpdateResponse struct{…}`
- `Configuration ObservabilityDestinationUpdateResponseConfiguration`
- `DestinationConf string`
- `LogpushDataset ObservabilityDestinationUpdateResponseConfigurationLogpushDataset`
- `const ObservabilityDestinationUpdateResponseConfigurationLogpushDatasetOpentelemetryTraces ObservabilityDestinationUpdateResponseConfigurationLogpushDataset = "opentelemetry-traces"`
- `const ObservabilityDestinationUpdateResponseConfigurationLogpushDatasetOpentelemetryLogs ObservabilityDestinationUpdateResponseConfigurationLogpushDataset = "opentelemetry-logs"`
- `LogpushJob float64`
- `Type ObservabilityDestinationUpdateResponseConfigurationType`
- `const ObservabilityDestinationUpdateResponseConfigurationTypeLogpush ObservabilityDestinationUpdateResponseConfigurationType = "logpush"`
- `URL string`
- `Enabled bool`
- `Name string`
- `Scripts []string`
- `Slug string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
destination, err := client.Workers.Observability.Destinations.Update(
context.TODO(),
"slug",
workers.ObservabilityDestinationUpdateParams{
AccountID: cloudflare.F("account_id"),
Configuration: cloudflare.F(workers.ObservabilityDestinationUpdateParamsConfiguration{
Headers: cloudflare.F(map[string]string{
"foo": "string",
}),
Type: cloudflare.F(workers.ObservabilityDestinationUpdateParamsConfigurationTypeLogpush),
URL: cloudflare.F("url"),
}),
Enabled: cloudflare.F(true),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", destination.Configuration)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Successful request"
}
],
"result": {
"configuration": {
"destination_conf": "destination_conf",
"logpushDataset": "opentelemetry-traces",
"logpushJob": 0,
"type": "logpush",
"url": "url"
},
"enabled": true,
"name": "name",
"scripts": [
"string"
],
"slug": "slug"
},
"success": true
}
```
## Delete Destination
`client.Workers.Observability.Destinations.Delete(ctx, slug, body) (*ObservabilityDestinationDeleteResponse, error)`
**delete** `/accounts/{account_id}/workers/observability/destinations/{slug}`
Delete a Workers Observability Telemetry Destination.
### Parameters
- `slug string`
- `body ObservabilityDestinationDeleteParams`
- `AccountID param.Field[string]`
Your Cloudflare account ID.
### Returns
- `type ObservabilityDestinationDeleteResponse struct{…}`
- `Configuration ObservabilityDestinationDeleteResponseConfiguration`
- `DestinationConf string`
- `LogpushDataset ObservabilityDestinationDeleteResponseConfigurationLogpushDataset`
- `const ObservabilityDestinationDeleteResponseConfigurationLogpushDatasetOpentelemetryTraces ObservabilityDestinationDeleteResponseConfigurationLogpushDataset = "opentelemetry-traces"`
- `const ObservabilityDestinationDeleteResponseConfigurationLogpushDatasetOpentelemetryLogs ObservabilityDestinationDeleteResponseConfigurationLogpushDataset = "opentelemetry-logs"`
- `LogpushJob float64`
- `Type ObservabilityDestinationDeleteResponseConfigurationType`
- `const ObservabilityDestinationDeleteResponseConfigurationTypeLogpush ObservabilityDestinationDeleteResponseConfigurationType = "logpush"`
- `URL string`
- `Enabled bool`
- `Name string`
- `Scripts []string`
- `Slug string`
### Example
```go
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/workers"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
)
destination, err := client.Workers.Observability.Destinations.Delete(
context.TODO(),
"slug",
workers.ObservabilityDestinationDeleteParams{
AccountID: cloudflare.F("account_id"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", destination.Configuration)
}
```
#### Response
```json
{
"errors": [
{
"message": "message"
}
],
"messages": [
{
"message": "Successful request"
}
],
"success": true,
"result": {
"configuration": {
"destination_conf": "destination_conf",
"logpushDataset": "opentelemetry-traces",
"logpushJob": 0,
"type": "logpush",
"url": "url"
},
"enabled": true,
"name": "name",
"scripts": [
"string"
],
"slug": "slug"
}
}
```