Skip to main content

bindings

Creates, updates, deletes, gets or lists a bindings resource.

Overview

Namebindings
TypeResource
Idcloudflare.workers_for_platforms.bindings

Fields

The following fields are returned by SELECT queries:

Fetch script bindings (Workers for Platforms).

NameDatatypeDescription
idstringIdentifier of the D1 database to bind to. (example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, x-stainless-deprecation-message: This property has been renamed to database_id.)
namestringA JavaScript variable name for the binding. (example: myBinding)
app_idstringID of the Flagship app to bind to for feature flag evaluation. (example: app-12345678-1234-1234-1234-123456789012)
certificate_idstringIdentifier of the certificate to bind to. (example: efwu2n6s-q69d-2kr9-184j-4913e8h391k6)
database_idstringIdentifier of the D1 database to bind to. (example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
namespace_idstringNamespace identifier tag. (x-stainless-terraform-configurability: computed_optional, example: 0f2ac74b498b48028cb68387c421e279)
network_idstringIdentifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. (example: cf1:network)
service_idstringIdentifier of the VPC service to bind to. (example: 8c8b1387108e49be85669169793e7bd2)
store_idstringID of the store containing the secret. (example: 8c8b1387108e49be85669169793e7bd2)
tunnel_idstringUUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. (example: abcd1234-5678-90ef-ghij-klmnopqrstuv)
version_idstringIdentifier 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. (default: latest, example: 8969331f-7192-434c-9938-6aea24ed58bf)
bucket_namestringR2 bucket to bind to. (example: my-r2-bucket)
class_namestringThe exported class name of the Durable Object. (example: MyDurableObject, x-stainless-terraform-configurability: computed_optional)
index_namestringName of the Vectorize index to bind to. (example: my-index-name)
instance_namestringThe user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. (example: cloudflare-blog)
old_namestringThe 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. (example: MY_OLD_BINDING)
queue_namestringName of the Queue to bind to. (example: my-queue)
script_namestringThe script where the Durable Object is defined, if it is external to this Worker. (example: my-other-worker, x-stainless-terraform-configurability: computed_optional)
secret_namestringName of the secret in the store. (example: my_secret)
workflow_namestringName of the Workflow to bind to. (example: my-workflow)
algorithmobjectAlgorithm-specific key parameters. Learn more.
allowed_destination_addressesarrayList of allowed destination addresses.
allowed_sender_addressesarrayList of allowed sender addresses.
datasetstringThe name of the dataset to bind to. (example: some_dataset)
destination_addressstring (email)Destination address for the email. (example: user@example.com)
dispatch_namespacestringThe dispatch namespace the Durable Object script belongs to. (example: my-dispatch-namespace)
entrypointstringEntrypoint to invoke on the target Worker. (example: MyHandler)
environmentstringThe environment of the script_name to bind to. (example: production)
formatstringData format of the key. Learn more. (raw, pkcs8, spki, jwk) (example: raw)
jsonobjectJSON data to use.
jurisdictionstringThe jurisdiction of the R2 bucket. (eu, fedramp, fedramp-high) (example: eu)
key_base64stringBase64-encoded key data. Required if format is "raw", "pkcs8", or "spki".
key_jwkobjectKey data in JSON Web Key format. Required if format is "jwk".
namespacestringThe namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. (example: production)
outboundobjectOutbound worker.
partstringThe name of the file containing the data content. Only accepted for service worker syntax Workers. (example: my-module.bin)
pipelinestringName of the Pipeline to bind to. (example: my-pipeline)
servicestringName of Worker to bind to. (example: my-worker)
simpleobjectThe rate limit configuration.
textstringThe text value to use. (example: Hello, world!)
typestringThe kind of resource that the binding provides. (ai)
usagesarrayAllowed operations with the key. Learn more. (x-stainless-collection-type: set)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_id, dispatch_namespace, script_nameFetch script bindings from a script uploaded to a Workers for Platforms namespace.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
dispatch_namespacestringThe Workers-for-Platforms dispatch namespace.
script_namestringThe Worker script name.

SELECT examples

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

SELECT
id,
name,
app_id,
certificate_id,
database_id,
namespace_id,
network_id,
service_id,
store_id,
tunnel_id,
version_id,
bucket_name,
class_name,
index_name,
instance_name,
old_name,
queue_name,
script_name,
secret_name,
workflow_name,
algorithm,
allowed_destination_addresses,
allowed_sender_addresses,
dataset,
destination_address,
dispatch_namespace,
entrypoint,
environment,
format,
json,
jurisdiction,
key_base64,
key_jwk,
namespace,
outbound,
part,
pipeline,
service,
simple,
text,
type,
usages
FROM cloudflare.workers_for_platforms.bindings
WHERE account_id = '{{ account_id }}' -- required
AND dispatch_namespace = '{{ dispatch_namespace }}' -- required
AND script_name = '{{ script_name }}' -- required
;