Skip to content
Start here

Get Settings

workers.scripts.script_and_version_settings.get(strscript_name, ScriptAndVersionSettingGetParams**kwargs) -> ScriptAndVersionSettingGetResponse
GET/accounts/{account_id}/workers/scripts/{script_name}/settings

Get metadata and config, such as bindings or usage model.

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
account_id: str

Identifier.

maxLength32
script_name: str

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

ReturnsExpand Collapse
class ScriptAndVersionSettingGetResponse:
annotations: Optional[Annotations]

Annotations for the Worker version. Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.

workers_message: Optional[str]

Human-readable message about the version.

maxLength100
workers_tag: Optional[str]

User-provided identifier for the version.

maxLength25
workers_triggered_by: Optional[str]

Operation that triggered the creation of the version. This is read-only and set by the server.

bindings: Optional[List[Binding]]

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.

One of the following:
class BindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAISearch:
instance_name: str

The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance.

name: str

A JavaScript variable name for the binding.

type: Literal["ai_search"]

The kind of resource that the binding provides.

namespace: Optional[str]

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

class BindingWorkersBindingKindAISearchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

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: Literal["ai_search_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAnalyticsEngine:
dataset: str

The name of the dataset to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["analytics_engine"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindD1:
id: str

Identifier of the D1 database to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["d1"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDataBlob:
name: str

A JavaScript variable name for the binding.

part: str

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

Deprecatedtype: Literal["data_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindDispatchNamespace:
name: str

A JavaScript variable name for the binding.

namespace: str

The name of the dispatch namespace.

type: Literal["dispatch_namespace"]

The kind of resource that the binding provides.

outbound: Optional[BindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[BindingWorkersBindingKindDispatchNamespaceOutboundParam]]

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

name: str

Name of the parameter.

worker: Optional[BindingWorkersBindingKindDispatchNamespaceOutboundWorker]

Outbound worker.

entrypoint: Optional[str]

Entrypoint to invoke on the outbound worker.

environment: Optional[str]

Environment of the outbound worker.

service: Optional[str]

Name of the outbound worker.

class BindingWorkersBindingKindDurableObjectNamespace:
name: str

A JavaScript variable name for the binding.

type: Literal["durable_object_namespace"]

The kind of resource that the binding provides.

class_name: Optional[str]

The exported class name of the Durable Object.

dispatch_namespace: Optional[str]

The dispatch namespace the Durable Object script belongs to.

environment: Optional[str]

The environment of the script_name to bind to.

namespace_id: Optional[str]

Namespace identifier tag.

maxLength32
script_name: Optional[str]

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

class BindingWorkersBindingKindHyperdrive:
id: str

Identifier of the Hyperdrive connection to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["hyperdrive"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindInherit:
name: str

The name of the inherited binding.

type: Literal["inherit"]

The kind of resource that the binding provides.

old_name: Optional[str]

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.

version_id: Optional[str]

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.

class BindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindJson:
json: object

JSON data to use.

name: str

A JavaScript variable name for the binding.

type: Literal["json"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindKVNamespace:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Namespace identifier tag.

maxLength32
type: Literal["kv_namespace"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindMTLSCertificate:
certificate_id: str

Identifier of the certificate to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["mtls_certificate"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPlainText:
name: str

A JavaScript variable name for the binding.

text: str

The text value to use.

type: Literal["plain_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindPipelines:
name: str

A JavaScript variable name for the binding.

pipeline: str

Name of the Pipeline to bind to.

type: Literal["pipelines"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindQueue:
name: str

A JavaScript variable name for the binding.

queue_name: str

Name of the Queue to bind to.

type: Literal["queue"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: BindingWorkersBindingKindRatelimitSimple

The rate limit configuration.

limit: float

The limit (requests per period).

period: int

The period in seconds.

type: Literal["ratelimit"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindR2Bucket:
bucket_name: str

R2 bucket to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["r2_bucket"]

The kind of resource that the binding provides.

jurisdiction: Optional[Literal["eu", "fedramp", "fedramp-high"]]

The jurisdiction of the R2 bucket.

One of the following:
"eu"
"fedramp"
"fedramp-high"
class BindingWorkersBindingKindSecretText:
name: str

A JavaScript variable name for the binding.

text: str

The secret value to use.

type: Literal["secret_text"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSendEmail:
name: str

A JavaScript variable name for the binding.

type: Literal["send_email"]

The kind of resource that the binding provides.

allowed_destination_addresses: Optional[List[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[List[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class BindingWorkersBindingKindService:
name: str

A JavaScript variable name for the binding.

service: str

Name of Worker to bind to.

type: Literal["service"]

The kind of resource that the binding provides.

entrypoint: Optional[str]

Entrypoint to invoke on the target Worker.

environment: Optional[str]

Optional environment if the Worker utilizes one.

class BindingWorkersBindingKindTextBlob:
name: str

A JavaScript variable name for the binding.

part: str

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

Deprecatedtype: Literal["text_blob"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVectorize:
index_name: str

Name of the Vectorize index to bind to.

name: str

A JavaScript variable name for the binding.

type: Literal["vectorize"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretsStoreSecret:
name: str

A JavaScript variable name for the binding.

secret_name: str

Name of the secret in the store.

store_id: str

ID of the store containing the secret.

type: Literal["secrets_store_secret"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindSecretKey:
algorithm: object

Algorithm-specific key parameters. Learn more.

format: Literal["raw", "pkcs8", "spki", "jwk"]

Data format of the key. Learn more.

One of the following:
"raw"
"pkcs8"
"spki"
"jwk"
name: str

A JavaScript variable name for the binding.

type: Literal["secret_key"]

The kind of resource that the binding provides.

usages: List[Literal["encrypt", "decrypt", "sign", 5 more]]

Allowed operations with the key. Learn more.

One of the following:
"encrypt"
"decrypt"
"sign"
"verify"
"deriveKey"
"deriveBits"
"wrapKey"
"unwrapKey"
key_base64: Optional[str]

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

key_jwk: Optional[object]

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

class BindingWorkersBindingKindWorkflow:
name: str

A JavaScript variable name for the binding.

type: Literal["workflow"]

The kind of resource that the binding provides.

workflow_name: str

Name of the Workflow to bind to.

class_name: Optional[str]

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

script_name: Optional[str]

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

class BindingWorkersBindingKindWasmModule:
name: str

A JavaScript variable name for the binding.

part: str

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

Deprecatedtype: Literal["wasm_module"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCService:
name: str

A JavaScript variable name for the binding.

service_id: str

Identifier of the VPC service to bind to.

type: Literal["vpc_service"]

The kind of resource that the binding provides.

class BindingWorkersBindingKindVPCNetwork:
name: str

A JavaScript variable name for the binding.

type: Literal["vpc_network"]

The kind of resource that the binding provides.

network_id: Optional[str]

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

tunnel_id: Optional[str]

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

compatibility_date: Optional[str]

Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.

compatibility_flags: Optional[List[str]]

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: Optional[Limits]

Limits to apply for this Worker.

cpu_ms: Optional[int]

The amount of CPU time this Worker can use in milliseconds.

logpush: Optional[bool]

Whether Logpush is turned on for the Worker.

migrations: Optional[Migrations]

Migrations to apply for Durable Objects associated with this Worker.

One of the following:
class SingleStepMigration:

A single set of migrations to apply.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don’t match, the upload is rejected.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
class MigrationsWorkersMultipleStepMigrations:
new_tag: Optional[str]

Tag to set as the latest migration tag.

old_tag: Optional[str]

Tag used to verify against the latest migration tag for this Worker. If they don’t match, the upload is rejected.

steps: Optional[List[MigrationStep]]

Migrations to apply in order.

deleted_classes: Optional[List[str]]

A list of classes to delete Durable Object namespaces from.

new_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces from.

new_sqlite_classes: Optional[List[str]]

A list of classes to create Durable Object namespaces with SQLite from.

renamed_classes: Optional[List[RenamedClass]]

A list of classes with Durable Object namespaces that were renamed.

from_: Optional[str]
to: Optional[str]
transferred_classes: Optional[List[TransferredClass]]

A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker.

from_: Optional[str]
from_script: Optional[str]
to: Optional[str]
observability: Optional[Observability]

Observability settings for the Worker.

enabled: bool

Whether observability is enabled for the Worker.

head_sampling_rate: Optional[float]

The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

logs: Optional[ObservabilityLogs]

Log settings for the Worker.

enabled: bool

Whether logs are enabled for the Worker.

invocation_logs: bool

Whether invocation logs are enabled for the Worker.

destinations: Optional[List[str]]

A list of destinations where logs will be exported to.

head_sampling_rate: Optional[float]

The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

persist: Optional[bool]

Whether log persistence is enabled for the Worker.

traces: Optional[ObservabilityTraces]

Trace settings for the Worker.

destinations: Optional[List[str]]

A list of destinations where traces will be exported to.

enabled: Optional[bool]

Whether traces are enabled for the Worker.

head_sampling_rate: Optional[float]

The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.

persist: Optional[bool]

Whether trace persistence is enabled for the Worker.

placement: Optional[Placement]

Configuration for Smart Placement. Specify mode=‘smart’ for Smart Placement, or one of region/hostname/host.

One of the following:
class PlacementMode:
mode: Literal["smart"]
class PlacementRegion:
region: str

Cloud region for targeted placement in format ‘provider:region’.

class PlacementHostname:
hostname: str

HTTP hostname for targeted placement.

class PlacementHost:
host: str

TCP host and port for targeted placement.

class PlacementUnionMember4:
mode: Literal["targeted"]

Targeted placement mode.

region: str

Cloud region for targeted placement in format ‘provider:region’.

class PlacementUnionMember5:
hostname: str

HTTP hostname for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

class PlacementUnionMember6:
host: str

TCP host and port for targeted placement.

mode: Literal["targeted"]

Targeted placement mode.

class PlacementUnionMember7:
mode: Literal["targeted"]

Targeted placement mode.

target: List[PlacementUnionMember7Target]

Array of placement targets (currently limited to single target).

One of the following:
class PlacementUnionMember7TargetRegion:
region: str

Cloud region in format ‘provider:region’.

class PlacementUnionMember7TargetHostname:
hostname: str

HTTP hostname for targeted placement.

class PlacementUnionMember7TargetHost:
host: str

TCP host:port for targeted placement.

tags: Optional[List[str]]

Tags associated with the Worker.

tail_consumers: Optional[List[ConsumerScript]]

List of Workers that will consume logs from the attached Worker.

service: str

Name of Worker that is to be the consumer.

environment: Optional[str]

Optional environment if the Worker utilizes one.

namespace: Optional[str]

Optional dispatch namespace the script belongs to.

usage_model: Optional[Literal["standard", "bundled", "unbound"]]

Usage model for the Worker invocations.

One of the following:
"standard"
"bundled"
"unbound"

Get Settings

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
script_and_version_setting = client.workers.scripts.script_and_version_settings.get(
    script_name="this-is_my_script-01",
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(script_and_version_setting.annotations)
{
  "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
}
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": {
    "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
}