Skip to main content
The Workers API allows you to create, deploy, and manage Cloudflare Workers scripts, routes, and settings.

Overview

Access the Workers API through the SDK:

Scripts

Manage Worker scripts and their versions.

Upload a worker script

Create or update a Worker script with module syntax.
string
required
Your Cloudflare account ID
string
required
Name of the main module file (e.g., ‘worker.mjs’)
string
required
Date in YYYY-MM-DD format for Workers runtime compatibility
array
required
Array of module objects containing the script code and metadata
array
Environment bindings (KV, Durable Objects, secrets, etc.)
string
The version ID
string
The main module name
string
ISO 8601 timestamp when the version was created

List worker scripts

Retrieve all Worker scripts in your account.
string
required
Your Cloudflare account ID

Get worker script

Retrieve details about a specific Worker script.

Delete worker script

Delete a Worker script.

Routes

Manage routes that trigger your Workers.

Create a route

Create a route to trigger a Worker on specific URL patterns.
string
required
The zone identifier
string
required
URL pattern that triggers the Worker (e.g., ‘example.com/*’)
string
Name of the Worker script to execute

List routes

Retrieve all routes in a zone.

Update a route

Modify an existing route.

Delete a route

Deployments

Manage Worker deployments and traffic routing.

Create a deployment

Deploy a Worker version with traffic percentage allocation.
string
required
Deployment strategy (e.g., ‘percentage’)
array
required
Array of version objects with traffic percentage allocation

Subdomains

Manage workers.dev subdomain settings.

Get subdomain

Retrieve the workers.dev subdomain for your account.

Update subdomain

Configure the workers.dev subdomain.

Domains

Manage custom domains for Workers.

List domains

Get domain

Account settings

Manage account-level Worker settings.

Get account settings

Update account settings