Hanzo
OpenapiCloudflare

Binds a URL pattern in a zone to a Worker script.

Binds a URL pattern in a zone to a Worker script.

POST /v1/cloudflare/workers/zones/{zone}/routes

Addresshttps://api.hanzo.ai/v1/cloudflare/workers/zones/{zone}/routes
MethodPOST
Operationpost_cloudflare_workers_zones_by_zone_routes
AuthAuthorization: Bearer $HANZO_API_KEY

Binds a URL pattern in a zone to a Worker script. Requires org admin — a route is what puts a script in front of live traffic.

Request

4 fields, body application/json (required).

FieldInTypeRequiredDescription
zonepathstringyesZone is the 32-hex Cloudflare zone id, from the path.
patternbodystringPattern is the URL pattern to bind, e.g.
scriptbodystringScript is the Worker script to dispatch to.
zonebodystringZone is the 32-hex Cloudflare zone id, from the path.

Response

StatusBodyMeaning
200ok

200 body — 1 field.

FieldInTypeAlwaysDescription
(body)bodyanyyes

Failure carries the platform error shape — see Errors.

Examples

hanzo cloudflare workers zones routes create <zone>

Cloudflare API · All Hanzo APIs · Interactive reference

How is this guide?

On this page