Video Upload
Operations dealing with adding video or audio. PeerTube supports two upload modes, and three import modes.
Upload
- legacy, where the video file is sent in a single request
- resumable, where the video file is sent in chunks
You can upload videos more reliably by using the resumable variant. Its protocol lets you resume an upload operation after a network interruption or other transmission failure, saving time and bandwidth in the event of network failures.
Favor using resumable uploads in any of the following cases:
- You are transferring large files
- The likelihood of a network interruption is high
- Uploads are originating from a device with a low-bandwidth or unstable Internet connection, such as a mobile device
Import
- URL-based: where the URL points to any service supported by youtube-dl
- magnet-based: where the URI resolves to a BitTorrent resource containing a single supported video file
- torrent-based: where the metainfo file resolves to a BitTorrent resource containing a single supported video file
The import function is practical when the desired video/audio is available online. It makes PeerTube download it for you, saving you as much bandwidth and avoiding any instability or limitation your network might have.
- POSTUpload a video
- POSTInitialize the resumable upload of a video
- PUTSend chunk for the resumable upload of a video
- DELETECancel the resumable upload of a video, deleting any data uploaded so far
- POSTInitialize the resumable replacement of a video
- PUTSend chunk for the resumable replacement of a video
- DELETECancel the resumable replacement of a video
Import a video
Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator)
Body
multipart/form-dataany & VideoUploadRequestCommontorrentfileapplication/x-bittorrentthumbnailfileimage/jpegpreviewfileimage/jpegnamestringrequiredVideo name
What is PeerTube?channelIdinteger>= 1requiredChannel id that will contain this video
3privacyVideoPrivacySet12345privacy id of the video (see /videos/privacies)
descriptionstringVideo description
**[Want to help to translate this video?](https://weblate.framasoft.org/projects/what-is-peertube-video/)**\r\n\r\n**Take back the control of your videos! [#JoinPeertube](https://joinpeertube.org)**
waitTranscodingbooleanWhether or not we wait transcoding before publish the video
generateTranscriptionbooleanPeerTube >= 6.2 If enabled by the admin, automatically generate a subtitle of the video
supportstringA text tell the audience how to support the video creator
Please support our work on https://soutenir.framasoft.org/en/ <3nsfwbooleanWhether or not this video contains sensitive content
nsfwSummaryanyMore information about the sensitive content of the video
nsfwFlagsNSFWFlag0124NSFW flags (can be combined using bitwise or operator)
0NONE1VIOLENT2EXPLICIT_SEX
tagsArray<string>Video tags (maximum 5 tags each between 2 and 30 characters)
[
"framasoft",
"peertube"
]commentsPolicyVideoCommentsPolicySet123Comments policy of the video (Enabled = 1, Disabled = 2, Requires Approval = 3)
recommendationScopeVideoRecommendationScopeSet1234Videos that can be recommended next to a video:
1All videos2Only videos of the platform that owns the reference video (or of the current platform if no video is given)3Only videos of the account that owns the reference video4Only videos of the channel of the reference video
This is a preference of the video owner: applications displaying recommendations may not apply it
aiUsageVideoAIUsageSet1234PeerTube >= 9.0 Use of AI in the video, declared by the video creator:
1Not specified2No AI-generated content: nothing seen or heard in the video has been generated by AI3Contains AI-generated content: some parts of the video have been generated by AI4AI-generated: the whole video, or most of it, has been generated by AI
commercialContentVideoCommercialContentSet123PeerTube >= 9.0 Commercial content in the video, declared by the video creator:
1None2Promotional content: the creator promotes their own products, services or business3Paid partnership: a third party paid, or provided goods or services, in exchange for the promotion
downloadEnabledbooleanEnable or disable downloading for this video
originallyPublishedAtstring<date-time>Date when the content was originally published
scheduleUpdateVideoScheduledUpdatethumbnailfilestring<binary>Video thumbnail file
previewfilestring<binary>deprecatedDeprecated in PeerTube v8.1, use thumbnailfile instead
videoPasswordsArray<password>targetUrltargetUrl<url>requiredremote URL where to find the import's source video
https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6dmagnetUrimagnetUri<uri>requiredmagnet URI allowing to resolve the import's source video
torrentfiletorrentfile<binary>requiredTorrent file containing only the video file
Response
successful operation
magnetUri or targetUrl or a torrent file missing
video didn't pass pre-import filter
HTTP or Torrent/magnetURI import not enabled
Authorization
OAuth2oauth2Authenticating 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.
