Hanzo
OpenapiCloudflare

Upload or replace a module Worker script

Publishes a module Worker to the org's OWN Cloudflare account under the name in the path, replacing whatever was there, and relays Cloudflare's result.

PUT /v1/cloudflare/workers/scripts/{script}

Addresshttps://api.hanzo.ai/v1/cloudflare/workers/scripts/{script}
MethodPUT
Operationput_cloudflare_workers_scripts_by_script
AuthAuthorization: Bearer $HANZO_API_KEY

Publishes a module Worker to the org's OWN Cloudflare account under the name in the path, replacing whatever was there, and relays Cloudflare's result. script carries the module SOURCE; the optional compatibility date, compatibility flags and bindings are packed into the multipart upload Cloudflare expects.

The path names the script and the body field named script is its source — two different things that share a name, which is exactly why this cannot be a typed op: a binder that gives the URL the last word would overwrite the source with the script's name. Requires ORG ADMIN (403 otherwise); an unparseable body or empty source is 400; 503 if the org has never connected a Cloudflare token.

Request

6 fields, body application/json.

FieldInTypeRequiredDescription
scriptpathstringyes
bindingsbodyany
compatibilityDatebodystring
compatibilityFlagsbodystring[]
mainModulebodystring
scriptbodystring

Response

StatusBodyMeaning
2XXSuccess

2XX body — 1 field.

FieldInTypeAlwaysDescription
(body)bodyanyyes

Failure carries the platform error shape — see Errors.

Examples

hanzo cloudflare workers scripts set <script>

Cloudflare API · All Hanzo APIs · Interactive reference

How is this guide?

On this page