Skip to content
Start here

Get Script Bindings

client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Bindings.Get(ctx, dispatchNamespace, scriptName, query) (*SinglePage[DispatchNamespaceScriptBindingGetResponse], error)
GET/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings

Fetch script bindings from a script uploaded to a Workers for Platforms namespace.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers Tail ReadWorkers Scripts WriteWorkers Scripts Read
ParametersExpand Collapse
dispatchNamespace string

Name of the Workers for Platforms dispatch namespace.

scriptName string

Name of the script, used in URLs and route configuration.

query DispatchNamespaceScriptBindingGetParams
AccountID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type DispatchNamespaceScriptBindingGetResponse interface{…}

A binding to allow the Worker to communicate with resources.

One of the following:
type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAI struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAIType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearch 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 DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchType

The kind of resource that the binding provides.

Namespace stringOptional

The namespace the instance belongs to. Defaults to “default” if omitted. Customers who don’t use namespaces can simply omit this field.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchNamespace 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 DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchNamespaceType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAnalyticsEngine struct{…}
Dataset string

The name of the dataset to bind to.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAnalyticsEngineType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAssets struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAssetsType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindBrowser struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindBrowserType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindD1 struct{…}
DatabaseID string

Identifier of the D1 database to bind to.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindD1Type

The kind of resource that the binding provides.

DeprecatedID stringOptional
This property has been renamed to `database_id`.

Identifier of the D1 database to bind to.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDataBlob struct{…}
Name string

A JavaScript variable name for the binding.

Part string

The name of the file containing the data content. Only accepted for service worker syntax Workers.

DeprecatedType DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDataBlobType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespace struct{…}
Name string

A JavaScript variable name for the binding.

Namespace string

The name of the dispatch namespace.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceType

The kind of resource that the binding provides.

Outbound DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceOutboundOptional

Outbound worker.

Params []DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceOutboundParamOptional

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

Name string

Name of the parameter.

Worker DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceOutboundWorkerOptional

Outbound worker.

Entrypoint stringOptional

Entrypoint to invoke on the outbound worker.

Environment stringOptional

Environment of the outbound worker.

Service stringOptional

Name of the outbound worker.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDurableObjectNamespace struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDurableObjectNamespaceType

The kind of resource that the binding provides.

ClassName stringOptional

The exported class name of the Durable Object.

DispatchNamespace stringOptional

The dispatch namespace the Durable Object script belongs to.

Environment stringOptional

The environment of the script_name to bind to.

NamespaceID stringOptional

Namespace identifier tag.

maxLength32
ScriptName stringOptional

The script where the Durable Object is defined, if it is external to this Worker.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindHyperdrive struct{…}
ID string

Identifier of the Hyperdrive connection to bind to.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindHyperdriveType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindInherit struct{…}
Name string

The name of the inherited binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindInheritType

The kind of resource that the binding provides.

OldName stringOptional

The old name of the inherited binding. If set, the binding will be renamed from old_name to name in the new version. If not set, the binding will keep the same name between versions.

VersionID stringOptional

Identifier for the version to inherit the binding from, which can be the version ID or the literal “latest” to inherit from the latest version. Defaults to inheriting the binding from the latest version.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindImages struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindImagesType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindJson struct{…}
Json unknown

JSON data to use.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindJsonType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindKVNamespace struct{…}
Name string

A JavaScript variable name for the binding.

NamespaceID string

Namespace identifier tag.

maxLength32
Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindKVNamespaceType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMedia struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMediaType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMTLSCertificate struct{…}
CertificateID string

Identifier of the certificate to bind to.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMTLSCertificateType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPlainText struct{…}
Name string

A JavaScript variable name for the binding.

Text string

The text value to use.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPlainTextType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPipelines struct{…}
Name string

A JavaScript variable name for the binding.

Pipeline string

Name of the Pipeline to bind to.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPipelinesType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindQueue struct{…}
Name string

A JavaScript variable name for the binding.

QueueName string

Name of the Queue to bind to.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindQueueType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimit struct{…}
Name string

A JavaScript variable name for the binding.

NamespaceID string

Identifier of the rate limit namespace to bind to.

Simple DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimitSimple

The rate limit configuration.

Limit float64

The limit (requests per period).

Period int64

The period in seconds.

MitigationTimeout int64Optional

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

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimitType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2Bucket struct{…}
BucketName string

R2 bucket to bind to.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketType

The kind of resource that the binding provides.

Jurisdiction DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionOptional

The jurisdiction of the R2 bucket.

One of the following:
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionEu DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction = "eu"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionFedramp DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction = "fedramp"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionFedrampHigh DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction = "fedramp-high"
type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretText struct{…}
Name string

A JavaScript variable name for the binding.

Text string

The secret value to use.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretTextType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSendEmail struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSendEmailType

The kind of resource that the binding provides.

AllowedDestinationAddresses []stringOptional

List of allowed destination addresses.

AllowedSenderAddresses []stringOptional

List of allowed sender addresses.

DestinationAddress stringOptional

Destination address for the email.

formatemail
type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindService struct{…}
Name string

A JavaScript variable name for the binding.

Service string

Name of Worker to bind to.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindServiceType

The kind of resource that the binding provides.

Entrypoint stringOptional

Entrypoint to invoke on the target Worker.

Environment stringOptional

Optional environment if the Worker utilizes one.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindTextBlob struct{…}
Name string

A JavaScript variable name for the binding.

Part string

The name of the file containing the text content. Only accepted for service worker syntax Workers.

DeprecatedType DispatchNamespaceScriptBindingGetResponseWorkersBindingKindTextBlobType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVectorize struct{…}
IndexName string

Name of the Vectorize index to bind to.

Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVectorizeType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVersionMetadata struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVersionMetadataType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretsStoreSecret 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 DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretsStoreSecretType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindFlagship struct{…}
AppID string

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

maxLength128
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindFlagshipType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKey struct{…}
Algorithm unknown

Algorithm-specific key parameters. Learn more.

Format DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat

Data format of the key. Learn more.

One of the following:
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "raw"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "pkcs8"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "spki"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "jwk"
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyType

The kind of resource that the binding provides.

Usages []DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage

Allowed operations with the key. Learn more.

One of the following:
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "encrypt"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "decrypt"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "sign"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "verify"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "deriveKey"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "deriveBits"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "wrapKey"
const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"
KeyBase64 stringOptional

Base64-encoded key data. Required if format is “raw”, “pkcs8”, or “spki”.

KeyJwk unknownOptional

Key data in JSON Web Key format. Required if format is “jwk”.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWorkflow struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWorkflowType

The kind of resource that the binding provides.

WorkflowName string

Name of the Workflow to bind to.

ClassName stringOptional

Class name of the Workflow. Should only be provided if the Workflow belongs to this script.

ScriptName stringOptional

Script name that contains the Workflow. If not provided, defaults to this script name.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWasmModule struct{…}
Name string

A JavaScript variable name for the binding.

Part string

The name of the file containing the WebAssembly module content. Only accepted for service worker syntax Workers.

DeprecatedType DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWasmModuleType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCService struct{…}
Name string

A JavaScript variable name for the binding.

ServiceID string

Identifier of the VPC service to bind to.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCServiceType

The kind of resource that the binding provides.

type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCNetwork struct{…}
Name string

A JavaScript variable name for the binding.

Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCNetworkType

The kind of resource that the binding provides.

NetworkID stringOptional

Identifier of the network to bind to. Only “cf1:network” is currently supported. Mutually exclusive with tunnel_id.

TunnelID stringOptional

UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id.

Get Script Bindings

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/workers_for_platforms"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Bindings.Get(
    context.TODO(),
    "my-dispatch-namespace",
    "this-is_my_script-01",
    workers_for_platforms.DispatchNamespaceScriptBindingGetParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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": [
    {
      "name": "MY_ENV_VAR",
      "text": "my_data",
      "type": "plain_text"
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "name": "MY_ENV_VAR",
      "text": "my_data",
      "type": "plain_text"
    }
  ],
  "success": true
}