Search + K

Command Palette

Search for a command to run...

Sign In

Put Script Content

PUT /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content
Copy endpoint
https://api.cloudflare.com/client/v4

Put script content for a script uploaded to a Workers for Platforms namespace.

Parameters

path Path Parameters

Name Type
account_id required
type WorkersIdentifier = string
dispatch_namespace required
type WorkersDispatchNamespaceName = string
script_name required
type WorkersScriptName = string

header Header Parameters

Name Type
CF-WORKER-BODY-PART

The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.

string
CF-WORKER-MAIN-MODULE-PART

The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.

string

Request Body

multipart/form-data required
{ files?: string[];metadata: { body_part?: string;main_module?: string; }; }

Responses

200 application/json

Put script content (Workers for Platforms).

type WorkersScriptResponseSingle = type WorkersApiResponseSingle = interface WorkersApiResponseCommon {
errors: WorkersMessages
type WorkersMessages = {
code: number;
documentation_url?: string;
message: string;
source?: { pointer?: string; };
}
[]
;
messages: WorkersMessages
type WorkersMessages = {
code: number;
documentation_url?: string;
message: string;
source?: { pointer?: string; };
}
[]
;
success: true;
}
& {}
& { result: WorkersScriptResponse
interface WorkersScriptResponse {
compatibility_date?: WorkersCompatibilityDate;
compatibility_flags?: WorkersCompatibilityFlags;
created_on?: WorkersCreatedOn;
etag?: WorkersEtag;
handlers?: string[];
has_assets?: WorkersHasAssets;
has_modules?: WorkersHasModules;
id?: string;
last_deployed_from?: string;
logpush?: WorkersLogpush;
migration_tag?: string;
modified_on?: WorkersModifiedOn;
named_handlers?: { handlers?: string[];name?: string; }[];
placement?: WorkersPlacementInfo;
placement_mode?: WorkersPlacementMode & string;
placement_status?: WorkersPlacementStatus & string;
tail_consumers?: WorkersTailConsumers;
usage_model?: WorkersUsageModel;
}
; }

Client Errors

4XX application/json

Put script content failure (Workers for Platforms).

interface WorkersApiResponseCommonFailure {
errors: WorkersMessages
type WorkersMessages = {
code: number;
documentation_url?: string;
message: string;
source?: { pointer?: string; };
}
[]
;
messages: WorkersMessages
type WorkersMessages = {
code: number;
documentation_url?: string;
message: string;
source?: { pointer?: string; };
}
[]
;
result: null;
success: false;
}