Video Upload

Send chunk for the resumable upload of a video

PUT
https://peertube2.cpy.re/api/v1/videos/upload-resumable

Uses a resumable protocol to continue, pause or resume the upload of a video

Body

application/octet-stream
string<binary>

Parameters

upload_idstringrequiredquery

Created session id to proceed with. If you didn't send chunks in the last hour, it is not valid anymore and you need to initialize a new upload.

Content-Rangestringrequiredheader

Specifies the bytes in the file that the request is uploading.

For example, a value of bytes 0-262143/1000000 shows that the request is sending the first 262144 bytes (256 x 1024) in a 2,469,036 byte file.

When the server config client.videos.resumableUpload.minChunkSize (video uploads) or import.users.resumableUpload.minChunkSize (user archive imports) is not 0, every chunk except the last one must be at least that big. It must also be at least 1/10,000 of the file size (the maximum number of object storage multipart upload parts).

Content-Lengthnumberrequiredheader

Size of the chunk that the request is sending.

Remember that larger chunks are more efficient. PeerTube's web client uses chunks varying from 1048576 bytes (~1MB) and increases or reduces size depending on connection health.

Response

last chunk received

Response headers
Content-Lengthnumberheader
Response fields application/json
videoobject
Show child attributes
idid

object id for the video

Show child attributes
id>= 1
Example
42
uuidUUIDv4

universal identifier for the video, that can be used across instances

Show child attributes
UUIDv4<uuid>
Example
9c9de5e8-0a1e-484a-b099-e80766180a6d
shortUUIDshortUUID
Show child attributes

translation of a uuid v4 with a bigger alphabet to have a shorter uuid

shortUUID
Example
2y84q2MQUMWPbiEcxNXMgC
308Permanent Redirect

resume incomplete

Response headers
Rangestringheader
Content-Lengthnumberheader
400Bad Request

chunk is smaller than client.videos.resumableUpload.minChunkSize of the server config or 1/10,000 of the file size (and is not the last one)

403Forbidden

video didn't pass upload filter

404Not Found

upload not found

409Conflict

chunk doesn't match range

422Unprocessable Entity

video unreadable

429Too Many Requests

too many concurrent requests

503Service Unavailable

upload is already being processed

Response headers
Retry-Afternumberheader

Authorization

OAuth2oauth2

Authenticating via OAuth requires the following steps:

  • Have an activated account
  • Generate an access token for that account at /api/v1/users/token.
  • Make requests with the Authorization: Bearer <token> header
  • Profit, depending on the role assigned to the account

Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.