Pular para o conteúdo

Finalize an upload (start transcode)

POST
/uploads/{id}/finalize
curl --request POST \
--url https://api.devstreamcore.com/v1/uploads/up_a1b2c3d4e5f6a1b2c3d4/finalize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "mime_type": "example", "file_size_bytes": 1, "duration_secs": 1, "source_height": 1, "source_width": 1, "upload_id": "example", "parts": [ { "partNumber": 1, "etag": "example" } ] }'

Idempotent. For multipart, include upload_id and parts[].

id
required
string
Example
up_a1b2c3d4e5f6a1b2c3d4
Media type application/json
object
mime_type
required
string
/^(video|audio)\/[a-z0-9.+-]+$/i/
file_size_bytes
required
integer
> 0
duration_secs
number
source_height
integer
> 0 <= 16384
source_width
integer
> 0 <= 16384
upload_id
string
parts
Array<object>
object
partNumber
required
integer
> 0
etag
required
string
>= 1 characters
Example generated
{
"mime_type": "example",
"file_size_bytes": 1,
"duration_secs": 1,
"source_height": 1,
"source_width": 1,
"upload_id": "example",
"parts": [
{
"partNumber": 1,
"etag": "example"
}
]
}

The video (transcode queued)

Media type application/json

A video asset. The shape is stable — fields are only ever added.

object
id
required
string
title
required
string
description
required
string | null
thumbnail_url
required
string | null
status
required
string
Allowed values: preparing ready errored reprocessing
progress
required

0–100, aggregated across encode + package jobs

number
transcode_attempts
required
number | null
duration
required

Seconds

number | null
file_size_bytes
required
number | null
video_codec
required
string | null
fps
required
number | null
source_url
required

Public URL of the original upload; null until landed in R2

string | null
source_width
required

Native width of the original upload (px); null when unknown

number | null
source_height
required

Native height of the original upload (px); null when unknown

number | null
creator_username
required
string | null
playback
required
object
hls
required
string | null
dash
required
string | null
mp4
required
Array<object>
object
height
required
number
url
required
string
bitrate_kbps
required

Encode target bitrate in kb/s; null on legacy rows

number | null
hls
required

Per-resolution HLS variant playlist URL; null when ungated

string | null
playback_ids
required
Array<object>
object
id
required
string
policy
required
string
Allowed values: public signed
created_at
required
string
policy
required
string
Allowed values: public signed
passthrough
required
string | null
ingest
required
object
kind
required
string
Allowed values: direct_upload url console
errors
required
Array<object>
object
type
required
string
messages
required
Array<string>
view_count
required
number
tags
required
Array<string>
created_at
required
string
updated_at
required
string
Example
{
"id": "vid_a1b2c3d4e5f6a1b2c3d4",
"status": "preparing",
"playback_ids": [
{
"id": "play_a1b2c3d4e5f6a1b2c3d4",
"policy": "public"
}
],
"policy": "public",
"ingest": {
"kind": "direct_upload"
}
}

Invalid request

Media type application/json

Error envelope — a single error per response.

object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found rate_limit_error quota_exceeded api_error
code
string
message
required
string
param
string
request_id
string
Example
{
"error": {
"type": "invalid_request_error"
}
}

Missing or invalid API key

Media type application/json

Error envelope — a single error per response.

object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found rate_limit_error quota_exceeded api_error
code
string
message
required
string
param
string
request_id
string
Example
{
"error": {
"type": "invalid_request_error"
}
}

Quota exceeded (encode minutes / duration / views)

Media type application/json

Error envelope — a single error per response.

object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found rate_limit_error quota_exceeded api_error
code
string
message
required
string
param
string
request_id
string
Example
{
"error": {
"type": "invalid_request_error"
}
}

Resource not found

Media type application/json

Error envelope — a single error per response.

object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found rate_limit_error quota_exceeded api_error
code
string
message
required
string
param
string
request_id
string
Example
{
"error": {
"type": "invalid_request_error"
}
}