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-rest-reference.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: Instance Configuration
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
325 - $ref: '#/components/parameters/start'
326 - $ref: '#/components/parameters/count'
327 - $ref: '#/components/parameters/sort'
330 description: successful operation
336 $ref: '#/components/schemas/Job'
337 '/server/following/{host}':
344 summary: Unfollow a server by hostname
349 description: 'The host to unfollow '
354 description: successful operation
359 summary: Get followers of the server
361 - $ref: '#/components/parameters/start'
362 - $ref: '#/components/parameters/count'
363 - $ref: '#/components/parameters/sort'
366 description: successful operation
372 $ref: '#/components/schemas/Follow'
377 summary: Get servers followed by the server
379 - $ref: '#/components/parameters/start'
380 - $ref: '#/components/parameters/count'
381 - $ref: '#/components/parameters/sort'
384 description: successful operation
390 $ref: '#/components/schemas/Follow'
397 summary: Follow a server
400 $ref: '#/paths/~1users~1me/put/responses/204'
405 $ref: '#/components/schemas/Follow'
408 summary: Creates user
416 description: successful operation
420 $ref: '#/components/schemas/AddUserResponse'
425 $ref: '#/components/schemas/AddUser'
426 description: User to create
429 summary: Get a list of users
435 - $ref: '#/components/parameters/start'
436 - $ref: '#/components/parameters/count'
437 - $ref: '#/components/parameters/usersSort'
440 description: successful operation
446 $ref: '#/components/schemas/User'
449 summary: Delete a user by its id
456 - $ref: '#/components/parameters/id'
459 $ref: '#/paths/~1users~1me/put/responses/204'
461 summary: Get user by its id
467 - $ref: '#/components/parameters/id'
470 description: successful operation
474 $ref: '#/components/schemas/User'
476 summary: Update user profile by its id
482 - $ref: '#/components/parameters/id'
485 $ref: '#/paths/~1users~1me/put/responses/204'
490 $ref: '#/components/schemas/UpdateUser'
494 summary: Get current user information
502 description: successful operation
508 $ref: '#/components/schemas/User'
510 summary: Update current user information
518 description: Successful operation
523 $ref: '#/components/schemas/UpdateMe'
525 /users/me/video-quota-used:
527 summary: Get current user used quota
535 description: successful operation
540 '/users/me/videos/{videoId}/rating':
542 summary: 'Get rating of video by its id, among those of the current user'
551 description: 'The video id '
556 description: successful operation
560 $ref: '#/components/schemas/GetMeVideoRating'
563 summary: Get videos of the current user
570 - $ref: '#/components/parameters/start'
571 - $ref: '#/components/parameters/count'
572 - $ref: '#/components/parameters/sort'
575 description: successful operation
581 $ref: '#/components/schemas/Video'
582 /users/me/subscriptions:
584 summary: Get subscriptions of the current user
591 - $ref: '#/components/parameters/start'
592 - $ref: '#/components/parameters/count'
593 - $ref: '#/components/parameters/sort'
596 description: successful operation
598 summary: Add subscription to the current user
606 description: successful operation
607 /users/me/subscriptions/exist:
609 summary: Get if subscriptions exist for the current user
616 - $ref: '#/components/parameters/subscriptionsUris'
619 description: successful operation
624 /users/me/subscriptions/videos:
626 summary: Get videos of subscriptions of the current user
633 - $ref: '#/components/parameters/start'
634 - $ref: '#/components/parameters/count'
635 - $ref: '#/components/parameters/sort'
638 description: successful operation
644 $ref: '#/components/schemas/Video'
645 '/users/me/subscriptions/{uri}':
647 summary: Get subscription of the current user for a given uri
655 description: successful operation
659 $ref: '#/components/schemas/VideoChannel'
661 summary: Delete subscription of the current user for a given uri
669 description: successful operation
672 summary: Register a user
677 $ref: '#/paths/~1users~1me/put/responses/204'
682 $ref: '#/components/schemas/RegisterUser'
684 /users/me/avatar/pick:
686 summary: Update current user avatar
693 description: successful operation
697 $ref: '#/components/schemas/Avatar'
705 description: The file to upload.
710 # only accept png/jpeg
711 contentType: image/png, image/jpeg
714 summary: Get list of videos
718 - $ref: '#/components/parameters/categoryOneOf'
719 - $ref: '#/components/parameters/tagsOneOf'
720 - $ref: '#/components/parameters/tagsAllOf'
721 - $ref: '#/components/parameters/licenceOneOf'
722 - $ref: '#/components/parameters/languageOneOf'
723 - $ref: '#/components/parameters/nsfw'
724 - $ref: '#/components/parameters/filter'
725 - $ref: '#/components/parameters/start'
726 - $ref: '#/components/parameters/count'
727 - $ref: '#/components/parameters/videosSort'
730 description: successful operation
736 $ref: '#/components/schemas/Video'
739 summary: Get list of video licences known by the server
744 description: successful operation
753 summary: Get list of video licences known by the server
758 description: successful operation
767 summary: Get list of languages known by the server
772 description: successful operation
781 summary: Get list of privacy policies supported by the server
786 description: successful operation
795 summary: Update metadata for a video by its id
801 - $ref: '#/components/parameters/id2'
804 description: successful operation
808 $ref: '#/components/schemas/Video'
816 description: Video thumbnail file
819 description: Video preview file
822 description: Video category
825 description: Video licence
828 description: Video language
831 description: Video description
834 description: Whether or not we wait transcoding before publish the video
837 description: Text describing how to support the video uploader
840 description: Whether or not this video contains sensitive content
843 description: Video name
846 description: Video tags (maximum 5 tags each between 2 and 30 characters)
851 description: Enable or disable comments for this video
853 scheduleUpdate: &ref_0
861 description: Video privacy target
865 description: When to update the video
869 summary: Get a video by its id
873 - $ref: '#/components/parameters/id2'
876 description: successful operation
880 $ref: '#/components/schemas/Video'
882 summary: Delete a video by its id
888 - $ref: '#/components/parameters/id2'
891 $ref: '#/paths/~1users~1me/put/responses/204'
892 '/videos/{id}/description':
894 summary: Get a video description by its id
898 - $ref: '#/components/parameters/id2'
901 description: successful operation
906 '/videos/{id}/views':
908 summary: Add a view to the video by its id
912 - $ref: '#/components/parameters/id2'
915 $ref: '#/paths/~1users~1me/put/responses/204'
916 '/videos/{id}/watching':
918 summary: Set watching progress of a video by its id for a user
924 - $ref: '#/components/parameters/id2'
929 $ref: '#/components/schemas/UserWatchingVideo'
933 $ref: '#/paths/~1users~1me/put/responses/204'
936 summary: Get list of video ownership changes requests
942 - $ref: '#/components/parameters/id2'
945 description: successful operation
946 '/videos/ownership/{id}/accept':
948 summary: Refuse ownership change request for video by its id
954 - $ref: '#/components/parameters/id2'
957 $ref: '#/paths/~1users~1me/put/responses/204'
958 '/videos/ownership/{id}/refuse':
960 summary: Accept ownership change request for video by its id
966 - $ref: '#/components/parameters/id2'
969 $ref: '#/paths/~1users~1me/put/responses/204'
970 '/videos/{id}/give-ownership':
972 summary: Request change of ownership for a video you own, by its id
978 - $ref: '#/components/parameters/id2'
982 application/x-www-form-urlencoded:
992 $ref: '#/paths/~1users~1me/put/responses/204'
994 description: 'Changing video ownership to a remote account is not supported yet'
997 summary: Upload a video file with its metadata
1004 description: successful operation
1008 $ref: '#/components/schemas/VideoUploadResponse'
1011 multipart/form-data:
1016 description: Video file
1020 description: Channel id that will contain this video
1023 description: Video thumbnail file
1026 description: Video preview file
1029 $ref: '#/components/schemas/VideoPrivacy'
1031 description: Video category
1034 description: Video licence
1037 description: Video language
1040 description: Video description
1043 description: Whether or not we wait transcoding before publish the video
1046 description: Text describing how to support the video uploader
1049 description: Whether or not this video contains sensitive content
1052 description: Video name
1055 description: Video tags
1060 description: Enable or disable comments for this video
1062 scheduleUpdate: *ref_0
1070 ## DEPENDENCIES: httpie, jq
1071 # pip install httpie
1072 USERNAME="<your_username>"
1073 PASSWORD="<your_password>"
1074 FILE_PATH="<your_file_path>"
1075 CHANNEL_ID="<your_channel_id>"
1078 API_PATH="https://peertube2.cpy.re/api/v1"
1080 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
1081 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
1082 token=$(http -b --form POST "$API_PATH/users/token" \
1083 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
1084 username=$USERNAME \
1085 password=$PASSWORD \
1086 | jq -r ".access_token")
1088 http -b --form POST "$API_PATH/videos/upload" \
1089 videofile@$FILE_PATH \
1090 channelId=$CHANNEL_ID \
1092 "Authorization:Bearer $token"
1095 summary: Import a torrent or magnetURI or HTTP ressource (if enabled by the instance administrator)
1102 description: successful operation
1106 $ref: '#/components/schemas/VideoUploadResponse'
1109 multipart/form-data:
1114 description: Torrent File
1118 description: HTTP target URL
1121 description: Magnet URI
1124 description: Channel id that will contain this video
1127 description: Video thumbnail file
1130 description: Video preview file
1133 $ref: '#/components/schemas/VideoPrivacy'
1135 description: Video category
1138 description: Video licence
1141 description: Video language
1144 description: Video description
1147 description: Whether or not we wait transcoding before publish the video
1150 description: Text describing how to support the video uploader
1153 description: Whether or not this video contains sensitive content
1156 description: Video name
1159 description: Video tags
1164 description: Enable or disable comments for this video
1166 scheduleUpdate: *ref_0
1172 summary: Get list of reported video abuses
1178 - $ref: '#/components/parameters/start'
1179 - $ref: '#/components/parameters/count'
1180 - $ref: '#/components/parameters/abusesSort'
1183 description: successful operation
1189 $ref: '#/components/schemas/VideoAbuse'
1190 '/videos/{id}/abuse':
1192 summary: 'Report an abuse, on a video by its id'
1198 - $ref: '#/components/parameters/id2'
1201 $ref: '#/paths/~1users~1me/put/responses/204'
1202 '/videos/{id}/blacklist':
1204 summary: Put on blacklist a video by its id
1212 - $ref: '#/components/parameters/id2'
1215 $ref: '#/paths/~1users~1me/put/responses/204'
1217 summary: Delete an entry of the blacklist of a video by its id
1225 - $ref: '#/components/parameters/id2'
1228 $ref: '#/paths/~1users~1me/put/responses/204'
1231 summary: Get list of videos on blacklist
1239 - $ref: '#/components/parameters/start'
1240 - $ref: '#/components/parameters/count'
1241 - $ref: '#/components/parameters/blacklistsSort'
1244 description: successful operation
1250 $ref: '#/components/schemas/VideoBlacklist'
1251 /videos/{id}/captions:
1253 summary: Get list of video's captions
1257 - $ref: '#/components/parameters/id2'
1260 description: successful operation
1271 $ref: '#/components/schemas/VideoCaption'
1272 /videos/{id}/captions/{captionLanguage}:
1274 summary: Add or replace a video caption
1278 - $ref: '#/components/parameters/id2'
1279 - $ref: '#/components/parameters/captionLanguage'
1282 multipart/form-data:
1287 description: The file to upload.
1292 $ref: '#/paths/~1users~1me/put/responses/204'
1294 summary: Delete a video caption
1298 - $ref: '#/components/parameters/id2'
1299 - $ref: '#/components/parameters/captionLanguage'
1302 $ref: '#/paths/~1users~1me/put/responses/204'
1305 summary: Get list of video channels
1309 - $ref: '#/components/parameters/start'
1310 - $ref: '#/components/parameters/count'
1311 - $ref: '#/components/parameters/sort'
1314 description: successful operation
1320 $ref: '#/components/schemas/VideoChannel'
1322 summary: Creates a video channel for the current user
1329 $ref: '#/paths/~1users~1me/put/responses/204'
1331 $ref: '#/components/requestBodies/VideoChannelInput'
1332 '/video-channels/{channelHandle}':
1334 summary: Get a video channel by its id
1338 - $ref: '#/components/parameters/channelHandle'
1341 description: successful operation
1345 $ref: '#/components/schemas/VideoChannel'
1347 summary: Update a video channel by its id
1353 - $ref: '#/components/parameters/channelHandle'
1356 $ref: '#/paths/~1users~1me/put/responses/204'
1358 $ref: '#/components/requestBodies/VideoChannelInput'
1360 summary: Delete a video channel by its id
1366 - $ref: '#/components/parameters/channelHandle'
1369 $ref: '#/paths/~1users~1me/put/responses/204'
1370 '/video-channels/{channelHandle}/videos':
1372 summary: Get videos of a video channel by its id
1376 - $ref: '#/components/parameters/channelHandle'
1379 description: successful operation
1383 $ref: '#/components/schemas/Video'
1384 '/accounts/{name}/video-channels':
1386 summary: Get video channels of an account by its name
1390 - $ref: '#/components/parameters/name'
1393 description: successful operation
1399 $ref: '#/components/schemas/VideoChannel'
1400 '/accounts/{name}/ratings':
1402 summary: Get ratings of an account by its name
1408 - $ref: '#/components/parameters/start'
1409 - $ref: '#/components/parameters/count'
1410 - $ref: '#/components/parameters/sort'
1414 description: Optionaly filter which ratings to retrieve
1422 description: successful operation
1428 $ref: '#/components/schemas/VideoRating'
1429 '/videos/{id}/comment-threads':
1431 summary: Get the comment threads of a video by its id
1435 - $ref: '#/components/parameters/id2'
1436 - $ref: '#/components/parameters/start'
1437 - $ref: '#/components/parameters/count'
1438 - $ref: '#/components/parameters/sort'
1441 description: successful operation
1445 $ref: '#/components/schemas/CommentThreadResponse'
1447 summary: 'Creates a comment thread, on a video by its id'
1453 - $ref: '#/components/parameters/id2'
1456 description: successful operation
1460 $ref: '#/components/schemas/CommentThreadPostResponse'
1461 '/videos/{id}/comment-threads/{threadId}':
1463 summary: 'Get the comment thread by its id, of a video by its id'
1467 - $ref: '#/components/parameters/id2'
1471 description: The thread id (root comment id)
1476 description: successful operation
1480 $ref: '#/components/schemas/VideoCommentThreadTree'
1481 '/videos/{id}/comments/{commentId}':
1483 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1489 - $ref: '#/components/parameters/id2'
1490 - $ref: '#/components/parameters/commentId'
1493 description: successful operation
1497 $ref: '#/components/schemas/CommentThreadPostResponse'
1499 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1505 - $ref: '#/components/parameters/id2'
1506 - $ref: '#/components/parameters/commentId'
1509 $ref: '#/paths/~1users~1me/put/responses/204'
1510 '/videos/{id}/rate':
1512 summary: Vote for a video by its id
1518 - $ref: '#/components/parameters/id2'
1521 $ref: '#/paths/~1users~1me/put/responses/204'
1526 summary: Get the videos corresponding to a given query
1528 - $ref: '#/components/parameters/start'
1529 - $ref: '#/components/parameters/count'
1530 - $ref: '#/components/parameters/videosSearchSort'
1534 description: String to search
1539 description: successful operation
1545 $ref: '#/components/schemas/Video'
1547 - url: 'https://peertube.cpy.re/api/v1'
1548 description: Live Test Server (live data - stable version)
1549 - url: 'https://peertube2.cpy.re/api/v1'
1550 description: Live Test Server (live data - bleeding edge version)
1551 - url: 'https://peertube3.cpy.re/api/v1'
1552 description: Live Test Server (live data - bleeding edge version)
1566 description: Number of items
1573 description: Sort column (-createdAt for example)
1580 description: Sort videos by criteria
1595 description: Sort videos by criteria
1610 description: Sort blacklists by criteria
1626 description: Sort users by criteria
1637 description: Sort abuses by criteria
1649 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1657 description: The user id
1664 description: The video id or uuid
1668 name: captionLanguage
1671 description: The caption language
1678 description: "The video channel handle (example: 'my_username@example.com' or 'my_username')"
1685 description: The comment id
1692 description: category id of the video
1705 description: tag(s) of the video
1718 description: tag(s) of the video, where all should be present in the video
1731 description: language id of the video
1744 description: licence id of the video
1757 description: whether to include nsfw videos, if any
1768 Special filters (local for instance) which might require special rights:
1769 * `local` - only videos local to the instance
1770 * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges)
1780 description: list of uris to check if each is part of the user subscriptions
1790 $ref: '#/components/schemas/VideoChannelInput'
1794 In the header: *Authorization: Bearer <token\>*
1797 Authenticating via OAuth requires the following steps:
1800 - Have an account with sufficient authorization levels
1802 - [Generate](https://docs.joinpeertube.org/#/api-rest-getting-started) a
1805 - Make Authenticated Requests
1809 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1812 moderator: Moderator scope
1815 VideoConstantNumber:
1821 VideoConstantString:
1846 $ref: '#/components/schemas/VideoConstantNumber'
1848 $ref: '#/components/schemas/VideoConstantNumber'
1850 $ref: '#/components/schemas/VideoConstantString'
1852 $ref: '#/components/schemas/VideoPrivacy'
1887 $ref: '#/components/schemas/Avatar'
1895 $ref: '#/components/schemas/Account'
1971 $ref: '#/components/schemas/Account'
1972 VideoCommentThreadTree:
1975 $ref: '#/components/schemas/VideoComment'
1979 $ref: '#/components/schemas/VideoCommentThreadTree'
1983 $ref: '#/components/schemas/VideoConstantString'
2015 $ref: '#/components/schemas/Avatar'
2018 - $ref: '#/components/schemas/Actor'
2040 description: 'The user role (Admin = 0, Moderator = 1, User = 2)'
2054 $ref: '#/components/schemas/Account'
2058 $ref: '#/components/schemas/VideoChannel'
2107 $ref: '#/components/schemas/Actor'
2109 $ref: '#/components/schemas/Actor'
2151 VideoUploadResponse:
2160 CommentThreadResponse:
2167 $ref: '#/components/schemas/VideoComment'
2168 CommentThreadPostResponse:
2171 $ref: '#/components/schemas/VideoComment'
2176 description: 'The user username '
2179 description: 'The user password '
2182 description: 'The user email '
2185 description: 'The user videoQuota '
2188 description: 'The user daily video quota '
2195 description: 'The user role (Admin = 0, Moderator = 1, User = 2)'
2207 description: 'The user id '
2210 description: 'The updated email of the user '
2213 description: 'The updated videoQuota of the user '
2216 description: 'The updated daily video quota of the user '
2223 description: 'The user role (Admin = 0, Moderator = 1, User = 2)'
2234 description: 'Your new password '
2237 description: 'Your new email '
2240 description: 'Your new displayNSFW '
2243 description: 'Your new autoPlayVideo '
2253 description: 'Id of the video '
2256 description: 'Rating of the video '
2263 $ref: '#/components/schemas/Video'
2266 description: 'Rating of the video'
2274 description: 'The username of the user '
2277 description: 'The password of the user '
2280 description: 'The email of the user '