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: Instance Configuration
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
324 - $ref: '#/components/parameters/start'
325 - $ref: '#/components/parameters/count'
326 - $ref: '#/components/parameters/sort'
329 description: successful operation
335 $ref: '#/components/schemas/Job'
336 '/server/following/{host}':
343 summary: Unfollow a server by hostname
348 description: 'The host to unfollow '
353 description: successful operation
358 summary: Get followers of the server
360 - $ref: '#/components/parameters/start'
361 - $ref: '#/components/parameters/count'
362 - $ref: '#/components/parameters/sort'
365 description: successful operation
371 $ref: '#/components/schemas/Follow'
376 summary: Get servers followed by the server
378 - $ref: '#/components/parameters/start'
379 - $ref: '#/components/parameters/count'
380 - $ref: '#/components/parameters/sort'
383 description: successful operation
389 $ref: '#/components/schemas/Follow'
396 summary: Follow a server
399 $ref: '#/paths/~1users~1me/put/responses/204'
404 $ref: '#/components/schemas/Follow'
407 summary: Creates user
415 description: successful operation
419 $ref: '#/components/schemas/AddUserResponse'
424 $ref: '#/components/schemas/AddUser'
425 description: User to create
428 summary: Get a list of users
434 - $ref: '#/components/parameters/start'
435 - $ref: '#/components/parameters/count'
436 - $ref: '#/components/parameters/usersSort'
439 description: successful operation
445 $ref: '#/components/schemas/User'
448 summary: Delete a user by its id
455 - $ref: '#/components/parameters/id'
458 $ref: '#/paths/~1users~1me/put/responses/204'
460 summary: Get user by its id
466 - $ref: '#/components/parameters/id'
469 description: successful operation
473 $ref: '#/components/schemas/User'
475 summary: Update user profile by its id
481 - $ref: '#/components/parameters/id'
484 $ref: '#/paths/~1users~1me/put/responses/204'
489 $ref: '#/components/schemas/UpdateUser'
493 summary: Get current user information
501 description: successful operation
507 $ref: '#/components/schemas/User'
509 summary: Update current user information
517 description: Successful operation
522 $ref: '#/components/schemas/UpdateMe'
524 /users/me/video-quota-used:
526 summary: Get current user used quota
534 description: successful operation
539 '/users/me/videos/{videoId}/rating':
541 summary: 'Get rating of video by its id, among those of the current user'
550 description: 'The video id '
555 description: successful operation
559 $ref: '#/components/schemas/GetMeVideoRating'
562 summary: Get videos of the current user
569 - $ref: '#/components/parameters/start'
570 - $ref: '#/components/parameters/count'
571 - $ref: '#/components/parameters/sort'
574 description: successful operation
580 $ref: '#/components/schemas/Video'
581 /users/me/subscriptions:
583 summary: Get subscriptions of the current user
590 - $ref: '#/components/parameters/start'
591 - $ref: '#/components/parameters/count'
592 - $ref: '#/components/parameters/sort'
595 description: successful operation
597 summary: Add subscription to the current user
605 description: successful operation
606 /users/me/subscriptions/exist:
608 summary: Get if subscriptions exist for the current user
615 - $ref: '#/components/parameters/subscriptionsUris'
618 description: successful operation
623 /users/me/subscriptions/videos:
625 summary: Get videos of subscriptions of the current user
632 - $ref: '#/components/parameters/start'
633 - $ref: '#/components/parameters/count'
634 - $ref: '#/components/parameters/sort'
637 description: successful operation
643 $ref: '#/components/schemas/Video'
644 '/users/me/subscriptions/{uri}':
646 summary: Get subscription of the current user for a given uri
654 description: successful operation
658 $ref: '#/components/schemas/VideoChannel'
660 summary: Delete subscription of the current user for a given uri
668 description: successful operation
671 summary: Register a user
676 $ref: '#/paths/~1users~1me/put/responses/204'
681 $ref: '#/components/schemas/RegisterUser'
683 /users/me/avatar/pick:
685 summary: Update current user avatar
692 description: successful operation
696 $ref: '#/components/schemas/Avatar'
704 description: The file to upload.
709 # only accept png/jpeg
710 contentType: image/png, image/jpeg
713 summary: Get list of videos
717 - $ref: '#/components/parameters/categoryOneOf'
718 - $ref: '#/components/parameters/tagsOneOf'
719 - $ref: '#/components/parameters/tagsAllOf'
720 - $ref: '#/components/parameters/licenceOneOf'
721 - $ref: '#/components/parameters/languageOneOf'
722 - $ref: '#/components/parameters/nsfw'
723 - $ref: '#/components/parameters/filter'
724 - $ref: '#/components/parameters/start'
725 - $ref: '#/components/parameters/count'
726 - $ref: '#/components/parameters/videosSort'
729 description: successful operation
735 $ref: '#/components/schemas/Video'
738 summary: Get list of video licences known by the server
743 description: successful operation
752 summary: Get list of video licences known by the server
757 description: successful operation
766 summary: Get list of languages known by the server
771 description: successful operation
780 summary: Get list of privacy policies supported by the server
785 description: successful operation
794 summary: Update metadata for a video by its id
800 - $ref: '#/components/parameters/id2'
803 description: successful operation
807 $ref: '#/components/schemas/Video'
815 description: Video thumbnail file
818 description: Video preview file
821 description: Video category
824 description: Video licence
827 description: Video language
830 description: Video description
833 description: Whether or not we wait transcoding before publish the video
836 description: Text describing how to support the video uploader
839 description: Whether or not this video contains sensitive content
842 description: Video name
845 description: Video tags
848 description: Enable or disable comments for this video
850 scheduleUpdate: &ref_0
858 description: Video privacy target
862 description: When to update the video
866 summary: Get a video by its id
870 - $ref: '#/components/parameters/id2'
873 description: successful operation
877 $ref: '#/components/schemas/Video'
879 summary: Delete a video by its id
885 - $ref: '#/components/parameters/id2'
888 $ref: '#/paths/~1users~1me/put/responses/204'
889 '/videos/{id}/description':
891 summary: Get a video description by its id
895 - $ref: '#/components/parameters/id2'
898 description: successful operation
903 '/videos/{id}/views':
905 summary: Add a view to the video by its id
909 - $ref: '#/components/parameters/id2'
912 $ref: '#/paths/~1users~1me/put/responses/204'
913 '/videos/{id}/watching':
915 summary: Set watching progress of a video by its id for a user
921 - $ref: '#/components/parameters/id2'
926 $ref: '#/components/schemas/UserWatchingVideo'
930 $ref: '#/paths/~1users~1me/put/responses/204'
933 summary: Get list of video ownership changes requests
939 - $ref: '#/components/parameters/id2'
942 description: successful operation
943 '/videos/ownership/{id}/accept':
945 summary: Refuse ownership change request for video by its id
951 - $ref: '#/components/parameters/id2'
954 $ref: '#/paths/~1users~1me/put/responses/204'
955 '/videos/ownership/{id}/refuse':
957 summary: Accept ownership change request for video by its id
963 - $ref: '#/components/parameters/id2'
966 $ref: '#/paths/~1users~1me/put/responses/204'
967 '/videos/{id}/give-ownership':
969 summary: Request change of ownership for a video you own, by its id
975 - $ref: '#/components/parameters/id2'
979 application/x-www-form-urlencoded:
989 $ref: '#/paths/~1users~1me/put/responses/204'
991 description: 'Changing video ownership to a remote account is not supported yet'
994 summary: Upload a video file with its metadata
1001 description: successful operation
1005 $ref: '#/components/schemas/VideoUploadResponse'
1008 multipart/form-data:
1013 description: Video file
1017 description: Channel id that will contain this video
1020 description: Video thumbnail file
1023 description: Video preview file
1026 $ref: '#/components/schemas/VideoPrivacy'
1028 description: Video category
1031 description: Video licence
1034 description: Video language
1037 description: Video description
1040 description: Whether or not we wait transcoding before publish the video
1043 description: Text describing how to support the video uploader
1046 description: Whether or not this video contains sensitive content
1049 description: Video name
1052 description: Video tags
1055 description: Enable or disable comments for this video
1057 scheduleUpdate: *ref_0
1065 ## DEPENDENCIES: httpie, jq
1066 # pip install httpie
1067 USERNAME="<your_username>"
1068 PASSWORD="<your_password>"
1069 FILE_PATH="<your_file_path>"
1070 CHANNEL_ID="<your_channel_id>"
1073 API_PATH="https://peertube2.cpy.re/api/v1"
1075 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
1076 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
1077 token=$(http -b --form POST "$API_PATH/users/token" \
1078 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
1079 username=$USERNAME \
1080 password=$PASSWORD \
1081 | jq -r ".access_token")
1083 http -b --form POST "$API_PATH/videos/upload" \
1084 videofile@$FILE_PATH \
1085 channelId=$CHANNEL_ID \
1087 "Authorization:Bearer $token"
1090 summary: Get list of reported video abuses
1096 - $ref: '#/components/parameters/start'
1097 - $ref: '#/components/parameters/count'
1098 - $ref: '#/components/parameters/abusesSort'
1101 description: successful operation
1107 $ref: '#/components/schemas/VideoAbuse'
1108 '/videos/{id}/abuse':
1110 summary: 'Report an abuse, on a video by its id'
1116 - $ref: '#/components/parameters/id2'
1119 $ref: '#/paths/~1users~1me/put/responses/204'
1120 '/videos/{id}/blacklist':
1122 summary: Put on blacklist a video by its id
1130 - $ref: '#/components/parameters/id2'
1133 $ref: '#/paths/~1users~1me/put/responses/204'
1135 summary: Delete an entry of the blacklist of a video by its id
1143 - $ref: '#/components/parameters/id2'
1146 $ref: '#/paths/~1users~1me/put/responses/204'
1149 summary: Get list of videos on blacklist
1157 - $ref: '#/components/parameters/start'
1158 - $ref: '#/components/parameters/count'
1159 - $ref: '#/components/parameters/blacklistsSort'
1162 description: successful operation
1168 $ref: '#/components/schemas/VideoBlacklist'
1171 summary: Get list of video channels
1175 - $ref: '#/components/parameters/start'
1176 - $ref: '#/components/parameters/count'
1177 - $ref: '#/components/parameters/sort'
1180 description: successful operation
1186 $ref: '#/components/schemas/VideoChannel'
1188 summary: Creates a video channel for the current user
1195 $ref: '#/paths/~1users~1me/put/responses/204'
1197 $ref: '#/components/requestBodies/VideoChannelInput'
1198 '/video-channels/{id}':
1200 summary: Get a video channel by its id
1204 - $ref: '#/components/parameters/id3'
1207 description: successful operation
1211 $ref: '#/components/schemas/VideoChannel'
1213 summary: Update a video channel by its id
1219 - $ref: '#/components/parameters/id3'
1222 $ref: '#/paths/~1users~1me/put/responses/204'
1224 $ref: '#/components/requestBodies/VideoChannelInput'
1226 summary: Delete a video channel by its id
1232 - $ref: '#/components/parameters/id3'
1235 $ref: '#/paths/~1users~1me/put/responses/204'
1236 '/video-channels/{id}/videos':
1238 summary: Get videos of a video channel by its id
1242 - $ref: '#/components/parameters/id3'
1245 description: successful operation
1249 $ref: '#/components/schemas/Video'
1250 '/accounts/{name}/video-channels':
1252 summary: Get video channels of an account by its name
1256 - $ref: '#/components/parameters/name'
1259 description: successful operation
1265 $ref: '#/components/schemas/VideoChannel'
1266 '/videos/{id}/comment-threads':
1268 summary: Get the comment threads of a video by its id
1272 - $ref: '#/components/parameters/id2'
1273 - $ref: '#/components/parameters/start'
1274 - $ref: '#/components/parameters/count'
1275 - $ref: '#/components/parameters/sort'
1278 description: successful operation
1282 $ref: '#/components/schemas/CommentThreadResponse'
1284 summary: 'Creates a comment thread, on a video by its id'
1290 - $ref: '#/components/parameters/id2'
1293 description: successful operation
1297 $ref: '#/components/schemas/CommentThreadPostResponse'
1298 '/videos/{id}/comment-threads/{threadId}':
1300 summary: 'Get the comment thread by its id, of a video by its id'
1304 - $ref: '#/components/parameters/id2'
1308 description: The thread id (root comment id)
1313 description: successful operation
1317 $ref: '#/components/schemas/VideoCommentThreadTree'
1318 '/videos/{id}/comments/{commentId}':
1320 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1326 - $ref: '#/components/parameters/id2'
1327 - $ref: '#/components/parameters/commentId'
1330 description: successful operation
1334 $ref: '#/components/schemas/CommentThreadPostResponse'
1336 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1342 - $ref: '#/components/parameters/id2'
1343 - $ref: '#/components/parameters/commentId'
1346 $ref: '#/paths/~1users~1me/put/responses/204'
1347 '/videos/{id}/rate':
1349 summary: Vote for a video by its id
1355 - $ref: '#/components/parameters/id2'
1358 $ref: '#/paths/~1users~1me/put/responses/204'
1363 summary: Get the videos corresponding to a given query
1365 - $ref: '#/components/parameters/start'
1366 - $ref: '#/components/parameters/count'
1367 - $ref: '#/components/parameters/videosSearchSort'
1371 description: String to search
1376 description: successful operation
1382 $ref: '#/components/schemas/Video'
1384 - url: 'https://peertube.cpy.re/api/v1'
1385 description: Live Test Server (live data - stable version)
1386 - url: 'https://peertube2.cpy.re/api/v1'
1387 description: Live Test Server (live data - bleeding edge version)
1388 - url: 'https://peertube3.cpy.re/api/v1'
1389 description: Live Test Server (live data - bleeding edge version)
1403 description: Number of items
1410 description: Sort column (-createdAt for example)
1417 description: Sort videos by criteria
1432 description: Sort videos by criteria
1447 description: Sort blacklists by criteria
1463 description: Sort users by criteria
1474 description: Sort abuses by criteria
1486 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1494 description: The user id
1501 description: The video id or uuid
1508 description: The video channel id or uuid
1515 description: The comment id
1522 description: category id of the video
1535 description: tag(s) of the video
1548 description: tag(s) of the video, where all should be present in the video
1561 description: language id of the video
1574 description: licence id of the video
1587 description: whether to include nsfw videos, if any
1598 Special filters (local for instance) which might require special rights:
1599 * `local` - only videos local to the instance
1600 * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges)
1610 description: list of uris to check if each is part of the user subscriptions
1620 $ref: '#/components/schemas/VideoChannelInput'
1624 In the header: *Authorization: Bearer <token\>*
1627 Authenticating via OAuth requires the following steps:
1630 - Have an account with sufficient authorization levels
1632 - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1635 - Make Authenticated Requests
1639 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1642 moderator: Moderator scope
1645 VideoConstantNumber:
1651 VideoConstantString:
1676 $ref: '#/components/schemas/VideoConstantNumber'
1678 $ref: '#/components/schemas/VideoConstantNumber'
1680 $ref: '#/components/schemas/VideoConstantString'
1682 $ref: '#/components/schemas/VideoPrivacy'
1717 $ref: '#/components/schemas/Avatar'
1725 $ref: '#/components/schemas/Account'
1801 $ref: '#/components/schemas/Account'
1802 VideoCommentThreadTree:
1805 $ref: '#/components/schemas/VideoComment'
1809 $ref: '#/components/schemas/VideoCommentThreadTree'
1839 $ref: '#/components/schemas/Avatar'
1842 - $ref: '#/components/schemas/Actor'
1869 $ref: '#/components/schemas/Account'
1873 $ref: '#/components/schemas/VideoChannel'
1922 $ref: '#/components/schemas/Actor'
1924 $ref: '#/components/schemas/Actor'
1966 VideoUploadResponse:
1975 CommentThreadResponse:
1982 $ref: '#/components/schemas/VideoComment'
1983 CommentThreadPostResponse:
1986 $ref: '#/components/schemas/VideoComment'
1991 description: 'The user username '
1994 description: 'The user password '
1997 description: 'The user email '
2000 description: 'The user videoQuota '
2008 description: 'The user role '
2019 description: 'The user id '
2022 description: 'The updated email of the user '
2025 description: 'The updated videoQuota of the user '
2028 description: 'The updated role of the user '
2038 description: 'Your new password '
2041 description: 'Your new email '
2044 description: 'Your new displayNSFW '
2047 description: 'Your new autoPlayVideo '
2057 description: 'Id of the video '
2060 description: 'Rating of the video '
2068 description: 'The username of the user '
2071 description: 'The password of the user '
2074 description: 'The email of the user '