rename ask-email link to ask-send-email
[oweals/peertube.git] / support / doc / api / openapi.yaml
1 openapi: 3.0.0
2 info:
3   title: PeerTube
4   version: 1.1.0
5   contact:
6     name: PeerTube Community
7     url: 'https://joinpeertube.org'
8   license:
9     name: AGPLv3.0
10     url: 'https://github.com/Chocobozzz/PeerTube/blob/master/LICENSE'
11   x-logo:
12     url: 'https://joinpeertube.org/img/brand.png'
13     altText: PeerTube Project Homepage
14   description: |
15     # Introduction
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.
23
24     # Authentication
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.
28
29     # Errors
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
32     format.
33
34     ```
35     {
36       "code": "unauthorized_request", // example inner error code
37       "error": "Token is invalid." // example exposed error message
38     }
39     ```
40 externalDocs:
41   url: https://docs.joinpeertube.org/api.html
42 tags:
43   - name: Accounts
44     description: >
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.
48   - name: Config
49     description: >
50       Each server exposes public information regarding supported videos and
51       options.
52   - name: Feeds
53     description: |
54       Feeds of videos and feeds of comments allow to see updates and get them in
55       an aggregator or script of your choice.
56   - name: Job
57     description: >
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
61     description: >
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
66       endpoints.
67   - name: Video Abuse
68     description: |
69       Video abuses deal with reports of local or remote videos alike.
70   - name: Video
71     description: |
72       Operations dealing with listing, uploading, fetching or modifying videos.
73   - name: Search
74     description: |
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
78       the advanced search.
79   - name: Video Comment
80     description: >
81       Operations dealing with comments to a video. Comments are organized in
82       threads.
83   - name: Video Channel
84     description: >
85       Operations dealing with creation, modification and video listing of a
86       user's channels.
87   - name: Video Blacklist
88     description: >
89       Operations dealing with blacklisting videos (removing them from view and
90       preventing interactions).
91   - name: Video Rate
92     description: >
93       Voting for a video.
94 x-tagGroups:
95   - name: Accounts
96     tags:
97       - Accounts
98       - User
99   - name: Videos
100     tags:
101       - Video
102       - Video Channel
103       - Video Comment
104       - Video Following
105       - Video Rate
106   - name: Moderation
107     tags:
108       - Video Abuse
109       - Video Blacklist
110   - name: Instance Configuration
111     tags:
112       - Config
113       - Server Following
114   - name: Notifications
115     tags:
116       - Feeds
117   - name: Jobs
118     tags:
119       - Job
120   - name: Search
121     tags:
122       - Search
123 paths:
124   '/accounts/{name}':
125     get:
126       tags:
127         - Accounts
128       summary: Get the account by name
129       parameters:
130         - $ref: '#/components/parameters/name'
131         - $ref: '#/components/parameters/start'
132         - $ref: '#/components/parameters/count'
133         - $ref: '#/components/parameters/sort'
134       responses:
135         '200':
136           description: successful operation
137           content:
138             application/json:
139               schema:
140                 $ref: '#/components/schemas/Account'
141   '/accounts/{name}/videos':
142     get:
143       tags:
144         - Accounts
145         - Video
146       summary: 'Get videos for an account, provided the name of that account'
147       parameters:
148         - $ref: '#/components/parameters/name'
149       responses:
150         '200':
151           description: successful operation
152           content:
153             application/json:
154               schema:
155                 $ref: '#/components/schemas/Video'
156       x-code-samples:
157         - lang: JavaScript
158           source: |
159             fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
160             .then(function(response) {
161               return response.json()
162             }).then(function(data) {
163               console.log(data)
164             })
165         - lang: Shell
166           source: |
167             # pip install httpie
168             http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
169         - lang: Ruby
170           source: |
171             require 'uri'
172             require 'net/http'
173
174             url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos")
175
176             http = Net::HTTP.new(url.host, url.port)
177             http.use_ssl = true
178             http.verify_mode = OpenSSL::SSL::VERIFY_NONE
179
180             request = Net::HTTP::Post.new(url)
181             request["content-type"] = 'application/json'
182             response = http.request(request)
183             puts response.read_body
184         - lang: Python
185           source: |
186             import http.client
187
188             conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1")
189
190             headers = {
191               'content-type': "application/json"
192             }
193
194             conn.request("POST", "/accounts/{name}/videos", None, headers)
195
196             res = conn.getresponse()
197             data = res.read()
198
199             print(data.decode("utf-8"))
200   /accounts:
201     get:
202       tags:
203         - Accounts
204       summary: Get all accounts
205       responses:
206         '200':
207           description: successful operation
208           content:
209             'application/json':
210               schema:
211                 type: array
212                 items:
213                   $ref: '#/components/schemas/Account'
214   /config:
215     get:
216       tags:
217         - Config
218       summary: Get the public configuration of the server
219       responses:
220         '200':
221           description: successful operation
222           content:
223             application/json:
224               schema:
225                 $ref: '#/components/schemas/ServerConfig'
226   /config/about:
227     get:
228       summary: Get the instance about page content
229       tags:
230         - Config
231       responses:
232         '200':
233           description: successful operation
234   /config/custom:
235     get:
236       summary: Get the runtime configuration of the server
237       tags:
238         - Config
239       security:
240         - OAuth2:
241             - admin
242       responses:
243         '200':
244           description: successful operation
245     put:
246       summary: Set the runtime configuration of the server
247       tags:
248         - Config
249       security:
250         - OAuth2:
251             - admin
252       responses:
253         '200':
254           description: successful operation
255     delete:
256       summary: Delete the runtime configuration of the server
257       tags:
258         - Config
259       security:
260         - OAuth2:
261             - admin
262       responses:
263         '200':
264           description: successful operation
265   '/feeds/videos.{format}':
266     get:
267       summary: >-
268         Get the feed of videos for the server, with optional filter by account
269         name or id
270       tags:
271         - Feeds
272       parameters:
273         - name: format
274           in: path
275           required: true
276           description: >-
277             The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and
278             json to JSON FEED 1.0
279           schema:
280             type: string
281             enum:
282               - xml
283               - atom
284               - json
285             default: xml
286         - name: accountId
287           in: query
288           required: false
289           description: >-
290             The id of the local account to filter to (beware, users IDs and not
291             actors IDs which will return empty feeds
292           schema:
293             type: number
294         - name: accountName
295           in: query
296           required: false
297           description: The name of the local account to filter to
298           schema:
299             type: string
300       responses:
301         '200':
302           description: successful operation
303   /jobs/{state}:
304     get:
305       summary: Get list of jobs
306       security:
307         - OAuth2:
308             - admin
309       tags:
310         - Job
311       parameters:
312         - name: state
313           in: path
314           required: true
315           description: The state of the job
316           schema:
317             type: string
318             enum:
319               - active
320               - completed
321               - failed
322               - waiting
323               - delayed
324         - $ref: '#/components/parameters/start'
325         - $ref: '#/components/parameters/count'
326         - $ref: '#/components/parameters/sort'
327       responses:
328         '200':
329           description: successful operation
330           content:
331             application/json:
332               schema:
333                 type: array
334                 items:
335                   $ref: '#/components/schemas/Job'
336   '/server/following/{host}':
337     delete:
338       security:
339         - OAuth2:
340             - admin
341       tags:
342         - Server Following
343       summary: Unfollow a server by hostname
344       parameters:
345         - name: host
346           in: path
347           required: true
348           description: 'The host to unfollow '
349           schema:
350             type: string
351       responses:
352         '201':
353           description: successful operation
354   /server/followers:
355     get:
356       tags:
357         - Server Following
358       summary: Get followers of the server
359       parameters:
360         - $ref: '#/components/parameters/start'
361         - $ref: '#/components/parameters/count'
362         - $ref: '#/components/parameters/sort'
363       responses:
364         '200':
365           description: successful operation
366           content:
367             application/json:
368               schema:
369                 type: array
370                 items:
371                   $ref: '#/components/schemas/Follow'
372   /server/following:
373     get:
374       tags:
375         - Server Following
376       summary: Get servers followed by the server
377       parameters:
378         - $ref: '#/components/parameters/start'
379         - $ref: '#/components/parameters/count'
380         - $ref: '#/components/parameters/sort'
381       responses:
382         '200':
383           description: successful operation
384           content:
385             application/json:
386               schema:
387                 type: array
388                 items:
389                   $ref: '#/components/schemas/Follow'
390     post:
391       security:
392         - OAuth2:
393             - admin
394       tags:
395         - Server Following
396       summary: Follow a server
397       responses:
398         '204':
399           $ref: '#/paths/~1users~1me/put/responses/204'
400       requestBody:
401         content:
402           application/json:
403             schema:
404               $ref: '#/components/schemas/Follow'
405   /users:
406     post:
407       summary: Creates user
408       security:
409         - OAuth2:
410             - admin
411       tags:
412         - User
413       responses:
414         '200':
415           description: successful operation
416           content:
417             application/json:
418               schema:
419                 $ref: '#/components/schemas/AddUserResponse'
420       requestBody:
421         content:
422           application/json:
423             schema:
424               $ref: '#/components/schemas/AddUser'
425         description: User to create
426         required: true
427     get:
428       summary: Get a list of users
429       security:
430         - OAuth2: []
431       tags:
432         - User
433       parameters:
434         - $ref: '#/components/parameters/start'
435         - $ref: '#/components/parameters/count'
436         - $ref: '#/components/parameters/usersSort'
437       responses:
438         '200':
439           description: successful operation
440           content:
441             application/json:
442               schema:
443                 type: array
444                 items:
445                   $ref: '#/components/schemas/User'
446   '/users/{id}':
447     delete:
448       summary: Delete a user by its id
449       security:
450         - OAuth2:
451             - admin
452       tags:
453         - User
454       parameters:
455         - $ref: '#/components/parameters/id'
456       responses:
457         '204':
458           $ref: '#/paths/~1users~1me/put/responses/204'
459     get:
460       summary: Get user by its id
461       security:
462         - OAuth2: []
463       tags:
464         - User
465       parameters:
466         - $ref: '#/components/parameters/id'
467       responses:
468         '200':
469           description: successful operation
470           content:
471             application/json:
472               schema:
473                 $ref: '#/components/schemas/User'
474     put:
475       summary: Update user profile by its id
476       security:
477         - OAuth2: []
478       tags:
479         - User
480       parameters:
481         - $ref: '#/components/parameters/id'
482       responses:
483         '204':
484           $ref: '#/paths/~1users~1me/put/responses/204'
485       requestBody:
486         content:
487           application/json:
488             schema:
489               $ref: '#/components/schemas/UpdateUser'
490         required: true
491   /users/me:
492     get:
493       summary: Get current user information
494       security:
495         - OAuth2: []
496       tags:
497         - User
498       responses:
499         '200':
500           description: successful operation
501           content:
502             application/json:
503               schema:
504                 type: array
505                 items:
506                   $ref: '#/components/schemas/User'
507     put:
508       summary: Update current user information
509       security:
510         - OAuth2: []
511       tags:
512         - User
513       responses:
514         '204':
515           description: Successful operation
516       requestBody:
517         content:
518           application/json:
519             schema:
520               $ref: '#/components/schemas/UpdateMe'
521         required: true
522   /users/me/video-quota-used:
523     get:
524       summary: Get current user used quota
525       security:
526         - OAuth2: []
527       tags:
528         - User
529       responses:
530         '200':
531           description: successful operation
532           content:
533             application/json:
534               schema:
535                 type: number
536   '/users/me/videos/{videoId}/rating':
537     get:
538       summary: 'Get rating of video by its id, among those of the current user'
539       security:
540         - OAuth2: []
541       tags:
542         - User
543       parameters:
544         - name: videoId
545           in: path
546           required: true
547           description: 'The video id '
548           schema:
549             type: string
550       responses:
551         '200':
552           description: successful operation
553           content:
554             application/json:
555               schema:
556                 $ref: '#/components/schemas/GetMeVideoRating'
557   /users/me/videos:
558     get:
559       summary: Get videos of the current user
560       security:
561         - OAuth2: []
562       tags:
563         - User
564       parameters:
565         - $ref: '#/components/parameters/start'
566         - $ref: '#/components/parameters/count'
567         - $ref: '#/components/parameters/sort'
568       responses:
569         '200':
570           description: successful operation
571           content:
572             application/json:
573               schema:
574                 type: array
575                 items:
576                   $ref: '#/components/schemas/Video'
577   /users/register:
578     post:
579       summary: Register a user
580       tags:
581         - User
582       responses:
583         '204':
584           $ref: '#/paths/~1users~1me/put/responses/204'
585       requestBody:
586         content:
587           application/json:
588             schema:
589               $ref: '#/components/schemas/RegisterUser'
590         required: true
591   /users/me/avatar/pick:
592     post:
593       summary: Update current user avatar
594       security:
595         - OAuth2: []
596       tags:
597         - User
598       responses:
599         '200':
600           description: successful operation
601           content:
602             application/json:
603               schema:
604                 $ref: '#/components/schemas/Avatar'
605       requestBody:
606         content:
607           multipart/form-data:
608             schema:
609               type: object
610               properties:
611                 avatarfile:
612                   description: The file to upload.
613                   type: string
614                   format: binary
615             encoding:
616               profileImage:
617                 # only accept png/jpeg
618                 contentType: image/png, image/jpeg
619   /videos:
620     get:
621       summary: Get list of videos
622       tags:
623         - Video
624       parameters:
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'
635       responses:
636         '200':
637           description: successful operation
638           content:
639             application/json:
640               schema:
641                 type: array
642                 items:
643                   $ref: '#/components/schemas/Video'
644   /videos/categories:
645     get:
646       summary: Get list of video licences known by the server
647       tags:
648         - Video
649       responses:
650         '200':
651           description: successful operation
652           content:
653             application/json:
654               schema:
655                 type: array
656                 items:
657                   type: string
658   /videos/licences:
659     get:
660       summary: Get list of video licences known by the server
661       tags:
662         - Video
663       responses:
664         '200':
665           description: successful operation
666           content:
667             application/json:
668               schema:
669                 type: array
670                 items:
671                   type: string
672   /videos/languages:
673     get:
674       summary: Get list of languages known by the server
675       tags:
676         - Video
677       responses:
678         '200':
679           description: successful operation
680           content:
681             application/json:
682               schema:
683                 type: array
684                 items:
685                   type: string
686   /videos/privacies:
687     get:
688       summary: Get list of privacy policies supported by the server
689       tags:
690         - Video
691       responses:
692         '200':
693           description: successful operation
694           content:
695             application/json:
696               schema:
697                 type: array
698                 items:
699                   type: string
700   '/videos/{id}':
701     put:
702       summary: Update metadata for a video by its id
703       security:
704         - OAuth2: []
705       tags:
706         - Video
707       parameters:
708         - $ref: '#/components/parameters/id2'
709       responses:
710         '200':
711           description: successful operation
712           content:
713             application/json:
714               schema:
715                 $ref: '#/components/schemas/Video'
716       requestBody:
717         content:
718           multipart/form-data:
719             schema:
720               type: object
721               properties:
722                 thumbnailfile:
723                   description: Video thumbnail file
724                   type: string
725                 previewfile:
726                   description: Video preview file
727                   type: string
728                 category:
729                   description: Video category
730                   type: string
731                 licence:
732                   description: Video licence
733                   type: string
734                 language:
735                   description: Video language
736                   type: string
737                 description:
738                   description: Video description
739                   type: string
740                 waitTranscoding:
741                   description: Whether or not we wait transcoding before publish the video
742                   type: string
743                 support:
744                   description: Text describing how to support the video uploader
745                   type: string
746                 nsfw:
747                   description: Whether or not this video contains sensitive content
748                   type: string
749                 name:
750                   description: Video name
751                   type: string
752                 tags:
753                   description: Video tags
754                   type: string
755                 commentsEnabled:
756                   description: Enable or disable comments for this video
757                   type: string
758                 scheduleUpdate: &ref_0
759                   type: object
760                   properties:
761                     privacy:
762                       type: string
763                       enum:
764                         - Public
765                         - Unlisted
766                       description: Video privacy target
767                     updateAt:
768                       type: string
769                       format: date
770                       description: When to update the video
771                   required:
772                     - updateAt
773     get:
774       summary: Get a video by its id
775       tags:
776         - Video
777       parameters:
778         - $ref: '#/components/parameters/id2'
779       responses:
780         '200':
781           description: successful operation
782           content:
783             application/json:
784               schema:
785                 $ref: '#/components/schemas/Video'
786     delete:
787       summary: Delete a video by its id
788       security:
789         - OAuth2: []
790       tags:
791         - Video
792       parameters:
793         - $ref: '#/components/parameters/id2'
794       responses:
795         '204':
796           $ref: '#/paths/~1users~1me/put/responses/204'
797   '/videos/{id}/description':
798     get:
799       summary: Get a video description by its id
800       tags:
801         - Video
802       parameters:
803         - $ref: '#/components/parameters/id2'
804       responses:
805         '200':
806           description: successful operation
807           content:
808             application/json:
809               schema:
810                 type: string
811   '/videos/{id}/views':
812     post:
813       summary: Add a view to the video by its id
814       tags:
815         - Video
816       parameters:
817         - $ref: '#/components/parameters/id2'
818       responses:
819         '204':
820           $ref: '#/paths/~1users~1me/put/responses/204'
821   '/videos/{id}/watching':
822     put:
823       summary: Indicate progress of in watching the video by its id for a user
824       tags:
825         - Video
826       security:
827         - OAuth2: []
828       parameters:
829         - $ref: '#/components/parameters/id2'
830       requestBody:
831         content:
832           application/json:
833             schema:
834               $ref: '#/components/schemas/UserWatchingVideo'
835         required: true
836       responses:
837         '204':
838           $ref: '#/paths/~1users~1me/put/responses/204'
839   /videos/ownership:
840     get:
841       summary: Get list of video ownership changes requests
842       tags:
843         - Video
844       security:
845         - OAuth2: []
846       parameters:
847         - $ref: '#/components/parameters/id2'
848       responses:
849         '200':
850           description: successful operation
851   '/videos/ownership/{id}/accept':
852     post:
853       summary: Refuse ownership change request for video by its id
854       tags:
855         - Video
856       security:
857         - OAuth2: []
858       parameters:
859         - $ref: '#/components/parameters/id2'
860       responses:
861         '204':
862           $ref: '#/paths/~1users~1me/put/responses/204'
863   '/videos/ownership/{id}/refuse':
864     post:
865       summary: Accept ownership change request for video by its id
866       tags:
867         - Video
868       security:
869         - OAuth2: []
870       parameters:
871         - $ref: '#/components/parameters/id2'
872       responses:
873         '204':
874           $ref: '#/paths/~1users~1me/put/responses/204'
875   '/videos/{id}/give-ownership':
876     post:
877       summary: Request change of ownership for a video you own, by its id
878       tags:
879         - Video
880       security:
881         - OAuth2: []
882       parameters:
883         - $ref: '#/components/parameters/id2'
884       requestBody:
885         required: true
886         content:
887           application/x-www-form-urlencoded:
888             schema:
889               type: object
890               properties:
891                 username:
892                   type: string
893               required:
894                 - username
895       responses:
896         '204':
897           $ref: '#/paths/~1users~1me/put/responses/204'
898         '400':
899           description: 'Changing video ownership to a remote account is not supported yet'
900   /videos/upload:
901     post:
902       summary: Upload a video file with its metadata
903       security:
904         - OAuth2: []
905       tags:
906         - Video
907       responses:
908         '200':
909           description: successful operation
910           content:
911             application/json:
912               schema:
913                 $ref: '#/components/schemas/VideoUploadResponse'
914       requestBody:
915         content:
916           multipart/form-data:
917             schema:
918               type: object
919               properties:
920                 videofile:
921                   description: Video file
922                   type: string
923                   format: binary
924                 channelId:
925                   description: Channel id that will contain this video
926                   type: number
927                 thumbnailfile:
928                   description: Video thumbnail file
929                   type: string
930                 previewfile:
931                   description: Video preview file
932                   type: string
933                 privacy:
934                   $ref: '#/components/schemas/VideoPrivacy'
935                 category:
936                   description: Video category
937                   type: string
938                 licence:
939                   description: Video licence
940                   type: string
941                 language:
942                   description: Video language
943                   type: string
944                 description:
945                   description: Video description
946                   type: string
947                 waitTranscoding:
948                   description: Whether or not we wait transcoding before publish the video
949                   type: string
950                 support:
951                   description: Text describing how to support the video uploader
952                   type: string
953                 nsfw:
954                   description: Whether or not this video contains sensitive content
955                   type: string
956                 name:
957                   description: Video name
958                   type: string
959                 tags:
960                   description: Video tags
961                   type: string
962                 commentsEnabled:
963                   description: Enable or disable comments for this video
964                   type: string
965                 scheduleUpdate: *ref_0
966               required:
967                 - videofile
968                 - channelId
969                 - name
970       x-code-samples:
971         - lang: Shell
972           source: |
973             ## DEPENDENCIES: httpie, jq
974             # pip install httpie
975             USERNAME="<your_username>"
976             PASSWORD="<your_password>"
977             FILE_PATH="<your_file_path>"
978             CHANNEL_ID="<your_channel_id>"
979             NAME="<video_name>"
980
981             API_PATH="https://peertube2.cpy.re/api/v1"
982             ## AUTH
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 \
987               username=$USERNAME \
988               password=$PASSWORD \
989               | jq -r ".access_token")
990             ## VIDEO UPLOAD
991             http -b --form POST "$API_PATH/videos/upload" \
992               videofile@$FILE_PATH \
993               channelId=$CHANNEL_ID \
994               name=$NAME \
995               "Authorization:Bearer $token"
996   /videos/abuse:
997     get:
998       summary: Get list of reported video abuses
999       security:
1000         - OAuth2: []
1001       tags:
1002         - Video Abuse
1003       parameters:
1004         - $ref: '#/components/parameters/start'
1005         - $ref: '#/components/parameters/count'
1006         - $ref: '#/components/parameters/abusesSort'
1007       responses:
1008         '200':
1009           description: successful operation
1010           content:
1011             application/json:
1012               schema:
1013                 type: array
1014                 items:
1015                   $ref: '#/components/schemas/VideoAbuse'
1016   '/videos/{id}/abuse':
1017     post:
1018       summary: 'Report an abuse, on a video by its id'
1019       security:
1020         - OAuth2: []
1021       tags:
1022         - Video Abuse
1023       parameters:
1024         - $ref: '#/components/parameters/id2'
1025       responses:
1026         '204':
1027           $ref: '#/paths/~1users~1me/put/responses/204'
1028   '/videos/{id}/blacklist':
1029     post:
1030       summary: Put on blacklist a video by its id
1031       security:
1032         - OAuth2:
1033             - admin
1034             - moderator
1035       tags:
1036         - Video Blacklist
1037       parameters:
1038         - $ref: '#/components/parameters/id2'
1039       responses:
1040         '204':
1041           $ref: '#/paths/~1users~1me/put/responses/204'
1042     delete:
1043       summary: Delete an entry of the blacklist of a video by its id
1044       security:
1045         - OAuth2:
1046             - admin
1047             - moderator
1048       tags:
1049         - Video Blacklist
1050       parameters:
1051         - $ref: '#/components/parameters/id2'
1052       responses:
1053         '204':
1054           $ref: '#/paths/~1users~1me/put/responses/204'
1055   /videos/blacklist:
1056     get:
1057       summary: Get list of videos on blacklist
1058       security:
1059         - OAuth2:
1060             - admin
1061             - moderator
1062       tags:
1063         - Video Blacklist
1064       parameters:
1065         - $ref: '#/components/parameters/start'
1066         - $ref: '#/components/parameters/count'
1067         - $ref: '#/components/parameters/blacklistsSort'
1068       responses:
1069         '200':
1070           description: successful operation
1071           content:
1072             application/json:
1073               schema:
1074                 type: array
1075                 items:
1076                   $ref: '#/components/schemas/VideoBlacklist'
1077   /video-channels:
1078     get:
1079       summary: Get list of video channels
1080       tags:
1081         - Video Channel
1082       parameters:
1083         - $ref: '#/components/parameters/start'
1084         - $ref: '#/components/parameters/count'
1085         - $ref: '#/components/parameters/sort'
1086       responses:
1087         '200':
1088           description: successful operation
1089           content:
1090             application/json:
1091               schema:
1092                 type: array
1093                 items:
1094                   $ref: '#/components/schemas/VideoChannel'
1095     post:
1096       summary: Creates a video channel for the current user
1097       security:
1098         - OAuth2: []
1099       tags:
1100         - Video Channel
1101       responses:
1102         '204':
1103           $ref: '#/paths/~1users~1me/put/responses/204'
1104       requestBody:
1105         $ref: '#/components/requestBodies/VideoChannelInput'
1106   '/video-channels/{id}':
1107     get:
1108       summary: Get a video channel by its id
1109       tags:
1110         - Video Channel
1111       parameters:
1112         - $ref: '#/components/parameters/id3'
1113       responses:
1114         '200':
1115           description: successful operation
1116           content:
1117             application/json:
1118               schema:
1119                 $ref: '#/components/schemas/VideoChannel'
1120     put:
1121       summary: Update a video channel by its id
1122       security:
1123         - OAuth2: []
1124       tags:
1125         - Video Channel
1126       parameters:
1127         - $ref: '#/components/parameters/id3'
1128       responses:
1129         '204':
1130           $ref: '#/paths/~1users~1me/put/responses/204'
1131       requestBody:
1132         $ref: '#/components/requestBodies/VideoChannelInput'
1133     delete:
1134       summary: Delete a video channel by its id
1135       security:
1136         - OAuth2: []
1137       tags:
1138         - Video Channel
1139       parameters:
1140         - $ref: '#/components/parameters/id3'
1141       responses:
1142         '204':
1143           $ref: '#/paths/~1users~1me/put/responses/204'
1144   '/video-channels/{id}/videos':
1145     get:
1146       summary: Get videos of a video channel by its id
1147       tags:
1148         - Video Channel
1149       parameters:
1150         - $ref: '#/components/parameters/id3'
1151       responses:
1152         '200':
1153           description: successful operation
1154           content:
1155             application/json:
1156               schema:
1157                 $ref: '#/components/schemas/Video'
1158   '/accounts/{name}/video-channels':
1159     get:
1160       summary: Get video channels of an account by its name
1161       tags:
1162         - Video Channel
1163       parameters:
1164         - $ref: '#/components/parameters/name'
1165       responses:
1166         '200':
1167           description: successful operation
1168           content:
1169             application/json:
1170               schema:
1171                 type: array
1172                 items:
1173                   $ref: '#/components/schemas/VideoChannel'
1174   '/videos/{id}/comment-threads':
1175     get:
1176       summary: Get the comment threads of a video by its id
1177       tags:
1178         - Video Comment
1179       parameters:
1180         - $ref: '#/components/parameters/id2'
1181         - $ref: '#/components/parameters/start'
1182         - $ref: '#/components/parameters/count'
1183         - $ref: '#/components/parameters/sort'
1184       responses:
1185         '200':
1186           description: successful operation
1187           content:
1188             application/json:
1189               schema:
1190                 $ref: '#/components/schemas/CommentThreadResponse'
1191     post:
1192       summary: 'Creates a comment thread, on a video by its id'
1193       security:
1194         - OAuth2: []
1195       tags:
1196         - Video Comment
1197       parameters:
1198         - $ref: '#/components/parameters/id2'
1199       responses:
1200         '200':
1201           description: successful operation
1202           content:
1203             application/json:
1204               schema:
1205                 $ref: '#/components/schemas/CommentThreadPostResponse'
1206   '/videos/{id}/comment-threads/{threadId}':
1207     get:
1208       summary: 'Get the comment thread by its id, of a video by its id'
1209       tags:
1210         - Video Comment
1211       parameters:
1212         - $ref: '#/components/parameters/id2'
1213         - name: threadId
1214           in: path
1215           required: true
1216           description: The thread id (root comment id)
1217           schema:
1218             type: number
1219       responses:
1220         '200':
1221           description: successful operation
1222           content:
1223             application/json:
1224               schema:
1225                 $ref: '#/components/schemas/VideoCommentThreadTree'
1226   '/videos/{id}/comments/{commentId}':
1227     post:
1228       summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1229       security:
1230         - OAuth2: []
1231       tags:
1232         - Video Comment
1233       parameters:
1234         - $ref: '#/components/parameters/id2'
1235         - $ref: '#/components/parameters/commentId'
1236       responses:
1237         '200':
1238           description: successful operation
1239           content:
1240             application/json:
1241               schema:
1242                 $ref: '#/components/schemas/CommentThreadPostResponse'
1243     delete:
1244       summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1245       security:
1246         - OAuth2: []
1247       tags:
1248         - Video Comment
1249       parameters:
1250         - $ref: '#/components/parameters/id2'
1251         - $ref: '#/components/parameters/commentId'
1252       responses:
1253         '204':
1254           $ref: '#/paths/~1users~1me/put/responses/204'
1255   '/videos/{id}/rate':
1256     put:
1257       summary: Vote for a video by its id
1258       security:
1259         - OAuth2: []
1260       tags:
1261         - Video Rate
1262       parameters:
1263         - $ref: '#/components/parameters/id2'
1264       responses:
1265         '204':
1266           $ref: '#/paths/~1users~1me/put/responses/204'
1267   /search/videos:
1268     get:
1269       tags:
1270         - Search
1271       summary: Get the videos corresponding to a given query
1272       parameters:
1273         - $ref: '#/components/parameters/start'
1274         - $ref: '#/components/parameters/count'
1275         - $ref: '#/components/parameters/videosSearchSort'
1276         - name: search
1277           in: query
1278           required: true
1279           description: String to search
1280           schema:
1281             type: string
1282       responses:
1283         '200':
1284           description: successful operation
1285           content:
1286             application/json:
1287               schema:
1288                 type: array
1289                 items:
1290                   $ref: '#/components/schemas/Video'
1291 servers:
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)
1298 components:
1299   parameters:
1300     start:
1301       name: start
1302       in: query
1303       required: false
1304       description: Offset
1305       schema:
1306         type: number
1307     count:
1308       name: count
1309       in: query
1310       required: false
1311       description: Number of items
1312       schema:
1313         type: number
1314     sort:
1315       name: sort
1316       in: query
1317       required: false
1318       description: Sort column (-createdAt for example)
1319       schema:
1320         type: string
1321     videosSort:
1322       name: sort
1323       in: query
1324       required: false
1325       description: Sort videos by criteria
1326       schema:
1327         type: string
1328         enum:
1329         - -name
1330         - -duration
1331         - -createdAt
1332         - -publishedAt
1333         - -views
1334         - -likes
1335         - -trending
1336     videosSearchSort:
1337       name: sort
1338       in: query
1339       required: false
1340       description: Sort videos by criteria
1341       schema:
1342         type: string
1343         enum:
1344         - -name
1345         - -duration
1346         - -createdAt
1347         - -publishedAt
1348         - -views
1349         - -likes
1350         - -match
1351     blacklistsSort:
1352       name: sort
1353       in: query
1354       required: false
1355       description: Sort blacklists by criteria
1356       schema:
1357         type: string
1358         enum:
1359         - -id
1360         - -name
1361         - -duration
1362         - -views
1363         - -likes
1364         - -dislikes
1365         - -uuid
1366         - -createdAt
1367     usersSort:
1368       name: sort
1369       in: query
1370       required: false
1371       description: Sort users by criteria
1372       schema:
1373         type: string
1374         enum:
1375         - -id
1376         - -username
1377         - -createdAt
1378     abusesSort:
1379       name: sort
1380       in: query
1381       required: false
1382       description: Sort abuses by criteria
1383       schema:
1384         type: string
1385         enum:
1386         - -id
1387         - -createdAt
1388         - -state
1389     name:
1390       name: name
1391       in: path
1392       required: true
1393       description: >-
1394         The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1395         example)
1396       schema:
1397         type: string
1398     id:
1399       name: id
1400       in: path
1401       required: true
1402       description: The user id
1403       schema:
1404         type: number
1405     id2:
1406       name: id
1407       in: path
1408       required: true
1409       description: The video id or uuid
1410       schema:
1411         type: string
1412     id3:
1413       name: id
1414       in: path
1415       required: true
1416       description: The video channel id or uuid
1417       schema:
1418         type: string
1419     commentId:
1420       name: threadId
1421       in: path
1422       required: true
1423       description: The comment id
1424       schema:
1425         type: number
1426     categoryOneOf:
1427       name: categoryOneOf
1428       in: query
1429       required: false
1430       description: category id of the video
1431       schema:
1432         oneOf:
1433         - type: number
1434         - type: array
1435           items:
1436             type: number
1437       style: form
1438       explode: false
1439     tagsOneOf:
1440       name: tagsOneOf
1441       in: query
1442       required: false
1443       description: tag(s) of the video
1444       schema:
1445         oneOf:
1446         - type: string
1447         - type: array
1448           items:
1449             type: string
1450       style: form
1451       explode: false
1452     tagsAllOf:
1453       name: tagsAllOf
1454       in: query
1455       required: false
1456       description: tag(s) of the video, where all should be present in the video
1457       schema:
1458         oneOf:
1459         - type: string
1460         - type: array
1461           items:
1462             type: string
1463       style: form
1464       explode: false
1465     languageOneOf:
1466       name: languageOneOf
1467       in: query
1468       required: false
1469       description: language id of the video
1470       schema:
1471         oneOf:
1472         - type: string
1473         - type: array
1474           items:
1475             type: string
1476       style: form
1477       explode: false
1478     licenceOneOf:
1479       name: licenceOneOf
1480       in: query
1481       required: false
1482       description: licence id of the video
1483       schema:
1484         oneOf:
1485         - type: number
1486         - type: array
1487           items:
1488             type: number
1489       style: form
1490       explode: false
1491     nsfw:
1492       name: nsfw
1493       in: query
1494       required: false
1495       description: whether to include nsfw videos, if any
1496       schema:
1497         type: string
1498         enum:
1499         - 'true'
1500         - 'false'
1501     filter:
1502       name: filter
1503       in: query
1504       required: false
1505       description: >
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)
1509       schema:
1510         type: string
1511         enum:
1512         - local
1513         - all-local
1514   requestBodies:
1515     VideoChannelInput:
1516       content:
1517         application/json:
1518           schema:
1519             $ref: '#/components/schemas/VideoChannelInput'
1520   securitySchemes:
1521     OAuth2:
1522       description: >
1523         In the header: *Authorization: Bearer <token\>*
1524
1525
1526         Authenticating via OAuth requires the following steps:
1527
1528
1529         - Have an account with sufficient authorization levels
1530
1531         - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1532         Bearer Token
1533
1534         - Make Authenticated Requests
1535       type: oauth2
1536       flows:
1537         password:
1538           tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1539           scopes:
1540             admin: Admin scope
1541             moderator: Moderator scope
1542             user: User scope
1543   schemas:
1544     VideoConstantNumber:
1545       properties:
1546         id:
1547           type: number
1548         label:
1549           type: string
1550     VideoConstantString:
1551       properties:
1552         id:
1553           type: string
1554         label:
1555           type: string
1556     VideoPrivacy:
1557       type: string
1558       enum:
1559         - Public
1560         - Unlisted
1561         - Private
1562     Video:
1563       properties:
1564         id:
1565           type: number
1566         uuid:
1567           type: string
1568         createdAt:
1569           type: string
1570         publishedAt:
1571           type: string
1572         updatedAt:
1573           type: string
1574         category:
1575           $ref: '#/components/schemas/VideoConstantNumber'
1576         licence:
1577           $ref: '#/components/schemas/VideoConstantNumber'
1578         language:
1579           $ref: '#/components/schemas/VideoConstantString'
1580         privacy:
1581           $ref: '#/components/schemas/VideoPrivacy'
1582         description:
1583           type: string
1584         duration:
1585           type: number
1586         isLocal:
1587           type: boolean
1588         name:
1589           type: string
1590         thumbnailPath:
1591           type: string
1592         previewPath:
1593           type: string
1594         embedPath:
1595           type: string
1596         views:
1597           type: number
1598         likes:
1599           type: number
1600         dislikes:
1601           type: number
1602         nsfw:
1603           type: boolean
1604         account:
1605           type: object
1606           properties:
1607             name:
1608               type: string
1609             displayName:
1610               type: string
1611             url:
1612               type: string
1613             host:
1614               type: string
1615             avatar:
1616               $ref: '#/components/schemas/Avatar'
1617     VideoAbuse:
1618       properties:
1619         id:
1620           type: number
1621         reason:
1622           type: string
1623         reporterAccount:
1624           $ref: '#/components/schemas/Account'
1625         video:
1626           type: object
1627           properties:
1628             id:
1629               type: number
1630             name:
1631               type: string
1632             uuid:
1633               type: string
1634             url:
1635               type: string
1636         createdAt:
1637           type: string
1638     VideoBlacklist:
1639       properties:
1640         id:
1641           type: number
1642         videoId:
1643           type: number
1644         createdAt:
1645           type: string
1646         updatedAt:
1647           type: string
1648         name:
1649           type: string
1650         uuid:
1651           type: string
1652         description:
1653           type: string
1654         duration:
1655           type: number
1656         views:
1657           type: number
1658         likes:
1659           type: number
1660         dislikes:
1661           type: number
1662         nsfw:
1663           type: boolean
1664     VideoChannel:
1665       properties:
1666         displayName:
1667           type: string
1668         description:
1669           type: string
1670         isLocal:
1671           type: boolean
1672         ownerAccount:
1673           type: object
1674           properties:
1675             id:
1676               type: number
1677             uuid:
1678               type: string
1679     VideoComment:
1680       properties:
1681         id:
1682           type: number
1683         url:
1684           type: string
1685         text:
1686           type: string
1687         threadId:
1688           type: number
1689         inReplyToCommentId:
1690           type: number
1691         videoId:
1692           type: number
1693         createdAt:
1694           type: string
1695         updatedAt:
1696           type: string
1697         totalReplies:
1698           type: number
1699         account:
1700           $ref: '#/components/schemas/Account'
1701     VideoCommentThreadTree:
1702       properties:
1703         comment:
1704           $ref: '#/components/schemas/VideoComment'
1705         children:
1706           type: array
1707           items:
1708             $ref: '#/components/schemas/VideoCommentThreadTree'
1709     Avatar:
1710       properties:
1711         path:
1712           type: string
1713         createdAt:
1714           type: string
1715         updatedAt:
1716           type: string
1717     Actor:
1718       properties:
1719         id:
1720           type: number
1721         uuid:
1722           type: string
1723         url:
1724           type: string
1725         name:
1726           type: string
1727         host:
1728           type: string
1729         followingCount:
1730           type: number
1731         followersCount:
1732           type: number
1733         createdAt:
1734           type: string
1735         updatedAt:
1736           type: string
1737         avatar:
1738           $ref: '#/components/schemas/Avatar'
1739     Account:
1740       allOf:
1741         - $ref: '#/components/schemas/Actor'
1742         - properties:
1743             displayName:
1744               type: string
1745     User:
1746       properties:
1747         id:
1748           type: number
1749         username:
1750           type: string
1751         email:
1752           type: string
1753         displayNSFW:
1754           type: boolean
1755         autoPlayVideo:
1756           type: boolean
1757         role:
1758           type: string
1759           enum:
1760             - User
1761             - Moderator
1762             - Administrator
1763         videoQuota:
1764           type: number
1765         createdAt:
1766           type: string
1767         account:
1768           $ref: '#/components/schemas/Account'
1769         videoChannels:
1770           type: array
1771           items:
1772             $ref: '#/components/schemas/VideoChannel'
1773     UserWatchingVideo:
1774       properties:
1775         currentTime:
1776           type: number
1777     ServerConfig:
1778       properties:
1779         signup:
1780           type: object
1781           properties:
1782             allowed:
1783               type: boolean
1784         transcoding:
1785           type: object
1786           properties:
1787             enabledResolutions:
1788               type: array
1789               items:
1790                 type: number
1791         avatar:
1792           type: object
1793           properties:
1794             file:
1795               type: object
1796               properties:
1797                 size:
1798                   type: object
1799                   properties:
1800                     max:
1801                       type: number
1802             extensions:
1803               type: array
1804               items:
1805                 type: string
1806         video:
1807           type: object
1808           properties:
1809             file:
1810               type: object
1811               properties:
1812                 extensions:
1813                   type: array
1814                   items:
1815                     type: string
1816     Follow:
1817       properties:
1818         id:
1819           type: number
1820         follower:
1821           $ref: '#/components/schemas/Actor'
1822         following:
1823           $ref: '#/components/schemas/Actor'
1824         score:
1825           type: number
1826         state:
1827           type: string
1828           enum:
1829             - pending
1830             - accepted
1831         createdAt:
1832           type: string
1833         updatedAt:
1834           type: string
1835     Job:
1836       properties:
1837         id:
1838           type: number
1839         state:
1840           type: string
1841           enum:
1842             - pending
1843             - processing
1844             - error
1845             - success
1846         category:
1847           type: string
1848           enum:
1849             - transcoding
1850             - activitypub-http
1851         handlerName:
1852           type: string
1853         handlerInputData:
1854           type: string
1855         createdAt:
1856           type: string
1857         updatedAt:
1858           type: string
1859     AddUserResponse:
1860       properties:
1861         id:
1862           type: number
1863         uuid:
1864           type: string
1865     VideoUploadResponse:
1866       properties:
1867         video:
1868           type: object
1869           properties:
1870             id:
1871               type: number
1872             uuid:
1873               type: string
1874     CommentThreadResponse:
1875       properties:
1876         total:
1877           type: number
1878         data:
1879           type: array
1880           items:
1881             $ref: '#/components/schemas/VideoComment'
1882     CommentThreadPostResponse:
1883       properties:
1884         comment:
1885           $ref: '#/components/schemas/VideoComment'
1886     AddUser:
1887       properties:
1888         username:
1889           type: string
1890           description: 'The user username '
1891         password:
1892           type: string
1893           description: 'The user password '
1894         email:
1895           type: string
1896           description: 'The user email '
1897         videoQuota:
1898           type: string
1899           description: 'The user videoQuota '
1900         role:
1901           type: integer
1902           format: int32
1903           enum:
1904             - 0
1905             - 1
1906             - 2
1907           description: 'The user role '
1908       required:
1909         - username
1910         - password
1911         - email
1912         - videoQuota
1913         - role
1914     UpdateUser:
1915       properties:
1916         id:
1917           type: string
1918           description: 'The user id '
1919         email:
1920           type: string
1921           description: 'The updated email of the user '
1922         videoQuota:
1923           type: string
1924           description: 'The updated videoQuota of the user '
1925         role:
1926           type: string
1927           description: 'The updated role of the user '
1928       required:
1929         - id
1930         - email
1931         - videoQuota
1932         - role
1933     UpdateMe:
1934       properties:
1935         password:
1936           type: string
1937           description: 'Your new password '
1938         email:
1939           type: string
1940           description: 'Your new email '
1941         displayNSFW:
1942           type: string
1943           description: 'Your new displayNSFW '
1944         autoPlayVideo:
1945           type: string
1946           description: 'Your new autoPlayVideo '
1947       required:
1948         - password
1949         - email
1950         - displayNSFW
1951         - autoPlayVideo
1952     GetMeVideoRating:
1953       properties:
1954         id:
1955           type: string
1956           description: 'Id of the video '
1957         rating:
1958           type: number
1959           description: 'Rating of the video '
1960       required:
1961         - id
1962         - rating
1963     RegisterUser:
1964       properties:
1965         username:
1966           type: string
1967           description: 'The username of the user '
1968         password:
1969           type: string
1970           description: 'The password of the user '
1971         email:
1972           type: string
1973           description: 'The email of the user '
1974       required:
1975         - username
1976         - password
1977         - email
1978     VideoChannelInput:
1979       properties:
1980         name:
1981           type: string
1982         description:
1983           type: string
1984