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
500 description: successful operation
506 $ref: '#/components/schemas/User'
508 summary: Update current user information
515 description: Successful operation
520 $ref: '#/components/schemas/UpdateMe'
522 /users/me/video-quota-used:
524 summary: Get current user used quota
531 description: successful operation
536 '/users/me/videos/{videoId}/rating':
538 summary: 'Get rating of video by its id, among those of the current user'
547 description: 'The video id '
552 description: successful operation
556 $ref: '#/components/schemas/GetMeVideoRating'
559 summary: Get videos of the current user
565 - $ref: '#/components/parameters/start'
566 - $ref: '#/components/parameters/count'
567 - $ref: '#/components/parameters/sort'
570 description: successful operation
576 $ref: '#/components/schemas/Video'
579 summary: Register a user
584 $ref: '#/paths/~1users~1me/put/responses/204'
589 $ref: '#/components/schemas/RegisterUser'
591 /users/me/avatar/pick:
593 summary: Update current user avatar
600 description: successful operation
604 $ref: '#/components/schemas/Avatar'
612 description: The file to upload.
617 # only accept png/jpeg
618 contentType: image/png, image/jpeg
621 summary: Get list of videos
625 - $ref: '#/components/parameters/categoryOneOf'
626 - $ref: '#/components/parameters/tagsOneOf'
627 - $ref: '#/components/parameters/tagsAllOf'
628 - $ref: '#/components/parameters/licenceOneOf'
629 - $ref: '#/components/parameters/languageOneOf'
630 - $ref: '#/components/parameters/nsfw'
631 - $ref: '#/components/parameters/filter'
632 - $ref: '#/components/parameters/start'
633 - $ref: '#/components/parameters/count'
634 - $ref: '#/components/parameters/videosSort'
637 description: successful operation
643 $ref: '#/components/schemas/Video'
646 summary: Get list of video licences known by the server
651 description: successful operation
660 summary: Get list of video licences known by the server
665 description: successful operation
674 summary: Get list of languages known by the server
679 description: successful operation
688 summary: Get list of privacy policies supported by the server
693 description: successful operation
702 summary: Update metadata for a video by its id
708 - $ref: '#/components/parameters/id2'
711 description: successful operation
715 $ref: '#/components/schemas/Video'
723 description: Video thumbnail file
726 description: Video preview file
729 description: Video category
732 description: Video licence
735 description: Video language
738 description: Video description
741 description: Whether or not we wait transcoding before publish the video
744 description: Text describing how to support the video uploader
747 description: Whether or not this video contains sensitive content
750 description: Video name
753 description: Video tags
756 description: Enable or disable comments for this video
758 scheduleUpdate: &ref_0
766 description: Video privacy target
770 description: When to update the video
774 summary: Get a video by its id
778 - $ref: '#/components/parameters/id2'
781 description: successful operation
785 $ref: '#/components/schemas/Video'
787 summary: Delete a video by its id
793 - $ref: '#/components/parameters/id2'
796 $ref: '#/paths/~1users~1me/put/responses/204'
797 '/videos/{id}/description':
799 summary: Get a video description by its id
803 - $ref: '#/components/parameters/id2'
806 description: successful operation
811 '/videos/{id}/views':
813 summary: Add a view to the video by its id
817 - $ref: '#/components/parameters/id2'
820 $ref: '#/paths/~1users~1me/put/responses/204'
821 '/videos/{id}/watching':
823 summary: Indicate progress of in watching the video by its id for a user
829 - $ref: '#/components/parameters/id2'
834 $ref: '#/components/schemas/UserWatchingVideo'
838 $ref: '#/paths/~1users~1me/put/responses/204'
841 summary: Get list of video ownership changes requests
847 - $ref: '#/components/parameters/id2'
850 description: successful operation
851 '/videos/ownership/{id}/accept':
853 summary: Refuse ownership change request for video by its id
859 - $ref: '#/components/parameters/id2'
862 $ref: '#/paths/~1users~1me/put/responses/204'
863 '/videos/ownership/{id}/refuse':
865 summary: Accept ownership change request for video by its id
871 - $ref: '#/components/parameters/id2'
874 $ref: '#/paths/~1users~1me/put/responses/204'
875 '/videos/{id}/give-ownership':
877 summary: Request change of ownership for a video you own, by its id
883 - $ref: '#/components/parameters/id2'
887 application/x-www-form-urlencoded:
897 $ref: '#/paths/~1users~1me/put/responses/204'
899 description: 'Changing video ownership to a remote account is not supported yet'
902 summary: Upload a video file with its metadata
909 description: successful operation
913 $ref: '#/components/schemas/VideoUploadResponse'
921 description: Video file
925 description: Channel id that will contain this video
928 description: Video thumbnail file
931 description: Video preview file
934 $ref: '#/components/schemas/VideoPrivacy'
936 description: Video category
939 description: Video licence
942 description: Video language
945 description: Video description
948 description: Whether or not we wait transcoding before publish the video
951 description: Text describing how to support the video uploader
954 description: Whether or not this video contains sensitive content
957 description: Video name
960 description: Video tags
963 description: Enable or disable comments for this video
965 scheduleUpdate: *ref_0
973 ## DEPENDENCIES: httpie, jq
975 USERNAME="<your_username>"
976 PASSWORD="<your_password>"
977 FILE_PATH="<your_file_path>"
978 CHANNEL_ID="<your_channel_id>"
981 API_PATH="https://peertube2.cpy.re/api/v1"
983 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
984 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
985 token=$(http -b --form POST "$API_PATH/users/token" \
986 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
989 | jq -r ".access_token")
991 http -b --form POST "$API_PATH/videos/upload" \
992 videofile@$FILE_PATH \
993 channelId=$CHANNEL_ID \
995 "Authorization:Bearer $token"
998 summary: Get list of reported video abuses
1004 - $ref: '#/components/parameters/start'
1005 - $ref: '#/components/parameters/count'
1006 - $ref: '#/components/parameters/abusesSort'
1009 description: successful operation
1015 $ref: '#/components/schemas/VideoAbuse'
1016 '/videos/{id}/abuse':
1018 summary: 'Report an abuse, on a video by its id'
1024 - $ref: '#/components/parameters/id2'
1027 $ref: '#/paths/~1users~1me/put/responses/204'
1028 '/videos/{id}/blacklist':
1030 summary: Put on blacklist a video by its id
1038 - $ref: '#/components/parameters/id2'
1041 $ref: '#/paths/~1users~1me/put/responses/204'
1043 summary: Delete an entry of the blacklist of a video by its id
1051 - $ref: '#/components/parameters/id2'
1054 $ref: '#/paths/~1users~1me/put/responses/204'
1057 summary: Get list of videos on blacklist
1065 - $ref: '#/components/parameters/start'
1066 - $ref: '#/components/parameters/count'
1067 - $ref: '#/components/parameters/blacklistsSort'
1070 description: successful operation
1076 $ref: '#/components/schemas/VideoBlacklist'
1079 summary: Get list of video channels
1083 - $ref: '#/components/parameters/start'
1084 - $ref: '#/components/parameters/count'
1085 - $ref: '#/components/parameters/sort'
1088 description: successful operation
1094 $ref: '#/components/schemas/VideoChannel'
1096 summary: Creates a video channel for the current user
1103 $ref: '#/paths/~1users~1me/put/responses/204'
1105 $ref: '#/components/requestBodies/VideoChannelInput'
1106 '/video-channels/{id}':
1108 summary: Get a video channel by its id
1112 - $ref: '#/components/parameters/id3'
1115 description: successful operation
1119 $ref: '#/components/schemas/VideoChannel'
1121 summary: Update a video channel by its id
1127 - $ref: '#/components/parameters/id3'
1130 $ref: '#/paths/~1users~1me/put/responses/204'
1132 $ref: '#/components/requestBodies/VideoChannelInput'
1134 summary: Delete a video channel by its id
1140 - $ref: '#/components/parameters/id3'
1143 $ref: '#/paths/~1users~1me/put/responses/204'
1144 '/video-channels/{id}/videos':
1146 summary: Get videos of a video channel by its id
1150 - $ref: '#/components/parameters/id3'
1153 description: successful operation
1157 $ref: '#/components/schemas/Video'
1158 '/accounts/{name}/video-channels':
1160 summary: Get video channels of an account by its name
1164 - $ref: '#/components/parameters/name'
1167 description: successful operation
1173 $ref: '#/components/schemas/VideoChannel'
1174 '/videos/{id}/comment-threads':
1176 summary: Get the comment threads of a video by its id
1180 - $ref: '#/components/parameters/id2'
1181 - $ref: '#/components/parameters/start'
1182 - $ref: '#/components/parameters/count'
1183 - $ref: '#/components/parameters/sort'
1186 description: successful operation
1190 $ref: '#/components/schemas/CommentThreadResponse'
1192 summary: 'Creates a comment thread, on a video by its id'
1198 - $ref: '#/components/parameters/id2'
1201 description: successful operation
1205 $ref: '#/components/schemas/CommentThreadPostResponse'
1206 '/videos/{id}/comment-threads/{threadId}':
1208 summary: 'Get the comment thread by its id, of a video by its id'
1212 - $ref: '#/components/parameters/id2'
1216 description: The thread id (root comment id)
1221 description: successful operation
1225 $ref: '#/components/schemas/VideoCommentThreadTree'
1226 '/videos/{id}/comments/{commentId}':
1228 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1234 - $ref: '#/components/parameters/id2'
1235 - $ref: '#/components/parameters/commentId'
1238 description: successful operation
1242 $ref: '#/components/schemas/CommentThreadPostResponse'
1244 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1250 - $ref: '#/components/parameters/id2'
1251 - $ref: '#/components/parameters/commentId'
1254 $ref: '#/paths/~1users~1me/put/responses/204'
1255 '/videos/{id}/rate':
1257 summary: Vote for a video by its id
1263 - $ref: '#/components/parameters/id2'
1266 $ref: '#/paths/~1users~1me/put/responses/204'
1271 summary: Get the videos corresponding to a given query
1273 - $ref: '#/components/parameters/start'
1274 - $ref: '#/components/parameters/count'
1275 - $ref: '#/components/parameters/videosSearchSort'
1279 description: String to search
1284 description: successful operation
1290 $ref: '#/components/schemas/Video'
1292 - url: 'https://peertube.cpy.re/api/v1'
1293 description: Live Test Server (live data - stable version)
1294 - url: 'https://peertube2.cpy.re/api/v1'
1295 description: Live Test Server (live data - bleeding edge version)
1296 - url: 'https://peertube3.cpy.re/api/v1'
1297 description: Live Test Server (live data - bleeding edge version)
1311 description: Number of items
1318 description: Sort column (-createdAt for example)
1325 description: Sort videos by criteria
1340 description: Sort videos by criteria
1355 description: Sort blacklists by criteria
1371 description: Sort users by criteria
1382 description: Sort abuses by criteria
1394 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1402 description: The user id
1409 description: The video id or uuid
1416 description: The video channel id or uuid
1423 description: The comment id
1430 description: category id of the video
1443 description: tag(s) of the video
1456 description: tag(s) of the video, where all should be present in the video
1469 description: language id of the video
1482 description: licence id of the video
1495 description: whether to include nsfw videos, if any
1506 Special filters (local for instance) which might require special rights:
1507 * `local` - only videos local to the instance
1508 * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges)
1519 $ref: '#/components/schemas/VideoChannelInput'
1523 In the header: *Authorization: Bearer <token\>*
1526 Authenticating via OAuth requires the following steps:
1529 - Have an account with sufficient authorization levels
1531 - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1534 - Make Authenticated Requests
1538 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1541 moderator: Moderator scope
1544 VideoConstantNumber:
1550 VideoConstantString:
1575 $ref: '#/components/schemas/VideoConstantNumber'
1577 $ref: '#/components/schemas/VideoConstantNumber'
1579 $ref: '#/components/schemas/VideoConstantString'
1581 $ref: '#/components/schemas/VideoPrivacy'
1616 $ref: '#/components/schemas/Avatar'
1624 $ref: '#/components/schemas/Account'
1700 $ref: '#/components/schemas/Account'
1701 VideoCommentThreadTree:
1704 $ref: '#/components/schemas/VideoComment'
1708 $ref: '#/components/schemas/VideoCommentThreadTree'
1738 $ref: '#/components/schemas/Avatar'
1741 - $ref: '#/components/schemas/Actor'
1768 $ref: '#/components/schemas/Account'
1772 $ref: '#/components/schemas/VideoChannel'
1821 $ref: '#/components/schemas/Actor'
1823 $ref: '#/components/schemas/Actor'
1865 VideoUploadResponse:
1874 CommentThreadResponse:
1881 $ref: '#/components/schemas/VideoComment'
1882 CommentThreadPostResponse:
1885 $ref: '#/components/schemas/VideoComment'
1890 description: 'The user username '
1893 description: 'The user password '
1896 description: 'The user email '
1899 description: 'The user videoQuota '
1907 description: 'The user role '
1918 description: 'The user id '
1921 description: 'The updated email of the user '
1924 description: 'The updated videoQuota of the user '
1927 description: 'The updated role of the user '
1937 description: 'Your new password '
1940 description: 'Your new email '
1943 description: 'Your new displayNSFW '
1946 description: 'Your new autoPlayVideo '
1956 description: 'Id of the video '
1959 description: 'Rating of the video '
1967 description: 'The username of the user '
1970 description: 'The password of the user '
1973 description: 'The email of the user '