Skip to content
Start here

List Versions

workers.scripts.versions.list(strscript_name, VersionListParams**kwargs) -> SyncV4PagePagination[VersionListResponse]
GET/accounts/{account_id}/workers/scripts/{script_name}/versions

List of Worker Versions. The first version in the list is the latest version.

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.

deployable: Optional[bool]

Only return versions that can be used in a deployment. Ignores pagination.

page: Optional[int]

Current page.

per_page: Optional[int]

Items per-page.

ReturnsExpand Collapse
class VersionListResponse:
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.

List Versions

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
page = client.workers.scripts.versions.list(
    script_name="this-is_my_script-01",
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result.items[0]
print(page.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": {
    "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
}
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": {
    "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
}