Multipart upload metadata
If you're using the Workers Script Upload API or Version Upload API directly, multipart/form-data
uploads require you to specify a metadata
part. This metadata defines the Worker's configuration in JSON format, analogue to the wrangler.toml file.
The following attributes are configurable at the top-level.
-
main_module
string required- The part name that contains the module entry point of the Worker that will be executed. For example,
main.js
.
- The part name that contains the module entry point of the Worker that will be executed. For example,
-
assets
object optional- Asset configuration for a Worker.
config
object optional- html_handling determines the redirects and rewrites of requests for HTML content.
- not_found_handling determines the response when a request does not match a static asset, and there is no Worker script.
jwt
field provides a token authorizing assets to be attached to a Worker.
-
keep_assets
boolean optional- Specifies whether assets should be retained from a previously uploaded Worker version; used in lieu of providing a completion token.
-
bindings
array[object] optional- Bindings to expose in the Worker.
-
placement
object optional- Smart placement object for the Worker.
mode
field only supportssmart
for automatic placement.
-
compatibility_date
string optional- Compatibility Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. Highly recommended to set a
compatibility_date
, otherwise if on upload via the API, it defaults to the oldest compatibility date before any flags took effect (2021-11-02).
- Compatibility Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. Highly recommended to set a
-
compatibility_flags
array[string] optional- Compatibility Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a
compatibility_date
.
- Compatibility Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a
-
usage_model
string optional- Usage model to apply to invocations, only allowed value is
standard
.
- Usage model to apply to invocations, only allowed value is
Additional attributes: Workers Script Upload API
For immediately deployed uploads, the following additional attributes are configurable at the top-level.
-
migrations
array[object] optional- Durable Objects migrations to apply.
-
logpush
boolean optional- Whether Logpush is turned on for the Worker.
-
tail_consumers
array[object] optional- Tail Workers that will consume logs from the attached Worker.
-
tags
array[string] optional- List of strings to use as tags for this Worker.
Additional attributes: Version Upload API
For version uploads, the following additional attributes are configurable at the top-level.
-
annotations
object optional- Annotations object specific to the Worker version.
workers/message
specifies a custom message for the version.workers/tag
specifies a custom identifier for the version.
Workers can interact with resources on the Cloudflare Developer Platform using bindings. Refer to the JSON example below that shows how to add bindings in the metadata
part.