Skip to content
Start here

Delete Version

client.Workers.Beta.Workers.Versions.Delete(ctx, workerID, versionID, body) (*BetaWorkerVersionDeleteResponse, error)
DELETE/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}

Delete a 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
ParametersExpand Collapse
workerID string

Identifier for the Worker, which can be ID or name.

versionID string

Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal “latest” to operate on the most recently created version.

body BetaWorkerVersionDeleteParams
AccountID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type BetaWorkerVersionDeleteResponse struct{…}
Errors []BetaWorkerVersionDeleteResponseError
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source BetaWorkerVersionDeleteResponseErrorsSourceoptional
Pointer stringoptional
Messages []BetaWorkerVersionDeleteResponseMessage
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source BetaWorkerVersionDeleteResponseMessagesSourceoptional
Pointer stringoptional
Success BetaWorkerVersionDeleteResponseSuccess

Whether the API call was successful.

Delete Version

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  version, err := client.Workers.Beta.Workers.Versions.Delete(
    context.TODO(),
    "worker_id",
    "version_id",
    workers.BetaWorkerVersionDeleteParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", version.Errors)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "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"
      }
    }
  ],
  "success": true
}