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).
111 - name: Public Instance Information
115 - name: Notifications
129 summary: Get the account by name
131 - $ref: '#/components/parameters/name'
132 - $ref: '#/components/parameters/start'
133 - $ref: '#/components/parameters/count'
134 - $ref: '#/components/parameters/sort'
137 description: successful operation
141 $ref: '#/components/schemas/Account'
142 '/accounts/{name}/videos':
147 summary: 'Get videos for an account, provided the name of that account'
149 - $ref: '#/components/parameters/name'
152 description: successful operation
156 $ref: '#/components/schemas/Video'
160 fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
161 .then(function(response) {
162 return response.json()
163 }).then(function(data) {
169 http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
175 url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos")
177 http = Net::HTTP.new(url.host, url.port)
179 http.verify_mode = OpenSSL::SSL::VERIFY_NONE
181 request = Net::HTTP::Post.new(url)
182 request["content-type"] = 'application/json'
183 response = http.request(request)
184 puts response.read_body
189 conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1")
192 'content-type': "application/json"
195 conn.request("POST", "/accounts/{name}/videos", None, headers)
197 res = conn.getresponse()
200 print(data.decode("utf-8"))
205 summary: Get all accounts
208 description: successful operation
214 $ref: '#/components/schemas/Account'
219 summary: Get the public configuration of the server
222 description: successful operation
226 $ref: '#/components/schemas/ServerConfig'
229 summary: Get the instance about page content
234 description: successful operation
237 summary: Get the runtime configuration of the server
245 description: successful operation
247 summary: Set the runtime configuration of the server
255 description: successful operation
257 summary: Delete the runtime configuration of the server
265 description: successful operation
266 '/feeds/videos.{format}':
269 Get the feed of videos for the server, with optional filter by account
278 The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and
279 json to JSON FEED 1.0
291 The id of the local account to filter to (beware, users IDs and not
292 actors IDs which will return empty feeds
298 description: The name of the local account to filter to
303 description: successful operation
306 summary: Get list of jobs
316 description: The state of the job
319 - $ref: '#/components/parameters/start'
320 - $ref: '#/components/parameters/count'
321 - $ref: '#/components/parameters/sort'
324 description: successful operation
330 $ref: '#/components/schemas/Job'
331 '/server/following/{host}':
338 summary: Unfollow a server by hostname
343 description: 'The host to unfollow '
348 description: successful operation
353 summary: Get followers of the server
355 - $ref: '#/components/parameters/start'
356 - $ref: '#/components/parameters/count'
357 - $ref: '#/components/parameters/sort'
360 description: successful operation
366 $ref: '#/components/schemas/Follow'
371 summary: Get servers followed by the server
373 - $ref: '#/components/parameters/start'
374 - $ref: '#/components/parameters/count'
375 - $ref: '#/components/parameters/sort'
378 description: successful operation
384 $ref: '#/components/schemas/Follow'
391 summary: Follow a server
394 $ref: '#/paths/~1users~1me/put/responses/204'
399 $ref: '#/components/schemas/Follow'
402 summary: Creates user
410 description: successful operation
414 $ref: '#/components/schemas/AddUserResponse'
419 $ref: '#/components/schemas/AddUser'
420 description: User to create
423 summary: Get a list of users
429 - $ref: '#/components/parameters/start'
430 - $ref: '#/components/parameters/count'
431 - $ref: '#/components/parameters/sort'
434 description: successful operation
440 $ref: '#/components/schemas/User'
443 summary: Delete a user by its id
450 - $ref: '#/components/parameters/id'
453 $ref: '#/paths/~1users~1me/put/responses/204'
455 summary: Get user by its id
461 - $ref: '#/components/parameters/id'
464 description: successful operation
468 $ref: '#/components/schemas/User'
470 summary: Update user profile by its id
476 - $ref: '#/components/parameters/id'
479 $ref: '#/paths/~1users~1me/put/responses/204'
484 $ref: '#/components/schemas/UpdateUser'
488 summary: Get current user information
495 description: successful operation
501 $ref: '#/components/schemas/User'
503 summary: Update current user information
510 description: Successful operation
515 $ref: '#/components/schemas/UpdateMe'
517 /users/me/video-quota-used:
519 summary: Get current user used quota
526 description: successful operation
531 '/users/me/videos/{videoId}/rating':
533 summary: 'Get rating of video by its id, among those of the current user'
542 description: 'The video id '
547 description: successful operation
551 $ref: '#/components/schemas/GetMeVideoRating'
554 summary: Get videos of the current user
560 - $ref: '#/components/parameters/start'
561 - $ref: '#/components/parameters/count'
562 - $ref: '#/components/parameters/sort'
565 description: successful operation
571 $ref: '#/components/schemas/Video'
574 summary: Register a user
579 $ref: '#/paths/~1users~1me/put/responses/204'
584 $ref: '#/components/schemas/RegisterUser'
586 /users/me/avatar/pick:
588 summary: Update current user avatar
595 description: successful operation
599 $ref: '#/components/schemas/Avatar'
607 description: The file to upload.
612 # only accept png/jpeg
613 contentType: image/png, image/jpeg
616 summary: Get list of videos
623 description: category id of the video
626 - $ref: '#/components/parameters/start'
627 - $ref: '#/components/parameters/count'
628 - $ref: '#/components/parameters/sort'
631 description: successful operation
637 $ref: '#/components/schemas/Video'
640 summary: Get list of video licences known by the server
645 description: successful operation
654 summary: Get list of video licences known by the server
659 description: successful operation
668 summary: Get list of languages known by the server
673 description: successful operation
682 summary: Get list of privacy policies supported by the server
687 description: successful operation
696 summary: Update metadata for a video by its id
702 - $ref: '#/components/parameters/id2'
705 description: successful operation
709 $ref: '#/components/schemas/Video'
717 description: Video thumbnail file
720 description: Video preview file
723 description: Video category
726 description: Video licence
729 description: Video language
732 description: Video description
735 description: Whether or not we wait transcoding before publish the video
738 description: Text describing how to support the video uploader
741 description: Whether or not this video contains sensitive content
744 description: Video name
747 description: Video tags
750 description: Enable or disable comments for this video
752 scheduleUpdate: &ref_0
760 description: Video privacy target
764 description: When to update the video
768 summary: Get a video by its id
772 - $ref: '#/components/parameters/id2'
775 description: successful operation
779 $ref: '#/components/schemas/Video'
781 summary: Delete a video by its id
787 - $ref: '#/components/parameters/id2'
790 $ref: '#/paths/~1users~1me/put/responses/204'
791 '/videos/{id}/description':
793 summary: Get a video description by its id
797 - $ref: '#/components/parameters/id2'
800 description: successful operation
805 '/videos/{id}/views':
807 summary: Add a view to the video by its id
811 - $ref: '#/components/parameters/id2'
814 $ref: '#/paths/~1users~1me/put/responses/204'
815 '/videos/{id}/watching':
817 summary: Indicate progress of in watching the video by its id for a user
823 - $ref: '#/components/parameters/id2'
828 $ref: '#/components/schemas/UserWatchingVideo'
832 $ref: '#/paths/~1users~1me/put/responses/204'
835 summary: Get list of video ownership changes requests
841 - $ref: '#/components/parameters/id2'
844 description: successful operation
845 '/videos/ownership/{id}/accept':
847 summary: Refuse ownership change request for video by its id
853 - $ref: '#/components/parameters/id2'
856 $ref: '#/paths/~1users~1me/put/responses/204'
857 '/videos/ownership/{id}/refuse':
859 summary: Accept ownership change request for video by its id
865 - $ref: '#/components/parameters/id2'
868 $ref: '#/paths/~1users~1me/put/responses/204'
869 '/videos/{id}/give-ownership':
871 summary: Request change of ownership for a video you own, by its id
877 - $ref: '#/components/parameters/id2'
881 application/x-www-form-urlencoded:
891 $ref: '#/paths/~1users~1me/put/responses/204'
893 description: 'Changing video ownership to a remote account is not supported yet'
896 summary: Upload a video file with its metadata
903 description: successful operation
907 $ref: '#/components/schemas/VideoUploadResponse'
915 description: Video file
919 description: Channel id that will contain this video
922 description: Video thumbnail file
925 description: Video preview file
928 $ref: '#/components/schemas/VideoPrivacy'
930 description: Video category
933 description: Video licence
936 description: Video language
939 description: Video description
942 description: Whether or not we wait transcoding before publish the video
945 description: Text describing how to support the video uploader
948 description: Whether or not this video contains sensitive content
951 description: Video name
954 description: Video tags
957 description: Enable or disable comments for this video
959 scheduleUpdate: *ref_0
967 ## DEPENDENCIES: httpie, jq
969 USERNAME="<your_username>"
970 PASSWORD="<your_password>"
971 FILE_PATH="<your_file_path>"
972 CHANNEL_ID="<your_channel_id>"
975 API_PATH="https://peertube2.cpy.re/api/v1"
977 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
978 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
979 token=$(http -b --form POST "$API_PATH/users/token" \
980 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
983 | jq -r ".access_token")
985 http -b --form POST "$API_PATH/videos/upload" \
986 videofile@$FILE_PATH \
987 channelId=$CHANNEL_ID \
989 "Authorization:Bearer $token"
992 summary: Get list of reported video abuses
998 - $ref: '#/components/parameters/start'
999 - $ref: '#/components/parameters/count'
1000 - $ref: '#/components/parameters/sort'
1003 description: successful operation
1009 $ref: '#/components/schemas/VideoAbuse'
1010 '/videos/{id}/abuse':
1012 summary: 'Report an abuse, on a video by its id'
1018 - $ref: '#/components/parameters/id2'
1021 $ref: '#/paths/~1users~1me/put/responses/204'
1022 '/videos/{id}/blacklist':
1024 summary: Put on blacklist a video by its id
1032 - $ref: '#/components/parameters/id2'
1035 $ref: '#/paths/~1users~1me/put/responses/204'
1037 summary: Delete an entry of the blacklist of a video by its id
1045 - $ref: '#/components/parameters/id2'
1048 $ref: '#/paths/~1users~1me/put/responses/204'
1051 summary: Get list of videos on blacklist
1059 - $ref: '#/components/parameters/start'
1060 - $ref: '#/components/parameters/count'
1061 - $ref: '#/components/parameters/sort'
1064 description: successful operation
1070 $ref: '#/components/schemas/VideoBlacklist'
1073 summary: Get list of video channels
1077 - $ref: '#/components/parameters/start'
1078 - $ref: '#/components/parameters/count'
1079 - $ref: '#/components/parameters/sort'
1082 description: successful operation
1088 $ref: '#/components/schemas/VideoChannel'
1090 summary: Creates a video channel for the current user
1097 $ref: '#/paths/~1users~1me/put/responses/204'
1099 $ref: '#/components/requestBodies/VideoChannelInput'
1100 '/video-channels/{id}':
1102 summary: Get a video channel by its id
1106 - $ref: '#/components/parameters/id3'
1109 description: successful operation
1113 $ref: '#/components/schemas/VideoChannel'
1115 summary: Update a video channel by its id
1121 - $ref: '#/components/parameters/id3'
1124 $ref: '#/paths/~1users~1me/put/responses/204'
1126 $ref: '#/components/requestBodies/VideoChannelInput'
1128 summary: Delete a video channel by its id
1134 - $ref: '#/components/parameters/id3'
1137 $ref: '#/paths/~1users~1me/put/responses/204'
1138 '/video-channels/{id}/videos':
1140 summary: Get videos of a video channel by its id
1144 - $ref: '#/components/parameters/id3'
1147 description: successful operation
1151 $ref: '#/components/schemas/Video'
1152 '/accounts/{name}/video-channels':
1154 summary: Get video channels of an account by its name
1158 - $ref: '#/components/parameters/name'
1161 description: successful operation
1167 $ref: '#/components/schemas/VideoChannel'
1168 '/videos/{id}/comment-threads':
1170 summary: Get the comment threads of a video by its id
1174 - $ref: '#/components/parameters/id2'
1175 - $ref: '#/components/parameters/start'
1176 - $ref: '#/components/parameters/count'
1177 - $ref: '#/components/parameters/sort'
1180 description: successful operation
1184 $ref: '#/components/schemas/CommentThreadResponse'
1186 summary: 'Creates a comment thread, on a video by its id'
1192 - $ref: '#/components/parameters/id2'
1195 description: successful operation
1199 $ref: '#/components/schemas/CommentThreadPostResponse'
1200 '/videos/{id}/comment-threads/{threadId}':
1202 summary: 'Get the comment thread by its id, of a video by its id'
1206 - $ref: '#/components/parameters/id2'
1210 description: The thread id (root comment id)
1215 description: successful operation
1219 $ref: '#/components/schemas/VideoCommentThreadTree'
1220 '/videos/{id}/comments/{commentId}':
1222 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1228 - $ref: '#/components/parameters/id2'
1229 - $ref: '#/components/parameters/commentId'
1232 description: successful operation
1236 $ref: '#/components/schemas/CommentThreadPostResponse'
1238 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1244 - $ref: '#/components/parameters/id2'
1245 - $ref: '#/components/parameters/commentId'
1248 $ref: '#/paths/~1users~1me/put/responses/204'
1249 '/videos/{id}/rate':
1251 summary: Vote for a video by its id
1257 - $ref: '#/components/parameters/id2'
1260 $ref: '#/paths/~1users~1me/put/responses/204'
1265 summary: Get the videos corresponding to a given query
1267 - $ref: '#/components/parameters/start'
1268 - $ref: '#/components/parameters/count'
1269 - $ref: '#/components/parameters/sort'
1273 description: String to search
1278 description: successful operation
1284 $ref: '#/components/schemas/Video'
1286 - url: 'https://peertube.cpy.re/api/v1'
1287 description: Live Test Server (live data - stable version)
1288 - url: 'https://peertube2.cpy.re/api/v1'
1289 description: Live Test Server (live data - bleeding edge version)
1290 - url: 'https://peertube3.cpy.re/api/v1'
1291 description: Live Test Server (live data - bleeding edge version)
1305 description: Number of items
1312 description: Sort column (-createdAt for example)
1320 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1328 description: The user id
1335 description: The video id or uuid
1342 description: The video channel id or uuid
1349 description: The comment id
1357 $ref: '#/components/schemas/VideoChannelInput'
1361 In the header: *Authorization: Bearer <token\>*
1364 Authenticating via OAuth requires the following steps:
1367 - Have an account with sufficient authorization levels
1369 - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1372 - Make Authenticated Requests
1376 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1379 moderator: Moderator scope
1382 VideoConstantNumber:
1388 VideoConstantString:
1413 $ref: '#/components/schemas/VideoConstantNumber'
1415 $ref: '#/components/schemas/VideoConstantNumber'
1417 $ref: '#/components/schemas/VideoConstantString'
1419 $ref: '#/components/schemas/VideoPrivacy'
1454 $ref: '#/components/schemas/Avatar'
1462 $ref: '#/components/schemas/Account'
1538 $ref: '#/components/schemas/Account'
1539 VideoCommentThreadTree:
1542 $ref: '#/components/schemas/VideoComment'
1546 $ref: '#/components/schemas/VideoCommentThreadTree'
1576 $ref: '#/components/schemas/Avatar'
1579 - $ref: '#/components/schemas/Actor'
1606 $ref: '#/components/schemas/Account'
1610 $ref: '#/components/schemas/VideoChannel'
1659 $ref: '#/components/schemas/Actor'
1661 $ref: '#/components/schemas/Actor'
1703 VideoUploadResponse:
1712 CommentThreadResponse:
1719 $ref: '#/components/schemas/VideoComment'
1720 CommentThreadPostResponse:
1723 $ref: '#/components/schemas/VideoComment'
1728 description: 'The user username '
1731 description: 'The user password '
1734 description: 'The user email '
1737 description: 'The user videoQuota '
1740 description: 'The user role '
1751 description: 'The user id '
1754 description: 'The updated email of the user '
1757 description: 'The updated videoQuota of the user '
1760 description: 'The updated role of the user '
1770 description: 'Your new password '
1773 description: 'Your new email '
1776 description: 'Your new displayNSFW '
1779 description: 'Your new autoPlayVideo '
1789 description: 'Id of the video '
1792 description: 'Rating of the video '
1800 description: 'The username of the user '
1803 description: 'The password of the user '
1806 description: 'The email of the user '