Skip to content
Start here

Stream

List videos
client.Stream.List(ctx, params) (*SinglePage[Video], error)
GET/accounts/{account_id}/stream
Retrieve video details
client.Stream.Get(ctx, identifier, query) (*Video, error)
GET/accounts/{account_id}/stream/{identifier}
Initiate video uploads using TUS
client.Stream.New(ctx, params) error
POST/accounts/{account_id}/stream
Edit video details
client.Stream.Edit(ctx, identifier, params) (*Video, error)
POST/accounts/{account_id}/stream/{identifier}
Delete video
client.Stream.Delete(ctx, identifier, body) error
DELETE/accounts/{account_id}/stream/{identifier}
ModelsExpand Collapse
type AllowedOrigins string
type Video struct{…}
AllowedOrigins []AllowedOriginsoptional

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.

Created Timeoptional

The date and time the media item was created.

formatdate-time
Creator stringoptional

A user-defined identifier for the media creator.

maxLength64
Duration float64optional

The duration of the video in seconds. A value of -1 means the duration is unknown. The duration becomes available after the upload and before the video is ready.

Input VideoInputoptional
Height int64optional

The video height in pixels. A value of -1 means the height is unknown. The value becomes available after the upload and before the video is ready.

Width int64optional

The video width in pixels. A value of -1 means the width is unknown. The value becomes available after the upload and before the video is ready.

LiveInput stringoptional

The live input ID used to upload a video with Stream Live.

maxLength32
MaxDurationSeconds int64optional

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 -1 means the value is unknown.

maximum36000
minimum1
Meta unknownoptional

A user modifiable key-value store used to reference other systems of record for managing videos.

Modified Timeoptional

The date and time the media item was last modified.

formatdate-time
Playback VideoPlaybackoptional
Dash stringoptional

DASH Media Presentation Description for the video.

Hls stringoptional

The HLS manifest for the video.

Preview stringoptional

The video's preview page URI. This field is omitted until encoding is complete.

formaturi
ReadyToStream booloptional

Indicates whether the video is playable. The field is empty if the video is not ready for viewing or the live stream is still in progress.

ReadyToStreamAt Timeoptional

Indicates the time at which the video became playable. The field is empty if the video is not ready for viewing or the live stream is still in progress.

formatdate-time
RequireSignedURLs booloptional

Indicates whether the video can be a accessed using the UID. When set to true, a signed token must be generated with a signing key to view the video.

ScheduledDeletion Timeoptional

Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a null value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time.

formatdate-time
Size float64optional

The size of the media item in bytes.

Status VideoStatusoptional

Specifies a detailed status for a video. If the state is inprogress or error, the step field returns encoding or manifest. If the state is inprogress, pctComplete returns a number between 0 and 100 to indicate the approximate percent of completion. If the state is error, errorReasonCode and errorReasonText provide additional details.

ErrorReasonCode stringoptional

Specifies why the video failed to encode. This field is empty if the video is not in an error state. Preferred for programmatic use.

ErrorReasonText stringoptional

Specifies why the video failed to encode using a human readable error message in English. This field is empty if the video is not in an error state.

PctComplete stringoptional

Indicates the progress as a percentage between 0 and 100.

maximum100
minimum0
State VideoStatusStateoptional

Specifies the processing status for all quality levels for a video.

One of the following:
const VideoStatusStatePendingupload VideoStatusState = "pendingupload"
const VideoStatusStateDownloading VideoStatusState = "downloading"
const VideoStatusStateQueued VideoStatusState = "queued"
const VideoStatusStateInprogress VideoStatusState = "inprogress"
const VideoStatusStateReady VideoStatusState = "ready"
const VideoStatusStateError VideoStatusState = "error"
const VideoStatusStateLiveInprogress VideoStatusState = "live-inprogress"
Thumbnail stringoptional

The media item's thumbnail URI. This field is omitted until encoding is complete.

formaturi
ThumbnailTimestampPct float64optional

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.

maximum1
minimum0
UID stringoptional

A Cloudflare-generated unique identifier for a media item.

maxLength32
Uploaded Timeoptional

The date and time the media item was uploaded.

formatdate-time
UploadExpiry Timeoptional

The date and time when the video upload URL is no longer valid for direct user uploads.

formatdate-time
Watermark Watermarkoptional

StreamAudio Tracks

List additional audio tracks on a video
client.Stream.AudioTracks.Get(ctx, identifier, query) (*SinglePage[Audio], error)
GET/accounts/{account_id}/stream/{identifier}/audio
Edit additional audio tracks on a video
client.Stream.AudioTracks.Edit(ctx, identifier, audioIdentifier, params) (*Audio, error)
PATCH/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}
Delete additional audio tracks on a video
client.Stream.AudioTracks.Delete(ctx, identifier, audioIdentifier, body) (*string, error)
DELETE/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}
Add audio tracks to a video
client.Stream.AudioTracks.Copy(ctx, identifier, params) (*Audio, error)
POST/accounts/{account_id}/stream/{identifier}/audio/copy
ModelsExpand Collapse
type Audio struct{…}
Default booloptional

Denotes whether the audio track will be played by default in a player.

Label stringoptional

A string to uniquely identify the track amongst other audio track labels for the specified video.

Status AudioStatusoptional

Specifies the processing status of the video.

One of the following:
const AudioStatusQueued AudioStatus = "queued"
const AudioStatusReady AudioStatus = "ready"
const AudioStatusError AudioStatus = "error"
UID stringoptional

A Cloudflare-generated unique identifier for a media item.

maxLength32

StreamVideos

Storage use
client.Stream.Videos.StorageUsage(ctx, params) (*VideoStorageUsageResponse, error)
GET/accounts/{account_id}/stream/storage-usage

StreamClip

Clip videos given a start and end time
client.Stream.Clip.New(ctx, params) (*Clip, error)
POST/accounts/{account_id}/stream/clip
ModelsExpand Collapse
type Clip struct{…}
AllowedOrigins []AllowedOriginsoptional

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.

ClippedFromVideoUID stringoptional

The unique video identifier (UID).

maxLength32
Created Timeoptional

The date and time the clip was created.

formatdate-time
Creator stringoptional

A user-defined identifier for the media creator.

maxLength64
EndTimeSeconds int64optional

Specifies the end time for the video clip in seconds.

MaxDurationSeconds int64optional

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 -1 means the value is unknown.

maximum36000
minimum1
Meta unknownoptional

A user modifiable key-value store used to reference other systems of record for managing videos.

Modified Timeoptional

The date and time the live input was last modified.

formatdate-time
Playback ClipPlaybackoptional
Dash stringoptional

DASH Media Presentation Description for the video.

Hls stringoptional

The HLS manifest for the video.

Preview stringoptional

The video's preview page URI. This field is omitted until encoding is complete.

formaturi
RequireSignedURLs booloptional

Indicates whether the video can be a accessed using the UID. When set to true, a signed token must be generated with a signing key to view the video.

StartTimeSeconds int64optional

Specifies the start time for the video clip in seconds.

Status ClipStatusoptional

Specifies the processing status for all quality levels for a video.

One of the following:
const ClipStatusPendingupload ClipStatus = "pendingupload"
const ClipStatusDownloading ClipStatus = "downloading"
const ClipStatusQueued ClipStatus = "queued"
const ClipStatusInprogress ClipStatus = "inprogress"
const ClipStatusReady ClipStatus = "ready"
const ClipStatusError ClipStatus = "error"
const ClipStatusLiveInprogress ClipStatus = "live-inprogress"
ThumbnailTimestampPct float64optional

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.

maximum1
minimum0
Watermark ClipWatermarkoptional
UID stringoptional

The unique identifier for the watermark profile.

maxLength32

StreamCopy

Upload videos from a URL
client.Stream.Copy.New(ctx, params) (*Video, error)
POST/accounts/{account_id}/stream/copy

StreamDirect Upload

Upload videos via direct upload URLs
client.Stream.DirectUpload.New(ctx, params) (*DirectUploadNewResponse, error)
POST/accounts/{account_id}/stream/direct_upload

StreamKeys

List signing keys
client.Stream.Keys.Get(ctx, query) (*SinglePage[KeyGetResponse], error)
GET/accounts/{account_id}/stream/keys
Create signing keys
client.Stream.Keys.New(ctx, params) (*Keys, error)
POST/accounts/{account_id}/stream/keys
Delete signing keys
client.Stream.Keys.Delete(ctx, identifier, body) (*string, error)
DELETE/accounts/{account_id}/stream/keys/{identifier}
ModelsExpand Collapse
type Keys struct{…}
ID stringoptional

Identifier.

maxLength32
Created Timeoptional

The date and time a signing key was created.

formatdate-time
Jwk stringoptional

The signing key in JWK format.

Pem stringoptional

The signing key in PEM format.

StreamLive Inputs

List live inputs
client.Stream.LiveInputs.List(ctx, params) (*LiveInputListResponse, error)
GET/accounts/{account_id}/stream/live_inputs
Retrieve a live input
client.Stream.LiveInputs.Get(ctx, liveInputIdentifier, query) (*LiveInput, error)
GET/accounts/{account_id}/stream/live_inputs/{live_input_identifier}
Create a live input
client.Stream.LiveInputs.New(ctx, params) (*LiveInput, error)
POST/accounts/{account_id}/stream/live_inputs
Update a live input
client.Stream.LiveInputs.Update(ctx, liveInputIdentifier, params) (*LiveInput, error)
PUT/accounts/{account_id}/stream/live_inputs/{live_input_identifier}
Delete a live input
client.Stream.LiveInputs.Delete(ctx, liveInputIdentifier, body) error
DELETE/accounts/{account_id}/stream/live_inputs/{live_input_identifier}
ModelsExpand Collapse
type LiveInput struct{…}

Details about a live input.

Created Timeoptional

The date and time the live input was created.

formatdate-time
DeleteRecordingAfterDays float64optional

Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a null value to remove an existing scheduled deletion.

minimum30
Enabled booloptional

Indicates whether the live input is enabled and can accept streams.

Meta unknownoptional

A user modifiable key-value store used to reference other systems of record for managing live inputs.

Modified Timeoptional

The date and time the live input was last modified.

formatdate-time
Recording LiveInputRecordingoptional

Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied.

AllowedOrigins []stringoptional

Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use * for wildcard subdomains. An empty array allows videos to be viewed on any origin.

HideLiveViewerCount booloptional

Disables reporting the number of live viewers when this property is set to true.

Mode LiveInputRecordingModeoptional

Specifies the recording behavior for the live input. Set this value to off to prevent a recording. Set the value to automatic to begin a recording and transition to on-demand after Stream Live stops receiving input.

One of the following:
const LiveInputRecordingModeOff LiveInputRecordingMode = "off"
const LiveInputRecordingModeAutomatic LiveInputRecordingMode = "automatic"
RequireSignedURLs booloptional

Indicates if a video using the live input has the requireSignedURLs property set. Also enforces access controls on any video recording of the livestream with the live input.

TimeoutSeconds int64optional

Determines the amount of time a live input configured in automatic mode should wait before a recording transitions from live to on-demand. 0 is recommended for most use cases and indicates the platform default should be used.

Rtmps LiveInputRtmpsoptional

Details for streaming to an live input using RTMPS.

StreamKey stringoptional

The secret key to use when streaming via RTMPS to a live input.

URL stringoptional

The RTMPS URL you provide to the broadcaster, which they stream live video to.

RtmpsPlayback LiveInputRtmpsPlaybackoptional

Details for playback from an live input using RTMPS.

StreamKey stringoptional

The secret key to use for playback via RTMPS.

URL stringoptional

The URL used to play live video over RTMPS.

Srt LiveInputSrtoptional

Details for streaming to a live input using SRT.

Passphrase stringoptional

The secret key to use when streaming via SRT to a live input.

StreamID stringoptional

The identifier of the live input to use when streaming via SRT.

URL stringoptional

The SRT URL you provide to the broadcaster, which they stream live video to.

SrtPlayback LiveInputSrtPlaybackoptional

Details for playback from an live input using SRT.

Passphrase stringoptional

The secret key to use for playback via SRT.

StreamID stringoptional

The identifier of the live input to use for playback via SRT.

URL stringoptional

The URL used to play live video over SRT.

Status LiveInputStatusoptional

The connection status of a live input.

One of the following:
const LiveInputStatusConnected LiveInputStatus = "connected"
const LiveInputStatusReconnected LiveInputStatus = "reconnected"
const LiveInputStatusReconnecting LiveInputStatus = "reconnecting"
const LiveInputStatusClientDisconnect LiveInputStatus = "client_disconnect"
const LiveInputStatusTTLExceeded LiveInputStatus = "ttl_exceeded"
const LiveInputStatusFailedToConnect LiveInputStatus = "failed_to_connect"
const LiveInputStatusFailedToReconnect LiveInputStatus = "failed_to_reconnect"
const LiveInputStatusNewConfigurationAccepted LiveInputStatus = "new_configuration_accepted"
UID stringoptional

A unique identifier for a live input.

maxLength32
WebRtc LiveInputWebRtcoptional

Details for streaming to a live input using WebRTC.

URL stringoptional

The WebRTC URL you provide to the broadcaster, which they stream live video to.

WebRtcPlayback LiveInputWebRtcPlaybackoptional

Details for playback from a live input using WebRTC.

URL stringoptional

The URL used to play live video over WebRTC.

StreamLive InputsOutputs

List all outputs associated with a specified live input
client.Stream.LiveInputs.Outputs.List(ctx, liveInputIdentifier, query) (*SinglePage[Output], error)
GET/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs
Create a new output, connected to a live input
client.Stream.LiveInputs.Outputs.New(ctx, liveInputIdentifier, params) (*Output, error)
POST/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs
Update an output
client.Stream.LiveInputs.Outputs.Update(ctx, liveInputIdentifier, outputIdentifier, params) (*Output, error)
PUT/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}
Delete an output
client.Stream.LiveInputs.Outputs.Delete(ctx, liveInputIdentifier, outputIdentifier, body) error
DELETE/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}
ModelsExpand Collapse
type Output struct{…}
Enabled booloptional

When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch.

StreamKey stringoptional

The streamKey used to authenticate against an output's target.

UID stringoptional

A unique identifier for the output.

maxLength32
URL stringoptional

The URL an output uses to restream.

StreamWatermarks

List watermark profiles
client.Stream.Watermarks.List(ctx, query) (*SinglePage[Watermark], error)
GET/accounts/{account_id}/stream/watermarks
Watermark profile details
client.Stream.Watermarks.Get(ctx, identifier, query) (*Watermark, error)
GET/accounts/{account_id}/stream/watermarks/{identifier}
Create watermark profiles via basic upload
client.Stream.Watermarks.New(ctx, params) (*Watermark, error)
POST/accounts/{account_id}/stream/watermarks
Delete watermark profiles
client.Stream.Watermarks.Delete(ctx, identifier, body) (*string, error)
DELETE/accounts/{account_id}/stream/watermarks/{identifier}
ModelsExpand Collapse
type Watermark struct{…}
Created Timeoptional

The date and a time a watermark profile was created.

formatdate-time
DownloadedFrom stringoptional

The source URL for a downloaded image. If the watermark profile was created via direct upload, this field is null.

Height int64optional

The height of the image in pixels.

Name stringoptional

A short description of the watermark profile.

Opacity float64optional

The translucency of the image. A value of 0.0 makes the image completely transparent, and 1.0 makes the image completely opaque. Note that if the image is already semi-transparent, setting this to 1.0 will not make the image completely opaque.

maximum1
minimum0
Padding float64optional

The whitespace between the adjacent edges (determined by position) of the video and the image. 0.0 indicates no padding, and 1.0 indicates a fully padded video width or length, as determined by the algorithm.

maximum1
minimum0
Position stringoptional

The location of the image. Valid positions are: upperRight, upperLeft, lowerLeft, lowerRight, and center. Note that center ignores the padding parameter.

Scale float64optional

The size of the image relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. 0.0 indicates no scaling (use the size of the image as-is), and 1.0 fills the entire video.

maximum1
minimum0
Size float64optional

The size of the image in bytes.

UID stringoptional

The unique identifier for a watermark profile.

maxLength32
Width int64optional

The width of the image in pixels.

StreamWebhooks

View webhooks
client.Stream.Webhooks.Get(ctx, query) (*WebhookGetResponse, error)
GET/accounts/{account_id}/stream/webhook
Create webhooks
client.Stream.Webhooks.Update(ctx, params) (*WebhookUpdateResponse, error)
PUT/accounts/{account_id}/stream/webhook
Delete webhooks
client.Stream.Webhooks.Delete(ctx, body) (*string, error)
DELETE/accounts/{account_id}/stream/webhook

StreamCaptions

List captions or subtitles
client.Stream.Captions.Get(ctx, identifier, query) (*SinglePage[Caption], error)
GET/accounts/{account_id}/stream/{identifier}/captions
ModelsExpand Collapse
type Caption struct{…}
Generated booloptional

Whether the caption was generated via AI.

Label stringoptional

The language label displayed in the native language to users.

Language stringoptional

The language tag in BCP 47 format.

Status CaptionStatusoptional

The status of a generated caption.

One of the following:
const CaptionStatusReady CaptionStatus = "ready"
const CaptionStatusInprogress CaptionStatus = "inprogress"
const CaptionStatusError CaptionStatus = "error"

StreamCaptionsLanguage

List captions or subtitles for a provided language
client.Stream.Captions.Language.Get(ctx, identifier, language, query) (*Caption, error)
GET/accounts/{account_id}/stream/{identifier}/captions/{language}
Generate captions or subtitles for a provided language via AI
client.Stream.Captions.Language.New(ctx, identifier, language, body) (*Caption, error)
POST/accounts/{account_id}/stream/{identifier}/captions/{language}/generate
Upload captions or subtitles
client.Stream.Captions.Language.Update(ctx, identifier, language, params) (*Caption, error)
PUT/accounts/{account_id}/stream/{identifier}/captions/{language}
Delete captions or subtitles
client.Stream.Captions.Language.Delete(ctx, identifier, language, body) (*string, error)
DELETE/accounts/{account_id}/stream/{identifier}/captions/{language}

StreamCaptionsLanguageVtt

Return WebVTT captions for a provided language
client.Stream.Captions.Language.Vtt.Get(ctx, identifier, language, query) (*string, error)
GET/accounts/{account_id}/stream/{identifier}/captions/{language}/vtt

StreamDownloads

List downloads
client.Stream.Downloads.Get(ctx, identifier, query) (*DownloadGetResponse, error)
GET/accounts/{account_id}/stream/{identifier}/downloads
Create downloads
client.Stream.Downloads.New(ctx, identifier, params) (*DownloadNewResponse, error)
POST/accounts/{account_id}/stream/{identifier}/downloads
Delete downloads
client.Stream.Downloads.Delete(ctx, identifier, body) (*string, error)
DELETE/accounts/{account_id}/stream/{identifier}/downloads

StreamEmbed

Retrieve embed Code HTML
client.Stream.Embed.Get(ctx, identifier, query) (*string, error)
GET/accounts/{account_id}/stream/{identifier}/embed

StreamToken

Create signed URL tokens for videos
client.Stream.Token.New(ctx, identifier, params) (*TokenNewResponse, error)
POST/accounts/{account_id}/stream/{identifier}/token