Skip to content
Start here

Stream

List videos
stream.list(StreamListParams**kwargs) -> SyncSinglePage[Video]
GET/accounts/{account_id}/stream
Retrieve video details
stream.get(stridentifier, StreamGetParams**kwargs) -> Video
GET/accounts/{account_id}/stream/{identifier}
Initiate video uploads using TUS
stream.create(StreamCreateParams**kwargs)
POST/accounts/{account_id}/stream
Edit video details
stream.edit(stridentifier, StreamEditParams**kwargs) -> Video
POST/accounts/{account_id}/stream/{identifier}
Delete video
stream.delete(stridentifier, StreamDeleteParams**kwargs)
DELETE/accounts/{account_id}/stream/{identifier}
ModelsExpand Collapse
str
class Video:
allowed_origins: Optional[List[AllowedOrigins]]

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: Optional[datetime]

The date and time the media item was created.

formatdate-time
creator: Optional[str]

A user-defined identifier for the media creator.

maxLength64
duration: Optional[float]

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: Optional[Input]
height: Optional[int]

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: Optional[int]

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.

live_input: Optional[str]

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

maxLength32
max_duration_seconds: Optional[int]

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: Optional[object]

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

modified: Optional[datetime]

The date and time the media item was last modified.

formatdate-time
playback: Optional[Playback]
dash: Optional[str]

DASH Media Presentation Description for the video.

hls: Optional[str]

The HLS manifest for the video.

preview: Optional[str]

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

formaturi
ready_to_stream: Optional[bool]

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.

ready_to_stream_at: Optional[datetime]

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
require_signed_urls: Optional[bool]

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.

scheduled_deletion: Optional[datetime]

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: Optional[float]

The size of the media item in bytes.

status: Optional[Status]

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.

error_reason_code: Optional[str]

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

error_reason_text: Optional[str]

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.

pct_complete: Optional[str]

Indicates the progress as a percentage between 0 and 100.

maximum100
minimum0
state: Optional[Literal["pendingupload", "downloading", "queued", 4 more]]

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

One of the following:
"pendingupload"
"downloading"
"queued"
"inprogress"
"ready"
"error"
"live-inprogress"
thumbnail: Optional[str]

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

formaturi
thumbnail_timestamp_pct: Optional[float]

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: Optional[str]

A Cloudflare-generated unique identifier for a media item.

maxLength32
uploaded: Optional[datetime]

The date and time the media item was uploaded.

formatdate-time
upload_expiry: Optional[datetime]

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

formatdate-time
watermark: Optional[Watermark]

StreamAudio Tracks

List additional audio tracks on a video
stream.audio_tracks.get(stridentifier, AudioTrackGetParams**kwargs) -> SyncSinglePage[Audio]
GET/accounts/{account_id}/stream/{identifier}/audio
Edit additional audio tracks on a video
stream.audio_tracks.edit(straudio_identifier, AudioTrackEditParams**kwargs) -> Audio
PATCH/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}
Delete additional audio tracks on a video
stream.audio_tracks.delete(straudio_identifier, AudioTrackDeleteParams**kwargs) -> AudioTrackDeleteResponse
DELETE/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}
Add audio tracks to a video
stream.audio_tracks.copy(stridentifier, AudioTrackCopyParams**kwargs) -> Audio
POST/accounts/{account_id}/stream/{identifier}/audio/copy
ModelsExpand Collapse
class Audio:
default: Optional[bool]

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

label: Optional[str]

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

status: Optional[Literal["queued", "ready", "error"]]

Specifies the processing status of the video.

One of the following:
"queued"
"ready"
"error"
uid: Optional[str]

A Cloudflare-generated unique identifier for a media item.

maxLength32
str

StreamVideos

Storage use
stream.videos.storage_usage(VideoStorageUsageParams**kwargs) -> VideoStorageUsageResponse
GET/accounts/{account_id}/stream/storage-usage
ModelsExpand Collapse
class VideoStorageUsageResponse:
creator: Optional[str]

A user-defined identifier for the media creator.

maxLength64
total_storage_minutes: Optional[int]

The total minutes of video content stored in the account.

total_storage_minutes_limit: Optional[int]

The storage capacity alloted for the account.

video_count: Optional[int]

The total count of videos associated with the account.

StreamClip

Clip videos given a start and end time
stream.clip.create(ClipCreateParams**kwargs) -> Clip
POST/accounts/{account_id}/stream/clip
ModelsExpand Collapse
class Clip:
allowed_origins: Optional[List[AllowedOrigins]]

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.

clipped_from_video_uid: Optional[str]

The unique video identifier (UID).

maxLength32
created: Optional[datetime]

The date and time the clip was created.

formatdate-time
creator: Optional[str]

A user-defined identifier for the media creator.

maxLength64
end_time_seconds: Optional[int]

Specifies the end time for the video clip in seconds.

max_duration_seconds: Optional[int]

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: Optional[object]

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

modified: Optional[datetime]

The date and time the live input was last modified.

formatdate-time
playback: Optional[Playback]
dash: Optional[str]

DASH Media Presentation Description for the video.

hls: Optional[str]

The HLS manifest for the video.

preview: Optional[str]

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

formaturi
require_signed_urls: Optional[bool]

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.

start_time_seconds: Optional[int]

Specifies the start time for the video clip in seconds.

status: Optional[Literal["pendingupload", "downloading", "queued", 4 more]]

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

One of the following:
"pendingupload"
"downloading"
"queued"
"inprogress"
"ready"
"error"
"live-inprogress"
thumbnail_timestamp_pct: Optional[float]

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: Optional[Watermark]
uid: Optional[str]

The unique identifier for the watermark profile.

maxLength32

StreamCopy

Upload videos from a URL
stream.copy.create(CopyCreateParams**kwargs) -> Video
POST/accounts/{account_id}/stream/copy

StreamDirect Upload

Upload videos via direct upload URLs
stream.direct_upload.create(DirectUploadCreateParams**kwargs) -> DirectUploadCreateResponse
POST/accounts/{account_id}/stream/direct_upload
ModelsExpand Collapse
class DirectUploadCreateResponse:
scheduled_deletion: Optional[datetime]

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
uid: Optional[str]

A Cloudflare-generated unique identifier for a media item.

maxLength32
upload_url: Optional[str]

The URL an unauthenticated upload can use for a single HTTP POST multipart/form-data request.

watermark: Optional[Watermark]

StreamKeys

List signing keys
stream.keys.get(KeyGetParams**kwargs) -> SyncSinglePage[KeyGetResponse]
GET/accounts/{account_id}/stream/keys
Create signing keys
stream.keys.create(KeyCreateParams**kwargs) -> Keys
POST/accounts/{account_id}/stream/keys
Delete signing keys
stream.keys.delete(stridentifier, KeyDeleteParams**kwargs) -> KeyDeleteResponse
DELETE/accounts/{account_id}/stream/keys/{identifier}
ModelsExpand Collapse
class Keys:
id: Optional[str]

Identifier.

maxLength32
created: Optional[datetime]

The date and time a signing key was created.

formatdate-time
jwk: Optional[str]

The signing key in JWK format.

pem: Optional[str]

The signing key in PEM format.

class KeyGetResponse:
id: Optional[str]

Identifier.

maxLength32
created: Optional[datetime]

The date and time a signing key was created.

formatdate-time
str

StreamLive Inputs

List live inputs
stream.live_inputs.list(LiveInputListParams**kwargs) -> LiveInputListResponse
GET/accounts/{account_id}/stream/live_inputs
Retrieve a live input
stream.live_inputs.get(strlive_input_identifier, LiveInputGetParams**kwargs) -> LiveInput
GET/accounts/{account_id}/stream/live_inputs/{live_input_identifier}
Create a live input
stream.live_inputs.create(LiveInputCreateParams**kwargs) -> LiveInput
POST/accounts/{account_id}/stream/live_inputs
Update a live input
stream.live_inputs.update(strlive_input_identifier, LiveInputUpdateParams**kwargs) -> LiveInput
PUT/accounts/{account_id}/stream/live_inputs/{live_input_identifier}
Delete a live input
stream.live_inputs.delete(strlive_input_identifier, LiveInputDeleteParams**kwargs)
DELETE/accounts/{account_id}/stream/live_inputs/{live_input_identifier}
ModelsExpand Collapse
class LiveInput:

Details about a live input.

created: Optional[datetime]

The date and time the live input was created.

formatdate-time
delete_recording_after_days: Optional[float]

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: Optional[bool]

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

meta: Optional[object]

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

modified: Optional[datetime]

The date and time the live input was last modified.

formatdate-time
recording: Optional[Recording]

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.

allowed_origins: Optional[List[str]]

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.

hide_live_viewer_count: Optional[bool]

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

mode: Optional[Literal["off", "automatic"]]

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:
"off"
"automatic"
require_signed_urls: Optional[bool]

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.

timeout_seconds: Optional[int]

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: Optional[Rtmps]

Details for streaming to an live input using RTMPS.

stream_key: Optional[str]

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

url: Optional[str]

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

rtmps_playback: Optional[RtmpsPlayback]

Details for playback from an live input using RTMPS.

stream_key: Optional[str]

The secret key to use for playback via RTMPS.

url: Optional[str]

The URL used to play live video over RTMPS.

srt: Optional[Srt]

Details for streaming to a live input using SRT.

passphrase: Optional[str]

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

stream_id: Optional[str]

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

url: Optional[str]

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

srt_playback: Optional[SrtPlayback]

Details for playback from an live input using SRT.

passphrase: Optional[str]

The secret key to use for playback via SRT.

stream_id: Optional[str]

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

url: Optional[str]

The URL used to play live video over SRT.

status: Optional[Literal["connected", "reconnected", "reconnecting", 5 more]]

The connection status of a live input.

One of the following:
"connected"
"reconnected"
"reconnecting"
"client_disconnect"
"ttl_exceeded"
"failed_to_connect"
"failed_to_reconnect"
"new_configuration_accepted"
uid: Optional[str]

A unique identifier for a live input.

maxLength32
web_rtc: Optional[WebRtc]

Details for streaming to a live input using WebRTC.

url: Optional[str]

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

web_rtc_playback: Optional[WebRtcPlayback]

Details for playback from a live input using WebRTC.

url: Optional[str]

The URL used to play live video over WebRTC.

class LiveInputListResponse:
live_inputs: Optional[List[LiveInput]]
created: Optional[datetime]

The date and time the live input was created.

formatdate-time
delete_recording_after_days: Optional[float]

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: Optional[bool]

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

meta: Optional[object]

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

modified: Optional[datetime]

The date and time the live input was last modified.

formatdate-time
uid: Optional[str]

A unique identifier for a live input.

maxLength32
range: Optional[int]

The total number of remaining live inputs based on cursor position.

total: Optional[int]

The total number of live inputs that match the provided filters.

StreamLive InputsOutputs

List all outputs associated with a specified live input
stream.live_inputs.outputs.list(strlive_input_identifier, OutputListParams**kwargs) -> SyncSinglePage[Output]
GET/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs
Create a new output, connected to a live input
stream.live_inputs.outputs.create(strlive_input_identifier, OutputCreateParams**kwargs) -> Output
POST/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs
Update an output
stream.live_inputs.outputs.update(stroutput_identifier, OutputUpdateParams**kwargs) -> Output
PUT/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}
Delete an output
stream.live_inputs.outputs.delete(stroutput_identifier, OutputDeleteParams**kwargs)
DELETE/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}
ModelsExpand Collapse
class Output:
enabled: Optional[bool]

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.

stream_key: Optional[str]

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

uid: Optional[str]

A unique identifier for the output.

maxLength32
url: Optional[str]

The URL an output uses to restream.

StreamWatermarks

List watermark profiles
stream.watermarks.list(WatermarkListParams**kwargs) -> SyncSinglePage[Watermark]
GET/accounts/{account_id}/stream/watermarks
Watermark profile details
stream.watermarks.get(stridentifier, WatermarkGetParams**kwargs) -> Watermark
GET/accounts/{account_id}/stream/watermarks/{identifier}
Create watermark profiles via basic upload
stream.watermarks.create(WatermarkCreateParams**kwargs) -> Watermark
POST/accounts/{account_id}/stream/watermarks
Delete watermark profiles
stream.watermarks.delete(stridentifier, WatermarkDeleteParams**kwargs) -> WatermarkDeleteResponse
DELETE/accounts/{account_id}/stream/watermarks/{identifier}
ModelsExpand Collapse
class Watermark:
created: Optional[datetime]

The date and a time a watermark profile was created.

formatdate-time
downloaded_from: Optional[str]

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

height: Optional[int]

The height of the image in pixels.

name: Optional[str]

A short description of the watermark profile.

opacity: Optional[float]

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: Optional[float]

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: Optional[str]

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

scale: Optional[float]

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: Optional[float]

The size of the image in bytes.

uid: Optional[str]

The unique identifier for a watermark profile.

maxLength32
width: Optional[int]

The width of the image in pixels.

str

StreamWebhooks

View webhooks
stream.webhooks.get(WebhookGetParams**kwargs) -> object
GET/accounts/{account_id}/stream/webhook
Create webhooks
stream.webhooks.update(WebhookUpdateParams**kwargs) -> object
PUT/accounts/{account_id}/stream/webhook
Delete webhooks
stream.webhooks.delete(WebhookDeleteParams**kwargs) -> WebhookDeleteResponse
DELETE/accounts/{account_id}/stream/webhook
ModelsExpand Collapse
str

StreamCaptions

List captions or subtitles
stream.captions.get(stridentifier, CaptionGetParams**kwargs) -> SyncSinglePage[Caption]
GET/accounts/{account_id}/stream/{identifier}/captions
ModelsExpand Collapse
class Caption:
generated: Optional[bool]

Whether the caption was generated via AI.

label: Optional[str]

The language label displayed in the native language to users.

language: Optional[str]

The language tag in BCP 47 format.

status: Optional[Literal["ready", "inprogress", "error"]]

The status of a generated caption.

One of the following:
"ready"
"inprogress"
"error"

StreamCaptionsLanguage

List captions or subtitles for a provided language
stream.captions.language.get(strlanguage, LanguageGetParams**kwargs) -> Caption
GET/accounts/{account_id}/stream/{identifier}/captions/{language}
Generate captions or subtitles for a provided language via AI
stream.captions.language.create(strlanguage, LanguageCreateParams**kwargs) -> Caption
POST/accounts/{account_id}/stream/{identifier}/captions/{language}/generate
Upload captions or subtitles
stream.captions.language.update(strlanguage, LanguageUpdateParams**kwargs) -> Caption
PUT/accounts/{account_id}/stream/{identifier}/captions/{language}
Delete captions or subtitles
stream.captions.language.delete(strlanguage, LanguageDeleteParams**kwargs) -> LanguageDeleteResponse
DELETE/accounts/{account_id}/stream/{identifier}/captions/{language}
ModelsExpand Collapse
str

StreamCaptionsLanguageVtt

Return WebVTT captions for a provided language
stream.captions.language.vtt.get(strlanguage, VttGetParams**kwargs) -> VttGetResponse
GET/accounts/{account_id}/stream/{identifier}/captions/{language}/vtt
ModelsExpand Collapse
str

StreamDownloads

List downloads
stream.downloads.get(stridentifier, DownloadGetParams**kwargs) -> DownloadGetResponse
GET/accounts/{account_id}/stream/{identifier}/downloads
Create downloads
stream.downloads.create(stridentifier, DownloadCreateParams**kwargs) -> DownloadCreateResponse
POST/accounts/{account_id}/stream/{identifier}/downloads
Delete downloads
stream.downloads.delete(stridentifier, DownloadDeleteParams**kwargs) -> DownloadDeleteResponse
DELETE/accounts/{account_id}/stream/{identifier}/downloads
ModelsExpand Collapse
class DownloadGetResponse:

An object with download type keys. Each key is optional and only present if that download type has been created.

audio: Optional[Audio]

The audio-only download. Only present if this download type has been created.

percent_complete: Optional[float]

Indicates the progress as a percentage between 0 and 100.

maximum100
minimum0
status: Optional[Literal["ready", "inprogress", "error"]]

The status of a generated download.

One of the following:
"ready"
"inprogress"
"error"
url: Optional[str]

The URL to access the generated download.

formaturi
default: Optional[Default]

The default video download. Only present if this download type has been created.

percent_complete: Optional[float]

Indicates the progress as a percentage between 0 and 100.

maximum100
minimum0
status: Optional[Literal["ready", "inprogress", "error"]]

The status of a generated download.

One of the following:
"ready"
"inprogress"
"error"
url: Optional[str]

The URL to access the generated download.

formaturi
class DownloadCreateResponse:
percent_complete: Optional[float]

Indicates the progress as a percentage between 0 and 100.

maximum100
minimum0
status: Optional[Literal["ready", "inprogress", "error"]]

The status of a generated download.

One of the following:
"ready"
"inprogress"
"error"
url: Optional[str]

The URL to access the generated download.

formaturi
str

StreamEmbed

Retrieve embed Code HTML
stream.embed.get(stridentifier, EmbedGetParams**kwargs) -> EmbedGetResponse
GET/accounts/{account_id}/stream/{identifier}/embed
ModelsExpand Collapse
str

StreamToken

Create signed URL tokens for videos
stream.token.create(stridentifier, TokenCreateParams**kwargs) -> TokenCreateResponse
POST/accounts/{account_id}/stream/{identifier}/token
ModelsExpand Collapse
class TokenCreateResponse:
token: Optional[str]

The signed token used with the signed URLs feature.