Skip to content
Start here

Upload Version

workers.scripts.versions.create(strscript_name, VersionCreateParams**kwargs) -> VersionCreateResponse
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/.

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 Scripts Write
ParametersExpand Collapse
account_id: str

Identifier.

maxLength32
script_name: str

Name of the script.

metadata: Metadata

JSON-encoded metadata about the uploaded parts and Worker configuration.

main_module: str

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: Optional[MetadataAnnotations]
workers_alias: Optional[str]

Associated alias for a version.

maxLength63
workers_message: Optional[str]

Human-readable message about the version. Truncated to 100 bytes.

maxLength100
workers_tag: Optional[str]

User-provided identifier for the version.

maxLength25
bindings: Optional[Iterable[MetadataBinding]]

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 MetadataBindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class MetadataBindingWorkersBindingKindAISearch:
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 MetadataBindingWorkersBindingKindAISearchNamespace:
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 MetadataBindingWorkersBindingKindAnalyticsEngine:
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 MetadataBindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class MetadataBindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class MetadataBindingWorkersBindingKindD1:
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 MetadataBindingWorkersBindingKindDataBlob:
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 MetadataBindingWorkersBindingKindDispatchNamespace:
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[MetadataBindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[Iterable[MetadataBindingWorkersBindingKindDispatchNamespaceOutboundParam]]

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

name: str

Name of the parameter.

worker: Optional[MetadataBindingWorkersBindingKindDispatchNamespaceOutboundWorker]

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 MetadataBindingWorkersBindingKindDurableObjectNamespace:
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 MetadataBindingWorkersBindingKindHyperdrive:
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 MetadataBindingWorkersBindingKindInherit:
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 MetadataBindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class MetadataBindingWorkersBindingKindJson:
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 MetadataBindingWorkersBindingKindKVNamespace:
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 MetadataBindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class MetadataBindingWorkersBindingKindMTLSCertificate:
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 MetadataBindingWorkersBindingKindPlainText:
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 MetadataBindingWorkersBindingKindPipelines:
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 MetadataBindingWorkersBindingKindQueue:
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 MetadataBindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: MetadataBindingWorkersBindingKindRatelimitSimple

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 MetadataBindingWorkersBindingKindR2Bucket:
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 MetadataBindingWorkersBindingKindSecretText:
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 MetadataBindingWorkersBindingKindSendEmail:
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[SequenceNotStr[str]]

List of allowed destination addresses.

allowed_sender_addresses: Optional[SequenceNotStr[str]]

List of allowed sender addresses.

destination_address: Optional[str]

Destination address for the email.

formatemail
class MetadataBindingWorkersBindingKindService:
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 MetadataBindingWorkersBindingKindTextBlob:
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 MetadataBindingWorkersBindingKindVectorize:
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 MetadataBindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class MetadataBindingWorkersBindingKindSecretsStoreSecret:
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 MetadataBindingWorkersBindingKindSecretKey:
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 MetadataBindingWorkersBindingKindWorkflow:
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 MetadataBindingWorkersBindingKindWasmModule:
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 MetadataBindingWorkersBindingKindVPCService:
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 MetadataBindingWorkersBindingKindVPCNetwork:
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[SequenceNotStr[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.

keep_bindings: Optional[SequenceNotStr[str]]

List of binding types to keep from previous_upload.

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

Usage model for the Worker invocations.

One of the following:
"standard"
"bundled"
"unbound"
bindings_inherit: Optional[Literal["strict"]]

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.

files: Optional[SequenceNotStr[FileTypes]]

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.

ReturnsExpand Collapse
class VersionCreateResponse:
resources: Resources
bindings: Optional[List[ResourcesBinding]]

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 ResourcesBindingWorkersBindingKindAI:
name: str

A JavaScript variable name for the binding.

type: Literal["ai"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindAISearch:
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 ResourcesBindingWorkersBindingKindAISearchNamespace:
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 ResourcesBindingWorkersBindingKindAnalyticsEngine:
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 ResourcesBindingWorkersBindingKindAssets:
name: str

A JavaScript variable name for the binding.

type: Literal["assets"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindBrowser:
name: str

A JavaScript variable name for the binding.

type: Literal["browser"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindD1:
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 ResourcesBindingWorkersBindingKindDataBlob:
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 ResourcesBindingWorkersBindingKindDispatchNamespace:
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[ResourcesBindingWorkersBindingKindDispatchNamespaceOutbound]

Outbound worker.

params: Optional[List[ResourcesBindingWorkersBindingKindDispatchNamespaceOutboundParam]]

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

name: str

Name of the parameter.

worker: Optional[ResourcesBindingWorkersBindingKindDispatchNamespaceOutboundWorker]

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 ResourcesBindingWorkersBindingKindDurableObjectNamespace:
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 ResourcesBindingWorkersBindingKindHyperdrive:
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 ResourcesBindingWorkersBindingKindInherit:
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 ResourcesBindingWorkersBindingKindImages:
name: str

A JavaScript variable name for the binding.

type: Literal["images"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindJson:
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 ResourcesBindingWorkersBindingKindKVNamespace:
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 ResourcesBindingWorkersBindingKindMedia:
name: str

A JavaScript variable name for the binding.

type: Literal["media"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindMTLSCertificate:
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 ResourcesBindingWorkersBindingKindPlainText:
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 ResourcesBindingWorkersBindingKindPipelines:
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 ResourcesBindingWorkersBindingKindQueue:
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 ResourcesBindingWorkersBindingKindRatelimit:
name: str

A JavaScript variable name for the binding.

namespace_id: str

Identifier of the rate limit namespace to bind to.

simple: ResourcesBindingWorkersBindingKindRatelimitSimple

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 ResourcesBindingWorkersBindingKindR2Bucket:
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 ResourcesBindingWorkersBindingKindSecretText:
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 ResourcesBindingWorkersBindingKindSendEmail:
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 ResourcesBindingWorkersBindingKindService:
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 ResourcesBindingWorkersBindingKindTextBlob:
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 ResourcesBindingWorkersBindingKindVectorize:
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 ResourcesBindingWorkersBindingKindVersionMetadata:
name: str

A JavaScript variable name for the binding.

type: Literal["version_metadata"]

The kind of resource that the binding provides.

class ResourcesBindingWorkersBindingKindSecretsStoreSecret:
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 ResourcesBindingWorkersBindingKindSecretKey:
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 ResourcesBindingWorkersBindingKindWorkflow:
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 ResourcesBindingWorkersBindingKindWasmModule:
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 ResourcesBindingWorkersBindingKindVPCService:
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 ResourcesBindingWorkersBindingKindVPCNetwork:
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.

script: Optional[ResourcesScript]
etag: Optional[str]

Hashed script content

handlers: Optional[List[str]]

The names of handlers exported as part of the default export.

last_deployed_from: Optional[str]

The client most recently used to deploy this Worker.

named_handlers: Optional[List[ResourcesScriptNamedHandler]]

Named exports, such as Durable Object class implementations and named entrypoints.

handlers: Optional[List[str]]

The names of handlers exported as part of the named export.

name: Optional[str]

The name of the exported class or entrypoint.

script_runtime: Optional[ResourcesScriptRuntime]

Runtime configuration for the Worker.

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.

limits: Optional[ResourcesScriptRuntimeLimits]

Resource limits for the Worker.

cpu_ms: Optional[int]

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

migration_tag: Optional[str]

The tag of the Durable Object migration that was most recently applied for this Worker.

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

Usage model for the Worker invocations.

One of the following:
"bundled"
"unbound"
"standard"
id: Optional[str]

Unique identifier for the version.

metadata: Optional[Metadata]
author_email: Optional[str]

Email of the user who created the version.

author_id: Optional[str]

Identifier of the user who created the version.

created_on: Optional[str]

When the version was created.

has_preview: Optional[bool]

Whether the version can be previewed.

modified_on: Optional[str]

When the version was last modified.

source: Optional[Literal["unknown", "api", "wrangler", 7 more]]

The source of the version upload.

One of the following:
"unknown"
"api"
"wrangler"
"terraform"
"dash"
"dash_template"
"integration"
"quick_editor"
"playground"
"workersci"
number: Optional[float]

Sequential version number.

startup_time_ms: Optional[int]

Time in milliseconds spent on Worker startup.

Upload Version

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
version = client.workers.scripts.versions.create(
    script_name="this-is_my_script-01",
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
    metadata={
        "main_module": "worker.js"
    },
)
print(version.id)
{
  "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
}
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": {
    "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
}