6 name: PeerTube Community
7 url: 'https://joinpeertube.org'
10 url: 'https://github.com/Chocobozzz/PeerTube/blob/master/LICENSE'
12 url: 'https://joinpeertube.org/img/brand.png'
15 The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable
16 resource URLs. It returns HTTP response codes to indicate errors. It also
17 accepts and returns JSON in the HTTP body. You can use your favorite
18 HTTP/REST library for your programming language to use PeerTube. No official
19 SDK is currently provided.
22 When you sign up for an account, you are given the possibility to generate
23 sessions, and authenticate using this session token. One session token can
24 currently be used at a time.
28 Using some features of PeerTube require authentication, for which Accounts
30 provide different levels of permission as well as associated user
33 Accounts also encompass remote accounts discovered across the federation.
36 Each server exposes public information regarding supported videos and
40 Feeds of videos and feeds of comments allow to see updates and get them in
41 an aggregator or script of your choice.
44 Jobs are long-running tasks enqueued and processed by the instance
47 No additional worker registration is currently available.
48 - name: ServerFollowing
50 Managing servers which the instance interacts with is crucial to the
53 of federation in PeerTube and external video indexation. The PeerTube
56 then deals with inter-server ActivityPub operations and propagates
58 information across its social graph by posting activities to actors' inbox
63 Video abuses deal with reports of local or remote videos alike.
66 Operations dealing with listing, uploading, fetching or modifying videos.
69 The search helps to find _videos_ from within the instance and beyond.
70 Videos from other instances federated by the instance (that is, instances
71 followed by the instance) can be found via keywords and other criteria of
75 Operations dealing with comments to a video. Comments are organized in
79 Operations dealing with creation, modification and video listing of a
88 summary: Get the account by name
90 - $ref: '#/components/parameters/name'
91 - $ref: '#/components/parameters/start'
92 - $ref: '#/components/parameters/count'
93 - $ref: '#/components/parameters/sort'
96 description: successful operation
100 $ref: '#/components/schemas/Account'
101 '/accounts/{name}/videos':
106 summary: 'Get videos for an account, provided the name of that account'
108 - $ref: '#/components/parameters/name'
111 description: successful operation
115 $ref: '#/components/schemas/Video'
119 fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
120 .then(function(response) {
121 return response.json()
122 }).then(function(data) {
128 http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
133 summary: Get all accounts
136 description: successful operation
142 $ref: '#/components/schemas/Account'
147 summary: Get the configuration of the server
150 description: successful operation
154 $ref: '#/components/schemas/ServerConfig'
155 '/feeds/videos.{format}':
158 Get the feed of videos for the server, with optional filter by account
167 The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and
168 json to JSON FEED 1.0
180 The id of the local account to filter to (beware, users IDs and not
181 actors IDs which will return empty feeds
187 description: The name of the local account to filter to
192 description: successful operation
195 summary: Get list of jobs
205 description: The state of the job
208 - $ref: '#/components/parameters/start'
209 - $ref: '#/components/parameters/count'
210 - $ref: '#/components/parameters/sort'
213 description: successful operation
219 $ref: '#/components/schemas/Job'
220 '/server/following/{host}':
227 summary: Unfollow a server by hostname
232 description: 'The host to unfollow '
237 description: successful operation
242 summary: Get followers of the server
244 - $ref: '#/components/parameters/start'
245 - $ref: '#/components/parameters/count'
246 - $ref: '#/components/parameters/sort'
249 description: successful operation
255 $ref: '#/components/schemas/Follow'
260 summary: Get servers followed by the server
262 - $ref: '#/components/parameters/start'
263 - $ref: '#/components/parameters/count'
264 - $ref: '#/components/parameters/sort'
267 description: successful operation
273 $ref: '#/components/schemas/Follow'
280 summary: Follow a server
283 $ref: '#/paths/~1users~1me/put/responses/204'
288 $ref: '#/components/schemas/Follow'
291 summary: Creates user
299 description: successful operation
303 $ref: '#/components/schemas/AddUserResponse'
308 $ref: '#/components/schemas/AddUser'
309 description: User to create
312 summary: Get a list of users
318 - $ref: '#/components/parameters/start'
319 - $ref: '#/components/parameters/count'
320 - $ref: '#/components/parameters/sort'
323 description: successful operation
329 $ref: '#/components/schemas/User'
332 summary: Delete a user by its id
339 - $ref: '#/components/parameters/id'
342 $ref: '#/paths/~1users~1me/put/responses/204'
344 summary: Get user by its id
350 - $ref: '#/components/parameters/id'
353 description: successful operation
357 $ref: '#/components/schemas/User'
359 summary: Update user profile by its id
365 - $ref: '#/components/parameters/id'
368 $ref: '#/paths/~1users~1me/put/responses/204'
373 $ref: '#/components/schemas/UpdateUser'
377 summary: Get current user information
384 description: successful operation
390 $ref: '#/components/schemas/User'
392 summary: Update current user information
399 description: Successful operation
404 $ref: '#/components/schemas/UpdateMe'
406 /users/me/video-quota-used:
408 summary: Get current user used quota
415 description: successful operation
420 '/users/me/videos/{videoId}/rating':
422 summary: 'Get rating of video by its id, among those of the current user'
431 description: 'The video id '
436 description: successful operation
440 $ref: '#/components/schemas/GetMeVideoRating'
443 summary: Get videos of the current user
449 - $ref: '#/components/parameters/start'
450 - $ref: '#/components/parameters/count'
451 - $ref: '#/components/parameters/sort'
454 description: successful operation
460 $ref: '#/components/schemas/Video'
463 summary: Register a user
468 $ref: '#/paths/~1users~1me/put/responses/204'
473 $ref: '#/components/schemas/RegisterUser'
475 /users/me/avatar/pick:
477 summary: Update current user avatar
484 description: successful operation
488 $ref: '#/components/schemas/Avatar'
496 description: The file to upload.
501 # only accept png/jpeg
502 contentType: image/png, image/jpeg
505 summary: Get list of videos
512 description: category id of the video
515 - $ref: '#/components/parameters/start'
516 - $ref: '#/components/parameters/count'
517 - $ref: '#/components/parameters/sort'
520 description: successful operation
526 $ref: '#/components/schemas/Video'
529 summary: Get list of video licences known by the server
534 description: successful operation
543 summary: Get list of video licences known by the server
548 description: successful operation
557 summary: Get list of languages known by the server
562 description: successful operation
571 summary: Get list of privacy policies supported by the server
576 description: successful operation
585 summary: Update metadata for a video by its id
591 - $ref: '#/components/parameters/id2'
594 description: successful operation
598 $ref: '#/components/schemas/Video'
606 description: Video thumbnail file
609 description: Video preview file
612 description: Video category
615 description: Video licence
618 description: Video language
621 description: Video description
624 description: Whether or not we wait transcoding before publish the video
627 description: Text describing how to support the video uploader
630 description: Whether or not this video contains sensitive content
633 description: Video name
636 description: Video tags
639 description: Enable or disable comments for this video
641 scheduleUpdate: &ref_0
649 description: Video privacy target
653 description: When to update the video
657 summary: Get a video by its id
661 - $ref: '#/components/parameters/id2'
664 description: successful operation
668 $ref: '#/components/schemas/Video'
670 summary: Delete a video by its id
676 - $ref: '#/components/parameters/id2'
679 $ref: '#/paths/~1users~1me/put/responses/204'
680 '/videos/{id}/description':
682 summary: Get a video description by its id
686 - $ref: '#/components/parameters/id2'
689 description: successful operation
694 '/videos/{id}/views':
696 summary: Add a view to the video by its id
700 - $ref: '#/components/parameters/id2'
703 $ref: '#/paths/~1users~1me/put/responses/204'
706 summary: Upload a video file with its metadata
713 description: successful operation
717 $ref: '#/components/schemas/VideoUploadResponse'
725 description: Video file
729 description: Channel id that will contain this video
732 description: Video thumbnail file
735 description: Video preview file
738 $ref: '#/components/schemas/VideoPrivacy'
740 description: Video category
743 description: Video licence
746 description: Video language
749 description: Video description
752 description: Whether or not we wait transcoding before publish the video
755 description: Text describing how to support the video uploader
758 description: Whether or not this video contains sensitive content
761 description: Video name
764 description: Video tags
767 description: Enable or disable comments for this video
769 scheduleUpdate: *ref_0
778 ## DEPENDENCIES: httpie, jq
780 USERNAME="<your_username>"
781 PASSWORD="<your_password>"
782 FILE_PATH="<your_file_path>"
783 CHANNEL_ID="<your_channel_id>"
784 PRIVACY="1" # public: 1, unlisted: 2, private: 3
787 API_PATH="https://peertube2.cpy.re/api/v1"
789 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
790 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
791 token=$(http -b --form POST "$API_PATH/users/token" \
792 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
795 | jq -r ".access_token")
797 http -b --form POST "$API_PATH/videos/upload" \
798 videofile@$FILE_PATH \
799 channelId=$CHANNEL_ID \
802 "Authorization:Bearer $token"
805 summary: Get list of reported video abuses
811 - $ref: '#/components/parameters/start'
812 - $ref: '#/components/parameters/count'
813 - $ref: '#/components/parameters/sort'
816 description: successful operation
822 $ref: '#/components/schemas/VideoAbuse'
823 '/videos/{id}/abuse':
825 summary: 'Report an abuse, on a video by its id'
831 - $ref: '#/components/parameters/id2'
834 $ref: '#/paths/~1users~1me/put/responses/204'
835 '/videos/{id}/blacklist':
837 summary: Put on blacklist a video by its id
845 - $ref: '#/components/parameters/id2'
848 $ref: '#/paths/~1users~1me/put/responses/204'
850 summary: Delete an entry of the blacklist of a video by its id
858 - $ref: '#/components/parameters/id2'
861 $ref: '#/paths/~1users~1me/put/responses/204'
864 summary: Get list of videos on blacklist
872 - $ref: '#/components/parameters/start'
873 - $ref: '#/components/parameters/count'
874 - $ref: '#/components/parameters/sort'
877 description: successful operation
883 $ref: '#/components/schemas/VideoBlacklist'
886 summary: Get list of video channels
890 - $ref: '#/components/parameters/start'
891 - $ref: '#/components/parameters/count'
892 - $ref: '#/components/parameters/sort'
895 description: successful operation
901 $ref: '#/components/schemas/VideoChannel'
903 summary: Creates a video channel for the current user
910 $ref: '#/paths/~1users~1me/put/responses/204'
912 $ref: '#/components/requestBodies/VideoChannelInput'
913 '/video-channels/{id}':
915 summary: Get a video channel by its id
919 - $ref: '#/components/parameters/id3'
922 description: successful operation
926 $ref: '#/components/schemas/VideoChannel'
928 summary: Update a video channel by its id
934 - $ref: '#/components/parameters/id3'
937 $ref: '#/paths/~1users~1me/put/responses/204'
939 $ref: '#/components/requestBodies/VideoChannelInput'
941 summary: Delete a video channel by its id
947 - $ref: '#/components/parameters/id3'
950 $ref: '#/paths/~1users~1me/put/responses/204'
951 '/video-channels/{id}/videos':
953 summary: Get videos of a video channel by its id
957 - $ref: '#/components/parameters/id3'
960 description: successful operation
964 $ref: '#/components/schemas/Video'
965 '/accounts/{name}/video-channels':
967 summary: Get video channels of an account by its name
971 - $ref: '#/components/parameters/name'
974 description: successful operation
980 $ref: '#/components/schemas/VideoChannel'
981 '/videos/{id}/comment-threads':
983 summary: Get the comment threads of a video by its id
987 - $ref: '#/components/parameters/id2'
988 - $ref: '#/components/parameters/start'
989 - $ref: '#/components/parameters/count'
990 - $ref: '#/components/parameters/sort'
993 description: successful operation
997 $ref: '#/components/schemas/CommentThreadResponse'
999 summary: 'Creates a comment thread, on a video by its id'
1005 - $ref: '#/components/parameters/id2'
1008 description: successful operation
1012 $ref: '#/components/schemas/CommentThreadPostResponse'
1013 '/videos/{id}/comment-threads/{threadId}':
1015 summary: 'Get the comment thread by its id, of a video by its id'
1019 - $ref: '#/components/parameters/id2'
1023 description: The thread id (root comment id)
1028 description: successful operation
1032 $ref: '#/components/schemas/VideoCommentThreadTree'
1033 '/videos/{id}/comments/{commentId}':
1035 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1041 - $ref: '#/components/parameters/id2'
1042 - $ref: '#/components/parameters/commentId'
1045 description: successful operation
1049 $ref: '#/components/schemas/CommentThreadPostResponse'
1051 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1057 - $ref: '#/components/parameters/id2'
1058 - $ref: '#/components/parameters/commentId'
1061 $ref: '#/paths/~1users~1me/put/responses/204'
1062 '/videos/{id}/rate':
1064 summary: Vote for a video by its id
1070 - $ref: '#/components/parameters/id2'
1073 $ref: '#/paths/~1users~1me/put/responses/204'
1078 summary: Get the videos corresponding to a given query
1080 - $ref: '#/components/parameters/start'
1081 - $ref: '#/components/parameters/count'
1082 - $ref: '#/components/parameters/sort'
1086 description: String to search
1091 description: successful operation
1097 $ref: '#/components/schemas/Video'
1099 - url: 'https://peertube2.cpy.re/api/v1'
1100 description: Live Server
1114 description: Number of items
1121 description: Sort column (-createdAt for example)
1129 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1137 description: The user id
1144 description: The video id or uuid
1151 description: The video channel id or uuid
1158 description: The comment id
1166 $ref: '#/components/schemas/VideoChannelInput'
1170 In the header: *Authorization: Bearer <token\>*
1173 Authenticating via OAuth requires the following steps:
1176 - Have an account with sufficient authorization levels
1178 - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1181 - Make Authenticated Requests
1185 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1188 moderator: Moderator scope
1191 VideoConstantNumber:
1197 VideoConstantString:
1222 $ref: '#/components/schemas/VideoConstantNumber'
1224 $ref: '#/components/schemas/VideoConstantNumber'
1226 $ref: '#/components/schemas/VideoConstantString'
1228 $ref: '#/components/schemas/VideoPrivacy'
1263 $ref: '#/components/schemas/Avatar'
1271 $ref: '#/components/schemas/Account'
1347 $ref: '#/components/schemas/Account'
1348 VideoCommentThreadTree:
1351 $ref: '#/components/schemas/VideoComment'
1355 $ref: '#/components/schemas/VideoCommentThreadTree'
1385 $ref: '#/components/schemas/Avatar'
1388 - $ref: '#/components/schemas/Actor'
1415 $ref: '#/components/schemas/Account'
1419 $ref: '#/components/schemas/VideoChannel'
1464 $ref: '#/components/schemas/Actor'
1466 $ref: '#/components/schemas/Actor'
1508 VideoUploadResponse:
1517 CommentThreadResponse:
1524 $ref: '#/components/schemas/VideoComment'
1525 CommentThreadPostResponse:
1528 $ref: '#/components/schemas/VideoComment'
1533 description: 'The user username '
1536 description: 'The user password '
1539 description: 'The user email '
1542 description: 'The user videoQuota '
1545 description: 'The user role '
1556 description: 'The user id '
1559 description: 'The updated email of the user '
1562 description: 'The updated videoQuota of the user '
1565 description: 'The updated role of the user '
1575 description: 'Your new password '
1578 description: 'Your new email '
1581 description: 'Your new displayNSFW '
1584 description: 'Your new autoPlayVideo '
1594 description: 'Id of the video '
1597 description: 'Rating of the video '
1605 description: 'The username of the user '
1608 description: 'The password of the user '
1611 description: 'The email of the user '