Stream Videos
Initiate video uploads using TUS
POST /accounts/{account_id}/stream
Initiates a video upload using the TUS protocol. On success, the server responds with a status code 201 (created) and includes a location header to indicate where the content should be uploaded. Refer to https://tus.io for protocol details.
Responses
200 Initiate video uploads using TUS response.
Data is at
body["result"]
4XX Initiate video uploads using TUS response failure.
List videos
GET /accounts/{account_id}/stream
Lists up to 1000 videos from a single request. For a specific range, refer to the optional parameters.
Responses
200 List videos response.
Data is at
body["result"]
[
{
"allowedOrigins": [
"*string*"
],
"created": "*string*",
"creator": "*string*",
"duration": "*number*",
"input": {
"height": "*integer*",
"width": "*integer*"
},
"liveInput": "*string*",
"maxDurationSeconds": "*integer*",
"meta": {},
"modified": "*string*",
"playback": {
"dash": "*string*",
"hls": "*string*"
},
"preview": "*string*",
"readyToStream": "*boolean*",
"readyToStreamAt": "*string*",
"requireSignedURLs": "*boolean*",
"scheduledDeletion": "*string*",
"size": "*number*",
"status": null,
"thumbnail": "*string*",
"thumbnailTimestampPct": "*number*",
"uid": "*string*",
"uploadExpiry": "*string*",
"uploaded": "*string*",
"watermark": {
"created": null,
"downloadedFrom": null,
"height": null,
"name": null,
"opacity": null,
"padding": null,
"position": null,
"scale": null,
"size": null,
"uid": null,
"width": null
}
}
]4XX List videos response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Upload videos from a URL
POST /accounts/{account_id}/stream/copy
Uploads a video to Stream from a provided URL.
Responses
200 Upload videos from a URL response.
Data is at
body["result"]
{
"allowedOrigins": [
"*string*"
],
"created": "*string*",
"creator": "*string*",
"duration": "*number*",
"input": {
"height": "*integer*",
"width": "*integer*"
},
"liveInput": "*string*",
"maxDurationSeconds": "*integer*",
"meta": {},
"modified": "*string*",
"playback": {
"dash": "*string*",
"hls": "*string*"
},
"preview": "*string*",
"readyToStream": "*boolean*",
"readyToStreamAt": "*string*",
"requireSignedURLs": "*boolean*",
"scheduledDeletion": "*string*",
"size": "*number*",
"status": null,
"thumbnail": "*string*",
"thumbnailTimestampPct": "*number*",
"uid": "*string*",
"uploadExpiry": "*string*",
"uploaded": "*string*",
"watermark": {
"created": "*string*",
"downloadedFrom": "*string*",
"height": "*integer*",
"name": "*string*",
"opacity": "*number*",
"padding": "*number*",
"position": "*string*",
"scale": "*number*",
"size": "*number*",
"uid": "*string*",
"width": "*integer*"
}
}4XX Upload videos from a URL response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Upload videos via direct upload URLs
POST /accounts/{account_id}/stream/direct_upload
Creates a direct upload that allows video uploads without an API key.
Responses
200 Upload videos via direct upload URLs response.
Data is at
body["result"]
{
"scheduledDeletion": "*string*",
"uid": "*string*",
"uploadURL": "*string*",
"watermark": {
"created": "*string*",
"downloadedFrom": "*string*",
"height": "*integer*",
"name": "*string*",
"opacity": "*number*",
"padding": "*number*",
"position": "*string*",
"scale": "*number*",
"size": "*number*",
"uid": "*string*",
"width": "*integer*"
}
}4XX Upload videos via direct upload URLs response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Storage use
GET /accounts/{account_id}/stream/storage-usage
Returns information about an account's storage use.
Responses
200 Returns information about an account's storage use response.
Data is at
body["result"]
{
"creator": "*string*",
"totalStorageMinutes": "*integer*",
"totalStorageMinutesLimit": "*integer*",
"videoCount": "*integer*"
}4XX Returns information about an account's storage use response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Edit video details
POST /accounts/{account_id}/stream/{identifier}
Edit details for a single video.
Responses
200 Edit video details response.
Data is at
body["result"]
{
"allowedOrigins": [
"*string*"
],
"created": "*string*",
"creator": "*string*",
"duration": "*number*",
"input": {
"height": "*integer*",
"width": "*integer*"
},
"liveInput": "*string*",
"maxDurationSeconds": "*integer*",
"meta": {},
"modified": "*string*",
"playback": {
"dash": "*string*",
"hls": "*string*"
},
"preview": "*string*",
"readyToStream": "*boolean*",
"readyToStreamAt": "*string*",
"requireSignedURLs": "*boolean*",
"scheduledDeletion": "*string*",
"size": "*number*",
"status": null,
"thumbnail": "*string*",
"thumbnailTimestampPct": "*number*",
"uid": "*string*",
"uploadExpiry": "*string*",
"uploaded": "*string*",
"watermark": {
"created": "*string*",
"downloadedFrom": "*string*",
"height": "*integer*",
"name": "*string*",
"opacity": "*number*",
"padding": "*number*",
"position": "*string*",
"scale": "*number*",
"size": "*number*",
"uid": "*string*",
"width": "*integer*"
}
}4XX Edit video details response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Retrieve video details
GET /accounts/{account_id}/stream/{identifier}
Fetches details for a single video.
Responses
200 Retrieve video details response.
Data is at
body["result"]
{
"allowedOrigins": [
"*string*"
],
"created": "*string*",
"creator": "*string*",
"duration": "*number*",
"input": {
"height": "*integer*",
"width": "*integer*"
},
"liveInput": "*string*",
"maxDurationSeconds": "*integer*",
"meta": {},
"modified": "*string*",
"playback": {
"dash": "*string*",
"hls": "*string*"
},
"preview": "*string*",
"readyToStream": "*boolean*",
"readyToStreamAt": "*string*",
"requireSignedURLs": "*boolean*",
"scheduledDeletion": "*string*",
"size": "*number*",
"status": null,
"thumbnail": "*string*",
"thumbnailTimestampPct": "*number*",
"uid": "*string*",
"uploadExpiry": "*string*",
"uploaded": "*string*",
"watermark": {
"created": "*string*",
"downloadedFrom": "*string*",
"height": "*integer*",
"name": "*string*",
"opacity": "*number*",
"padding": "*number*",
"position": "*string*",
"scale": "*number*",
"size": "*number*",
"uid": "*string*",
"width": "*integer*"
}
}4XX Retrieve video details response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Delete video
DELETE /accounts/{account_id}/stream/{identifier}
Deletes a video and its copies from Cloudflare Stream.
Responses
200 Delete video response.
Data is at
body["result"]
4XX Delete video response failure.
Retrieve embed Code HTML
GET /accounts/{account_id}/stream/{identifier}/embed
Fetches an HTML code snippet to embed a video in a web page delivered through Cloudflare. On success, returns an HTML fragment for use on web pages to display a video. On failure, returns a JSON response body.
Responses
200 Retreieve embed Code HTML response.
Data is at
body["result"]
"*string*"4XX Retreieve embed Code HTML response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}Create signed URL tokens for videos
POST /accounts/{account_id}/stream/{identifier}/token
Creates a signed URL token for a video. If a body is not provided in the request, a token is created with default values.
Responses
200 Create signed URL tokens for videos response.
Data is at
body["result"]
{
"token": "*string*"
}4XX Create signed URL tokens for videos response failure.
{
"errors": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"messages": [
{
"code": "*integer*",
"documentation_url": "*string*",
"message": "*string*",
"source": {
"pointer": "*string*"
}
}
],
"result": {},
"success": "*boolean*"
}
Summary
Functions
Uploads a video to Stream from a provided URL.
Creates a signed URL token for a video.
Returns storage usage information for the account.
Edits details for a single video (Stream uses POST for updates).
Functions
@spec client(Restlax.Resource.action_options()) :: module()
Uploads a video to Stream from a provided URL.
Creates a signed URL token for a video.
@spec delete(id :: term(), opts :: Restlax.Resource.action_options()) :: {:ok, map()} | {:error, term()}
@spec delete!(id :: term(), opts :: Restlax.Resource.action_options()) :: map() | no_return()
@spec index(opts :: Restlax.Resource.action_options()) :: {:ok, map()} | {:error, term()}
@spec index!(opts :: Restlax.Resource.action_options()) :: map() | no_return()
@spec show(id :: term(), opts :: Restlax.Resource.action_options()) :: {:ok, map()} | {:error, term()}
@spec show!(id :: term(), opts :: Restlax.Resource.action_options()) :: map() | no_return()
Returns storage usage information for the account.
Edits details for a single video (Stream uses POST for updates).