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'
13 altText: PeerTube Project Homepage
16 The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable
17 resource URLs. It returns HTTP response codes to indicate errors. It also
18 accepts and returns JSON in the HTTP body. You can use your favorite
19 HTTP/REST library for your programming language to use PeerTube. No official
20 SDK is currently provided, but the spec API is fully compatible with
21 [openapi-generator](https://github.com/OpenAPITools/openapi-generator/wiki/API-client-generator-HOWTO)
22 which generates a client SDK in the language of your choice.
25 When you sign up for an account, you are given the possibility to generate
26 sessions, and authenticate using this session token. One session token can
27 currently be used at a time.
30 The API uses standard HTTP status codes to indicate the success or failure
31 of the API call. The body of the response will be JSON in the following
36 "code": "unauthorized_request", // example inner error code
37 "error": "Token is invalid." // example exposed error message
41 url: https://docs.joinpeertube.org/api.html
45 Using some features of PeerTube require authentication, for which Accounts
46 provide different levels of permission as well as associated user
47 information. Accounts also encompass remote accounts discovered across the federation.
50 Each server exposes public information regarding supported videos and
54 Feeds of videos and feeds of comments allow to see updates and get them in
55 an aggregator or script of your choice.
58 Jobs are long-running tasks enqueued and processed by the instance
59 itself. No additional worker registration is currently available.
60 - name: Server Following
62 Managing servers which the instance interacts with is crucial to the
63 concept of federation in PeerTube and external video indexation. The PeerTube
64 server then deals with inter-server ActivityPub operations and propagates
65 information across its social graph by posting activities to actors' inbox
69 Video abuses deal with reports of local or remote videos alike.
72 Operations dealing with listing, uploading, fetching or modifying videos.
75 The search helps to find _videos_ from within the instance and beyond.
76 Videos from other instances federated by the instance (that is, instances
77 followed by the instance) can be found via keywords and other criteria of
81 Operations dealing with comments to a video. Comments are organized in
85 Operations dealing with creation, modification and video listing of a
87 - name: Video Blacklist
89 Operations dealing with blacklisting videos (removing them from view and
90 preventing interactions).
110 - name: Public Instance Information
114 - name: Notifications
128 summary: Get the account by name
130 - $ref: '#/components/parameters/name'
131 - $ref: '#/components/parameters/start'
132 - $ref: '#/components/parameters/count'
133 - $ref: '#/components/parameters/sort'
136 description: successful operation
140 $ref: '#/components/schemas/Account'
141 '/accounts/{name}/videos':
146 summary: 'Get videos for an account, provided the name of that account'
148 - $ref: '#/components/parameters/name'
151 description: successful operation
155 $ref: '#/components/schemas/Video'
159 fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
160 .then(function(response) {
161 return response.json()
162 }).then(function(data) {
168 http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
174 url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos")
176 http = Net::HTTP.new(url.host, url.port)
178 http.verify_mode = OpenSSL::SSL::VERIFY_NONE
180 request = Net::HTTP::Post.new(url)
181 request["content-type"] = 'application/json'
182 response = http.request(request)
183 puts response.read_body
188 conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1")
191 'content-type': "application/json"
194 conn.request("POST", "/accounts/{name}/videos", None, headers)
196 res = conn.getresponse()
199 print(data.decode("utf-8"))
204 summary: Get all accounts
207 description: successful operation
213 $ref: '#/components/schemas/Account'
218 summary: Get the public configuration of the server
221 description: successful operation
225 $ref: '#/components/schemas/ServerConfig'
228 summary: Get the instance about page content
233 description: successful operation
236 summary: Get the runtime configuration of the server
244 description: successful operation
246 summary: Set the runtime configuration of the server
254 description: successful operation
256 summary: Delete the runtime configuration of the server
264 description: successful operation
265 '/feeds/videos.{format}':
268 Get the feed of videos for the server, with optional filter by account
277 The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and
278 json to JSON FEED 1.0
290 The id of the local account to filter to (beware, users IDs and not
291 actors IDs which will return empty feeds
297 description: The name of the local account to filter to
302 description: successful operation
305 summary: Get list of jobs
315 description: The state of the job
318 - $ref: '#/components/parameters/start'
319 - $ref: '#/components/parameters/count'
320 - $ref: '#/components/parameters/sort'
323 description: successful operation
329 $ref: '#/components/schemas/Job'
330 '/server/following/{host}':
337 summary: Unfollow a server by hostname
342 description: 'The host to unfollow '
347 description: successful operation
352 summary: Get followers of the server
354 - $ref: '#/components/parameters/start'
355 - $ref: '#/components/parameters/count'
356 - $ref: '#/components/parameters/sort'
359 description: successful operation
365 $ref: '#/components/schemas/Follow'
370 summary: Get servers followed by the server
372 - $ref: '#/components/parameters/start'
373 - $ref: '#/components/parameters/count'
374 - $ref: '#/components/parameters/sort'
377 description: successful operation
383 $ref: '#/components/schemas/Follow'
390 summary: Follow a server
393 $ref: '#/paths/~1users~1me/put/responses/204'
398 $ref: '#/components/schemas/Follow'
401 summary: Creates user
409 description: successful operation
413 $ref: '#/components/schemas/AddUserResponse'
418 $ref: '#/components/schemas/AddUser'
419 description: User to create
422 summary: Get a list of users
428 - $ref: '#/components/parameters/start'
429 - $ref: '#/components/parameters/count'
430 - $ref: '#/components/parameters/sort'
433 description: successful operation
439 $ref: '#/components/schemas/User'
442 summary: Delete a user by its id
449 - $ref: '#/components/parameters/id'
452 $ref: '#/paths/~1users~1me/put/responses/204'
454 summary: Get user by its id
460 - $ref: '#/components/parameters/id'
463 description: successful operation
467 $ref: '#/components/schemas/User'
469 summary: Update user profile by its id
475 - $ref: '#/components/parameters/id'
478 $ref: '#/paths/~1users~1me/put/responses/204'
483 $ref: '#/components/schemas/UpdateUser'
487 summary: Get current user information
494 description: successful operation
500 $ref: '#/components/schemas/User'
502 summary: Update current user information
509 description: Successful operation
514 $ref: '#/components/schemas/UpdateMe'
516 /users/me/video-quota-used:
518 summary: Get current user used quota
525 description: successful operation
530 '/users/me/videos/{videoId}/rating':
532 summary: 'Get rating of video by its id, among those of the current user'
541 description: 'The video id '
546 description: successful operation
550 $ref: '#/components/schemas/GetMeVideoRating'
553 summary: Get videos of the current user
559 - $ref: '#/components/parameters/start'
560 - $ref: '#/components/parameters/count'
561 - $ref: '#/components/parameters/sort'
564 description: successful operation
570 $ref: '#/components/schemas/Video'
573 summary: Register a user
578 $ref: '#/paths/~1users~1me/put/responses/204'
583 $ref: '#/components/schemas/RegisterUser'
585 /users/me/avatar/pick:
587 summary: Update current user avatar
594 description: successful operation
598 $ref: '#/components/schemas/Avatar'
606 description: The file to upload.
611 # only accept png/jpeg
612 contentType: image/png, image/jpeg
615 summary: Get list of videos
622 description: category id of the video
625 - $ref: '#/components/parameters/start'
626 - $ref: '#/components/parameters/count'
627 - $ref: '#/components/parameters/sort'
630 description: successful operation
636 $ref: '#/components/schemas/Video'
639 summary: Get list of video licences known by the server
644 description: successful operation
653 summary: Get list of video licences known by the server
658 description: successful operation
667 summary: Get list of languages known by the server
672 description: successful operation
681 summary: Get list of privacy policies supported by the server
686 description: successful operation
695 summary: Update metadata for a video by its id
701 - $ref: '#/components/parameters/id2'
704 description: successful operation
708 $ref: '#/components/schemas/Video'
716 description: Video thumbnail file
719 description: Video preview file
722 description: Video category
725 description: Video licence
728 description: Video language
731 description: Video description
734 description: Whether or not we wait transcoding before publish the video
737 description: Text describing how to support the video uploader
740 description: Whether or not this video contains sensitive content
743 description: Video name
746 description: Video tags
749 description: Enable or disable comments for this video
751 scheduleUpdate: &ref_0
759 description: Video privacy target
763 description: When to update the video
767 summary: Get a video by its id
771 - $ref: '#/components/parameters/id2'
774 description: successful operation
778 $ref: '#/components/schemas/Video'
780 summary: Delete a video by its id
786 - $ref: '#/components/parameters/id2'
789 $ref: '#/paths/~1users~1me/put/responses/204'
790 '/videos/{id}/description':
792 summary: Get a video description by its id
796 - $ref: '#/components/parameters/id2'
799 description: successful operation
804 '/videos/{id}/views':
806 summary: Add a view to the video by its id
810 - $ref: '#/components/parameters/id2'
813 $ref: '#/paths/~1users~1me/put/responses/204'
814 '/videos/{id}/watching':
816 summary: Indicate progress of in watching the video by its id for a user
822 - $ref: '#/components/parameters/id2'
827 $ref: '#/components/schemas/UserWatchingVideo'
831 $ref: '#/paths/~1users~1me/put/responses/204'
834 summary: Get list of video ownership changes requests
840 - $ref: '#/components/parameters/id2'
843 description: successful operation
844 '/videos/ownership/{id}/accept':
846 summary: Refuse ownership change request for video by its id
852 - $ref: '#/components/parameters/id2'
855 $ref: '#/paths/~1users~1me/put/responses/204'
856 '/videos/ownership/{id}/refuse':
858 summary: Accept ownership change request for video by its id
864 - $ref: '#/components/parameters/id2'
867 $ref: '#/paths/~1users~1me/put/responses/204'
868 '/videos/{id}/give-ownership':
870 summary: Request change of ownership for a video you own, by its id
876 - $ref: '#/components/parameters/id2'
880 application/x-www-form-urlencoded:
890 $ref: '#/paths/~1users~1me/put/responses/204'
892 description: 'Changing video ownership to a remote account is not supported yet'
895 summary: Upload a video file with its metadata
902 description: successful operation
906 $ref: '#/components/schemas/VideoUploadResponse'
914 description: Video file
918 description: Channel id that will contain this video
921 description: Video thumbnail file
924 description: Video preview file
927 $ref: '#/components/schemas/VideoPrivacy'
929 description: Video category
932 description: Video licence
935 description: Video language
938 description: Video description
941 description: Whether or not we wait transcoding before publish the video
944 description: Text describing how to support the video uploader
947 description: Whether or not this video contains sensitive content
950 description: Video name
953 description: Video tags
956 description: Enable or disable comments for this video
958 scheduleUpdate: *ref_0
966 ## DEPENDENCIES: httpie, jq
968 USERNAME="<your_username>"
969 PASSWORD="<your_password>"
970 FILE_PATH="<your_file_path>"
971 CHANNEL_ID="<your_channel_id>"
974 API_PATH="https://peertube2.cpy.re/api/v1"
976 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
977 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
978 token=$(http -b --form POST "$API_PATH/users/token" \
979 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
982 | jq -r ".access_token")
984 http -b --form POST "$API_PATH/videos/upload" \
985 videofile@$FILE_PATH \
986 channelId=$CHANNEL_ID \
988 "Authorization:Bearer $token"
991 summary: Get list of reported video abuses
997 - $ref: '#/components/parameters/start'
998 - $ref: '#/components/parameters/count'
999 - $ref: '#/components/parameters/sort'
1002 description: successful operation
1008 $ref: '#/components/schemas/VideoAbuse'
1009 '/videos/{id}/abuse':
1011 summary: 'Report an abuse, on a video by its id'
1017 - $ref: '#/components/parameters/id2'
1020 $ref: '#/paths/~1users~1me/put/responses/204'
1021 '/videos/{id}/blacklist':
1023 summary: Put on blacklist a video by its id
1031 - $ref: '#/components/parameters/id2'
1034 $ref: '#/paths/~1users~1me/put/responses/204'
1036 summary: Delete an entry of the blacklist of a video by its id
1044 - $ref: '#/components/parameters/id2'
1047 $ref: '#/paths/~1users~1me/put/responses/204'
1050 summary: Get list of videos on blacklist
1058 - $ref: '#/components/parameters/start'
1059 - $ref: '#/components/parameters/count'
1060 - $ref: '#/components/parameters/sort'
1063 description: successful operation
1069 $ref: '#/components/schemas/VideoBlacklist'
1072 summary: Get list of video channels
1076 - $ref: '#/components/parameters/start'
1077 - $ref: '#/components/parameters/count'
1078 - $ref: '#/components/parameters/sort'
1081 description: successful operation
1087 $ref: '#/components/schemas/VideoChannel'
1089 summary: Creates a video channel for the current user
1096 $ref: '#/paths/~1users~1me/put/responses/204'
1098 $ref: '#/components/requestBodies/VideoChannelInput'
1099 '/video-channels/{id}':
1101 summary: Get a video channel by its id
1105 - $ref: '#/components/parameters/id3'
1108 description: successful operation
1112 $ref: '#/components/schemas/VideoChannel'
1114 summary: Update a video channel by its id
1120 - $ref: '#/components/parameters/id3'
1123 $ref: '#/paths/~1users~1me/put/responses/204'
1125 $ref: '#/components/requestBodies/VideoChannelInput'
1127 summary: Delete a video channel by its id
1133 - $ref: '#/components/parameters/id3'
1136 $ref: '#/paths/~1users~1me/put/responses/204'
1137 '/video-channels/{id}/videos':
1139 summary: Get videos of a video channel by its id
1143 - $ref: '#/components/parameters/id3'
1146 description: successful operation
1150 $ref: '#/components/schemas/Video'
1151 '/accounts/{name}/video-channels':
1153 summary: Get video channels of an account by its name
1157 - $ref: '#/components/parameters/name'
1160 description: successful operation
1166 $ref: '#/components/schemas/VideoChannel'
1167 '/videos/{id}/comment-threads':
1169 summary: Get the comment threads of a video by its id
1173 - $ref: '#/components/parameters/id2'
1174 - $ref: '#/components/parameters/start'
1175 - $ref: '#/components/parameters/count'
1176 - $ref: '#/components/parameters/sort'
1179 description: successful operation
1183 $ref: '#/components/schemas/CommentThreadResponse'
1185 summary: 'Creates a comment thread, on a video by its id'
1191 - $ref: '#/components/parameters/id2'
1194 description: successful operation
1198 $ref: '#/components/schemas/CommentThreadPostResponse'
1199 '/videos/{id}/comment-threads/{threadId}':
1201 summary: 'Get the comment thread by its id, of a video by its id'
1205 - $ref: '#/components/parameters/id2'
1209 description: The thread id (root comment id)
1214 description: successful operation
1218 $ref: '#/components/schemas/VideoCommentThreadTree'
1219 '/videos/{id}/comments/{commentId}':
1221 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1227 - $ref: '#/components/parameters/id2'
1228 - $ref: '#/components/parameters/commentId'
1231 description: successful operation
1235 $ref: '#/components/schemas/CommentThreadPostResponse'
1237 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1243 - $ref: '#/components/parameters/id2'
1244 - $ref: '#/components/parameters/commentId'
1247 $ref: '#/paths/~1users~1me/put/responses/204'
1248 '/videos/{id}/rate':
1250 summary: Vote for a video by its id
1256 - $ref: '#/components/parameters/id2'
1259 $ref: '#/paths/~1users~1me/put/responses/204'
1264 summary: Get the videos corresponding to a given query
1266 - $ref: '#/components/parameters/start'
1267 - $ref: '#/components/parameters/count'
1268 - $ref: '#/components/parameters/sort'
1272 description: String to search
1277 description: successful operation
1283 $ref: '#/components/schemas/Video'
1285 - url: 'https://peertube.cpy.re/api/v1'
1286 description: Live Test Server (live data - stable version)
1287 - url: 'https://peertube2.cpy.re/api/v1'
1288 description: Live Test Server (live data - bleeding edge version)
1289 - url: 'https://peertube3.cpy.re/api/v1'
1290 description: Live Test Server (live data - bleeding edge version)
1304 description: Number of items
1311 description: Sort column (-createdAt for example)
1319 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1327 description: The user id
1334 description: The video id or uuid
1341 description: The video channel id or uuid
1348 description: The comment id
1356 $ref: '#/components/schemas/VideoChannelInput'
1360 In the header: *Authorization: Bearer <token\>*
1363 Authenticating via OAuth requires the following steps:
1366 - Have an account with sufficient authorization levels
1368 - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1371 - Make Authenticated Requests
1375 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1378 moderator: Moderator scope
1381 VideoConstantNumber:
1387 VideoConstantString:
1412 $ref: '#/components/schemas/VideoConstantNumber'
1414 $ref: '#/components/schemas/VideoConstantNumber'
1416 $ref: '#/components/schemas/VideoConstantString'
1418 $ref: '#/components/schemas/VideoPrivacy'
1453 $ref: '#/components/schemas/Avatar'
1461 $ref: '#/components/schemas/Account'
1537 $ref: '#/components/schemas/Account'
1538 VideoCommentThreadTree:
1541 $ref: '#/components/schemas/VideoComment'
1545 $ref: '#/components/schemas/VideoCommentThreadTree'
1575 $ref: '#/components/schemas/Avatar'
1578 - $ref: '#/components/schemas/Actor'
1605 $ref: '#/components/schemas/Account'
1609 $ref: '#/components/schemas/VideoChannel'
1658 $ref: '#/components/schemas/Actor'
1660 $ref: '#/components/schemas/Actor'
1702 VideoUploadResponse:
1711 CommentThreadResponse:
1718 $ref: '#/components/schemas/VideoComment'
1719 CommentThreadPostResponse:
1722 $ref: '#/components/schemas/VideoComment'
1727 description: 'The user username '
1730 description: 'The user password '
1733 description: 'The user email '
1736 description: 'The user videoQuota '
1739 description: 'The user role '
1750 description: 'The user id '
1753 description: 'The updated email of the user '
1756 description: 'The updated videoQuota of the user '
1759 description: 'The updated role of the user '
1769 description: 'Your new password '
1772 description: 'Your new email '
1775 description: 'Your new displayNSFW '
1778 description: 'Your new autoPlayVideo '
1788 description: 'Id of the video '
1791 description: 'Rating of the video '
1799 description: 'The username of the user '
1802 description: 'The password of the user '
1805 description: 'The email of the user '