- Bind to Workers API (4)·续
- StreamVideoStatus
- StreamVideoInput
- StreamPublicDetails
- StreamDirectUpload
- StreamCaption
- StreamDownloadGetResponse
- StreamDownload
- StreamWatermark
- StreamWatermarkPosition
- StreamDownloadStatus
- StreamDownloadType
- StreamUrlUploadParams
- StreamDirectUploadCreateParams
- StreamDirectUploadWatermark
- StreamUpdateVideoParams
- StreamVideosListParams
- StreamPaginationComparison
- StreamWatermarkCreateParams
- Error handling
- On this page
Bind to Workers API (4)·续
StreamVideoStatus
Processing status information for a video.
statestring- The current processing state.
stepstringoptional- The current processing step.
pctCompletestringoptional- The percent complete as a string.
errorReasonCodestring- An error reason code, if applicable.
errorReasonTextstring- An error reason text, if applicable.
StreamVideoInput
Input metadata for the original upload.
widthnumber- The input width in pixels.
heightnumber- The input height in pixels.
StreamPublicDetails
Public details associated with a video.
titlestring | null- The public title for the video.
share_linkstring | null- The public share link.
channel_linkstring | null- The public channel link.
logostring | null- The public logo URL.
StreamDirectUpload
Returned by createDirectUpload(). Contains the upload URL and video identifier for a direct upload.
uploadURLstring- The URL an unauthenticated upload can use for a single multipart request.
idstring- A Cloudflare-generated unique identifier for a media item.
watermarkStreamWatermark | null- The watermark profile applied to the upload. Refer to StreamWatermark.
scheduledDeletionstring | null- The scheduled deletion time, if any.
StreamCaption
Represents a caption or subtitle track for a video.
generatedbooleanoptional- Whether the caption was generated via AI.
labelstring- The language label displayed in the native language to users.
languagestring- The language tag in BCP 47 format.
status'ready' | 'inprogress' | 'error'optional- The status of a generated caption.
StreamDownloadGetResponse
An object with download type keys. Each key is optional and only present if that download type has been created.
defaultStreamDownloadoptional- The default video download. Only present if this download type has been created. Refer to StreamDownload.
audioStreamDownloadoptional- The audio-only download. Only present if this download type has been created. Refer to StreamDownload.
StreamDownload
Represents a generated download for a video.
percentCompletenumber- Indicates the progress as a percentage between 0 and 100.
statusStreamDownloadStatus- The status of a generated download.
urlstringoptional- The URL to access the generated download.
StreamWatermark
Represents a watermark profile.
idstring- The unique identifier for a watermark profile.
namestring- A short description of the watermark profile.
opacitynumber- The translucency of the image. A value of
0.0makes the image completely transparent, and1.0makes the image completely opaque. Note that if the image is already semi-transparent, setting this to1.0will not make the image completely opaque. paddingnumber- The whitespace between the adjacent edges (determined by position) of the video and the image.
0.0indicates no padding, and1.0indicates a fully padded video width or length. scalenumber- The size of the image relative to the overall size of the video.
0.0indicates no scaling, and1.0fills the entire video. positionStreamWatermarkPosition- The location of the image. Refer to StreamWatermarkPosition.
sizenumber- The size of the image in bytes.
heightnumber- The height of the image in pixels.
widthnumber- The width of the image in pixels.
createdstring- The date and time a watermark profile was created.
downloadedFromstring | null- The source URL for a downloaded image. If the watermark profile was created via direct upload, this field is
null.
StreamWatermarkPosition
The position of a watermark on a video.
'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center'
upperRight— Top-right corner of the video.upperLeft— Top-left corner of the video.lowerLeft— Bottom-left corner of the video.lowerRight— Bottom-right corner of the video.center— Center of the video. Note thatcenterignores thepaddingparameter.
StreamDownloadStatus
The status of a generated download.
'ready' | 'inprogress' | 'error'
ready— The download is ready.inprogress— The download is being generated.error— An error occurred during generation.
StreamDownloadType
The type of download to generate.
'default' | 'audio'
default— A video download.audio— An audio-only download.
StreamUrlUploadParams
Parameters for uploading a video from a URL.
allowedOriginsArray<string>optional- Lists the origins allowed to display the video. Enter allowed origin domains in an array and use
*for wildcard subdomains. Empty arrays allow the video to be viewed on any origin. creatorstringoptional- A user-defined identifier for the media creator.
metaRecord<string, string>optional- A user modifiable key-value store used to reference other systems of record for managing videos.
requireSignedURLsbooleanoptional- Indicates whether the video can be accessed using the ID. When set to
true, a signed token must be generated with a signing key to view the video. scheduledDeletionstring | nulloptional- Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a
nullvalue to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time. thumbnailTimestampPctnumberoptional- The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.
watermarkIdstringoptional- The identifier for the watermark profile.
StreamDirectUploadCreateParams
Parameters for creating a direct upload.
maxDurationSecondsnumber- The maximum duration in seconds for a video upload.
expirystringoptional- The date and time after upload when videos will not be accepted.
creatorstringoptional- A user-defined identifier for the media creator.
metaRecord<string, string>optional- A user modifiable key-value store used to reference other systems of record for managing videos.
allowedOriginsArray<string>optional- Lists the origins allowed to display the video.
requireSignedURLsbooleanoptional- Indicates whether the video can be accessed using the ID. When set to
true, a signed token must be generated with a signing key to view the video. thumbnailTimestampPctnumberoptional- The timestamp for a thumbnail image calculated as a percentage value of the video's duration.
scheduledDeletionstring | nulloptional- The date and time at which the video will be deleted. Include
nullto remove a scheduled deletion. watermarkStreamDirectUploadWatermarkoptional- The watermark profile to apply. Refer to StreamDirectUploadWatermark.
StreamDirectUploadWatermark
Watermark configuration for a direct upload.
idstring- The unique identifier for the watermark profile.
StreamUpdateVideoParams
Parameters for updating a video.
allowedOriginsArray<string>optional- Lists the origins allowed to display the video. Enter allowed origin domains in an array and use
*for wildcard subdomains. Empty arrays allow the video to be viewed on any origin. creatorstringoptional- A user-defined identifier for the media creator.
maxDurationSecondsnumberoptional- The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of
-1means the value is unknown. metaRecord<string, string>optional- A user modifiable key-value store used to reference other systems of record for managing videos.
requireSignedURLsbooleanoptional- Indicates whether the video can be accessed using the ID. When set to
true, a signed token must be generated with a signing key to view the video. scheduledDeletionstring | nulloptional- Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a
nullvalue to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time. thumbnailTimestampPctnumberoptional- The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.
StreamVideosListParams
Parameters for listing videos.
limitnumberoptional- The maximum number of videos to return.
beforestringoptional- Return videos created before this timestamp (RFC3339/RFC3339Nano).
beforeCompStreamPaginationComparisonoptional- Comparison operator for the
beforefield. Defaults tolt. Refer to StreamPaginationComparison. afterstringoptional- Return videos created after this timestamp (RFC3339/RFC3339Nano).
afterCompStreamPaginationComparisonoptional- Comparison operator for the
afterfield. Defaults togte. Refer to StreamPaginationComparison.
StreamPaginationComparison
Comparison operators for pagination queries.
'eq' | 'gt' | 'gte' | 'lt' | 'lte'
eq— Equal togt— Greater thangte— Greater than or equal tolt— Less thanlte— Less than or equal to
StreamWatermarkCreateParams
Parameters for creating a watermark profile.
namestringoptional- A short description of the watermark profile.
opacitynumberoptional- The translucency of the image. A value of
0.0makes the image completely transparent, and1.0makes the image completely opaque. Note that if the image is already semi-transparent, setting this to1.0will not make the image completely opaque. paddingnumberoptional- The whitespace between the adjacent edges (determined by position) of the video and the image.
0.0indicates no padding, and1.0indicates a fully padded video width or length. scalenumberoptional- The size of the image relative to the overall size of the video.
0.0indicates no scaling, and1.0fills the entire video. positionStreamWatermarkPositionoptional- The location of the image. Refer to StreamWatermarkPosition.
Error handling
Errors throw a StreamError, which extends the standard Error interface with additional information:
code: A numeric error code.statusCode: An HTTP status code.message: A description of the error.stack: Optional stack trace.
The following error subtypes may be thrown:
| Error type | Description |
|---|---|
InternalError |
An internal server error occurred. |
BadRequestError |
The request was malformed or contained invalid parameters. |
NotFoundError |
The requested resource was not found. |
ForbiddenError |
The request was not authorized. |
RateLimitedError |
The request was rate limited. |
QuotaReachedError |
The account has reached its video quota. |
MaxFileSizeError |
The uploaded file exceeds the maximum allowed size. |
InvalidURLError |
The provided URL is invalid or unreachable. |
AlreadyUploadedError |
The video has already been uploaded. |
TooManyWatermarksError |
The account has reached the watermark profile limit. |
Use a try...catch block to handle errors:
export default {
async fetch(request, env) {
try {
const videoDetails = await env.STREAM.upload(
"https://example.com/video.mp4",
);
return Response.json(videoDetails);
} catch (e) {
if (e instanceof Error) {
return new Response(`Stream error: ${e.message}`, { status: 500 });
}
throw e;
}
},
};
export default {
async fetch(request, env) {
try {
const videoDetails = await env.STREAM.upload("https://example.com/video.mp4");
return Response.json(videoDetails);
} catch (e) {
if (e instanceof Error) {
return new Response(`Stream error: ${e.message}`, { status: 500 });
}
throw e;
}
},
};
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/stream/manage-video-library/bindings/#page","headline":"Bind to Workers API","description":"A binding connects your Worker to external resources on the Developer Platform, like Stream, R2 buckets, or KV namespaces.","url":"https://developers.cloudflare.com/stream/manage-video-library/bindings/","inLanguage":"en","image":"https://developers.cloudflare.com/stream/manage-video-library/bindings/og.png?v=92912e515ec36f0b","dateModified":"2026-05-07","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Vectorize Workers binding API for inserting, upserting, querying, and managing vectors. title: Vectorize API image: https://developers.cloudflare.com/vectorize/reference/client-api/og.png?v=984d6a4f3751e373
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/vectorize/llms.txt
Use this file to discover all available pages before exploring further.
Docs