]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/doc/api/openapi.yaml
Merge branch 'develop' into pr/1217
[github/Chocobozzz/PeerTube.git] / support / doc / api / openapi.yaml
1 openapi: 3.0.0
2 info:
3 title: PeerTube
4 version: 1.2.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 - user
497 tags:
498 - User
499 responses:
500 '200':
501 description: successful operation
502 content:
503 application/json:
504 schema:
505 type: array
506 items:
507 $ref: '#/components/schemas/User'
508 put:
509 summary: Update current user information
510 security:
511 - OAuth2:
512 - user
513 tags:
514 - User
515 responses:
516 '204':
517 description: Successful operation
518 requestBody:
519 content:
520 application/json:
521 schema:
522 $ref: '#/components/schemas/UpdateMe'
523 required: true
524 /users/me/video-quota-used:
525 get:
526 summary: Get current user used quota
527 security:
528 - OAuth2:
529 - user
530 tags:
531 - User
532 responses:
533 '200':
534 description: successful operation
535 content:
536 application/json:
537 schema:
538 type: number
539 '/users/me/videos/{videoId}/rating':
540 get:
541 summary: 'Get rating of video by its id, among those of the current user'
542 security:
543 - OAuth2: []
544 tags:
545 - User
546 parameters:
547 - name: videoId
548 in: path
549 required: true
550 description: 'The video id '
551 schema:
552 type: string
553 responses:
554 '200':
555 description: successful operation
556 content:
557 application/json:
558 schema:
559 $ref: '#/components/schemas/GetMeVideoRating'
560 /users/me/videos:
561 get:
562 summary: Get videos of the current user
563 security:
564 - OAuth2:
565 - user
566 tags:
567 - User
568 parameters:
569 - $ref: '#/components/parameters/start'
570 - $ref: '#/components/parameters/count'
571 - $ref: '#/components/parameters/sort'
572 responses:
573 '200':
574 description: successful operation
575 content:
576 application/json:
577 schema:
578 type: array
579 items:
580 $ref: '#/components/schemas/Video'
581 /users/me/subscriptions:
582 get:
583 summary: Get subscriptions of the current user
584 security:
585 - OAuth2:
586 - user
587 tags:
588 - User
589 parameters:
590 - $ref: '#/components/parameters/start'
591 - $ref: '#/components/parameters/count'
592 - $ref: '#/components/parameters/sort'
593 responses:
594 '200':
595 description: successful operation
596 post:
597 summary: Add subscription to the current user
598 security:
599 - OAuth2:
600 - user
601 tags:
602 - User
603 responses:
604 '200':
605 description: successful operation
606 /users/me/subscriptions/exist:
607 get:
608 summary: Get if subscriptions exist for the current user
609 security:
610 - OAuth2:
611 - user
612 tags:
613 - User
614 parameters:
615 - $ref: '#/components/parameters/subscriptionsUris'
616 responses:
617 '200':
618 description: successful operation
619 content:
620 application/json:
621 schema:
622 type: object
623 /users/me/subscriptions/videos:
624 get:
625 summary: Get videos of subscriptions of the current user
626 security:
627 - OAuth2:
628 - user
629 tags:
630 - User
631 parameters:
632 - $ref: '#/components/parameters/start'
633 - $ref: '#/components/parameters/count'
634 - $ref: '#/components/parameters/sort'
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 '/users/me/subscriptions/{uri}':
645 get:
646 summary: Get subscription of the current user for a given uri
647 security:
648 - OAuth2:
649 - user
650 tags:
651 - User
652 responses:
653 '200':
654 description: successful operation
655 content:
656 application/json:
657 schema:
658 $ref: '#/components/schemas/VideoChannel'
659 delete:
660 summary: Delete subscription of the current user for a given uri
661 security:
662 - OAuth2:
663 - user
664 tags:
665 - User
666 responses:
667 '200':
668 description: successful operation
669 /users/register:
670 post:
671 summary: Register a user
672 tags:
673 - User
674 responses:
675 '204':
676 $ref: '#/paths/~1users~1me/put/responses/204'
677 requestBody:
678 content:
679 application/json:
680 schema:
681 $ref: '#/components/schemas/RegisterUser'
682 required: true
683 /users/me/avatar/pick:
684 post:
685 summary: Update current user avatar
686 security:
687 - OAuth2: []
688 tags:
689 - User
690 responses:
691 '200':
692 description: successful operation
693 content:
694 application/json:
695 schema:
696 $ref: '#/components/schemas/Avatar'
697 requestBody:
698 content:
699 multipart/form-data:
700 schema:
701 type: object
702 properties:
703 avatarfile:
704 description: The file to upload.
705 type: string
706 format: binary
707 encoding:
708 profileImage:
709 # only accept png/jpeg
710 contentType: image/png, image/jpeg
711 /videos:
712 get:
713 summary: Get list of videos
714 tags:
715 - Video
716 parameters:
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'
727 responses:
728 '200':
729 description: successful operation
730 content:
731 application/json:
732 schema:
733 type: array
734 items:
735 $ref: '#/components/schemas/Video'
736 /videos/categories:
737 get:
738 summary: Get list of video licences known by the server
739 tags:
740 - Video
741 responses:
742 '200':
743 description: successful operation
744 content:
745 application/json:
746 schema:
747 type: array
748 items:
749 type: string
750 /videos/licences:
751 get:
752 summary: Get list of video licences known by the server
753 tags:
754 - Video
755 responses:
756 '200':
757 description: successful operation
758 content:
759 application/json:
760 schema:
761 type: array
762 items:
763 type: string
764 /videos/languages:
765 get:
766 summary: Get list of languages known by the server
767 tags:
768 - Video
769 responses:
770 '200':
771 description: successful operation
772 content:
773 application/json:
774 schema:
775 type: array
776 items:
777 type: string
778 /videos/privacies:
779 get:
780 summary: Get list of privacy policies supported by the server
781 tags:
782 - Video
783 responses:
784 '200':
785 description: successful operation
786 content:
787 application/json:
788 schema:
789 type: array
790 items:
791 type: string
792 '/videos/{id}':
793 put:
794 summary: Update metadata for a video by its id
795 security:
796 - OAuth2: []
797 tags:
798 - Video
799 parameters:
800 - $ref: '#/components/parameters/id2'
801 responses:
802 '200':
803 description: successful operation
804 content:
805 application/json:
806 schema:
807 $ref: '#/components/schemas/Video'
808 requestBody:
809 content:
810 multipart/form-data:
811 schema:
812 type: object
813 properties:
814 thumbnailfile:
815 description: Video thumbnail file
816 type: string
817 previewfile:
818 description: Video preview file
819 type: string
820 category:
821 description: Video category
822 type: string
823 licence:
824 description: Video licence
825 type: string
826 language:
827 description: Video language
828 type: string
829 description:
830 description: Video description
831 type: string
832 waitTranscoding:
833 description: Whether or not we wait transcoding before publish the video
834 type: string
835 support:
836 description: Text describing how to support the video uploader
837 type: string
838 nsfw:
839 description: Whether or not this video contains sensitive content
840 type: string
841 name:
842 description: Video name
843 type: string
844 tags:
845 description: Video tags
846 type: array
847 items:
848 type: string
849 commentsEnabled:
850 description: Enable or disable comments for this video
851 type: string
852 scheduleUpdate: &ref_0
853 type: object
854 properties:
855 privacy:
856 type: string
857 enum:
858 - Public
859 - Unlisted
860 description: Video privacy target
861 updateAt:
862 type: string
863 format: date
864 description: When to update the video
865 required:
866 - updateAt
867 get:
868 summary: Get a video by its id
869 tags:
870 - Video
871 parameters:
872 - $ref: '#/components/parameters/id2'
873 responses:
874 '200':
875 description: successful operation
876 content:
877 application/json:
878 schema:
879 $ref: '#/components/schemas/Video'
880 delete:
881 summary: Delete a video by its id
882 security:
883 - OAuth2: []
884 tags:
885 - Video
886 parameters:
887 - $ref: '#/components/parameters/id2'
888 responses:
889 '204':
890 $ref: '#/paths/~1users~1me/put/responses/204'
891 '/videos/{id}/description':
892 get:
893 summary: Get a video description by its id
894 tags:
895 - Video
896 parameters:
897 - $ref: '#/components/parameters/id2'
898 responses:
899 '200':
900 description: successful operation
901 content:
902 application/json:
903 schema:
904 type: string
905 '/videos/{id}/views':
906 post:
907 summary: Add a view to the video by its id
908 tags:
909 - Video
910 parameters:
911 - $ref: '#/components/parameters/id2'
912 responses:
913 '204':
914 $ref: '#/paths/~1users~1me/put/responses/204'
915 '/videos/{id}/watching':
916 put:
917 summary: Set watching progress of a video by its id for a user
918 tags:
919 - Video
920 security:
921 - OAuth2: []
922 parameters:
923 - $ref: '#/components/parameters/id2'
924 requestBody:
925 content:
926 application/json:
927 schema:
928 $ref: '#/components/schemas/UserWatchingVideo'
929 required: true
930 responses:
931 '204':
932 $ref: '#/paths/~1users~1me/put/responses/204'
933 /videos/ownership:
934 get:
935 summary: Get list of video ownership changes requests
936 tags:
937 - Video
938 security:
939 - OAuth2: []
940 parameters:
941 - $ref: '#/components/parameters/id2'
942 responses:
943 '200':
944 description: successful operation
945 '/videos/ownership/{id}/accept':
946 post:
947 summary: Refuse ownership change request for video by its id
948 tags:
949 - Video
950 security:
951 - OAuth2: []
952 parameters:
953 - $ref: '#/components/parameters/id2'
954 responses:
955 '204':
956 $ref: '#/paths/~1users~1me/put/responses/204'
957 '/videos/ownership/{id}/refuse':
958 post:
959 summary: Accept ownership change request for video by its id
960 tags:
961 - Video
962 security:
963 - OAuth2: []
964 parameters:
965 - $ref: '#/components/parameters/id2'
966 responses:
967 '204':
968 $ref: '#/paths/~1users~1me/put/responses/204'
969 '/videos/{id}/give-ownership':
970 post:
971 summary: Request change of ownership for a video you own, by its id
972 tags:
973 - Video
974 security:
975 - OAuth2: []
976 parameters:
977 - $ref: '#/components/parameters/id2'
978 requestBody:
979 required: true
980 content:
981 application/x-www-form-urlencoded:
982 schema:
983 type: object
984 properties:
985 username:
986 type: string
987 required:
988 - username
989 responses:
990 '204':
991 $ref: '#/paths/~1users~1me/put/responses/204'
992 '400':
993 description: 'Changing video ownership to a remote account is not supported yet'
994 /videos/upload:
995 post:
996 summary: Upload a video file with its metadata
997 security:
998 - OAuth2: []
999 tags:
1000 - Video
1001 responses:
1002 '200':
1003 description: successful operation
1004 content:
1005 application/json:
1006 schema:
1007 $ref: '#/components/schemas/VideoUploadResponse'
1008 requestBody:
1009 content:
1010 multipart/form-data:
1011 schema:
1012 type: object
1013 properties:
1014 videofile:
1015 description: Video file
1016 type: string
1017 format: binary
1018 channelId:
1019 description: Channel id that will contain this video
1020 type: number
1021 thumbnailfile:
1022 description: Video thumbnail file
1023 type: string
1024 previewfile:
1025 description: Video preview file
1026 type: string
1027 privacy:
1028 $ref: '#/components/schemas/VideoPrivacy'
1029 category:
1030 description: Video category
1031 type: string
1032 licence:
1033 description: Video licence
1034 type: string
1035 language:
1036 description: Video language
1037 type: string
1038 description:
1039 description: Video description
1040 type: string
1041 waitTranscoding:
1042 description: Whether or not we wait transcoding before publish the video
1043 type: string
1044 support:
1045 description: Text describing how to support the video uploader
1046 type: string
1047 nsfw:
1048 description: Whether or not this video contains sensitive content
1049 type: string
1050 name:
1051 description: Video name
1052 type: string
1053 tags:
1054 description: Video tags
1055 type: array
1056 items:
1057 type: string
1058 commentsEnabled:
1059 description: Enable or disable comments for this video
1060 type: string
1061 scheduleUpdate: *ref_0
1062 required:
1063 - videofile
1064 - channelId
1065 - name
1066 x-code-samples:
1067 - lang: Shell
1068 source: |
1069 ## DEPENDENCIES: httpie, jq
1070 # pip install httpie
1071 USERNAME="<your_username>"
1072 PASSWORD="<your_password>"
1073 FILE_PATH="<your_file_path>"
1074 CHANNEL_ID="<your_channel_id>"
1075 NAME="<video_name>"
1076
1077 API_PATH="https://peertube2.cpy.re/api/v1"
1078 ## AUTH
1079 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
1080 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
1081 token=$(http -b --form POST "$API_PATH/users/token" \
1082 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
1083 username=$USERNAME \
1084 password=$PASSWORD \
1085 | jq -r ".access_token")
1086 ## VIDEO UPLOAD
1087 http -b --form POST "$API_PATH/videos/upload" \
1088 videofile@$FILE_PATH \
1089 channelId=$CHANNEL_ID \
1090 name=$NAME \
1091 "Authorization:Bearer $token"
1092 /videos/abuse:
1093 get:
1094 summary: Get list of reported video abuses
1095 security:
1096 - OAuth2: []
1097 tags:
1098 - Video Abuse
1099 parameters:
1100 - $ref: '#/components/parameters/start'
1101 - $ref: '#/components/parameters/count'
1102 - $ref: '#/components/parameters/abusesSort'
1103 responses:
1104 '200':
1105 description: successful operation
1106 content:
1107 application/json:
1108 schema:
1109 type: array
1110 items:
1111 $ref: '#/components/schemas/VideoAbuse'
1112 '/videos/{id}/abuse':
1113 post:
1114 summary: 'Report an abuse, on a video by its id'
1115 security:
1116 - OAuth2: []
1117 tags:
1118 - Video Abuse
1119 parameters:
1120 - $ref: '#/components/parameters/id2'
1121 responses:
1122 '204':
1123 $ref: '#/paths/~1users~1me/put/responses/204'
1124 '/videos/{id}/blacklist':
1125 post:
1126 summary: Put on blacklist a video by its id
1127 security:
1128 - OAuth2:
1129 - admin
1130 - moderator
1131 tags:
1132 - Video Blacklist
1133 parameters:
1134 - $ref: '#/components/parameters/id2'
1135 responses:
1136 '204':
1137 $ref: '#/paths/~1users~1me/put/responses/204'
1138 delete:
1139 summary: Delete an entry of the blacklist of a video by its id
1140 security:
1141 - OAuth2:
1142 - admin
1143 - moderator
1144 tags:
1145 - Video Blacklist
1146 parameters:
1147 - $ref: '#/components/parameters/id2'
1148 responses:
1149 '204':
1150 $ref: '#/paths/~1users~1me/put/responses/204'
1151 /videos/blacklist:
1152 get:
1153 summary: Get list of videos on blacklist
1154 security:
1155 - OAuth2:
1156 - admin
1157 - moderator
1158 tags:
1159 - Video Blacklist
1160 parameters:
1161 - $ref: '#/components/parameters/start'
1162 - $ref: '#/components/parameters/count'
1163 - $ref: '#/components/parameters/blacklistsSort'
1164 responses:
1165 '200':
1166 description: successful operation
1167 content:
1168 application/json:
1169 schema:
1170 type: array
1171 items:
1172 $ref: '#/components/schemas/VideoBlacklist'
1173 /video-channels:
1174 get:
1175 summary: Get list of video channels
1176 tags:
1177 - Video Channel
1178 parameters:
1179 - $ref: '#/components/parameters/start'
1180 - $ref: '#/components/parameters/count'
1181 - $ref: '#/components/parameters/sort'
1182 responses:
1183 '200':
1184 description: successful operation
1185 content:
1186 application/json:
1187 schema:
1188 type: array
1189 items:
1190 $ref: '#/components/schemas/VideoChannel'
1191 post:
1192 summary: Creates a video channel for the current user
1193 security:
1194 - OAuth2: []
1195 tags:
1196 - Video Channel
1197 responses:
1198 '204':
1199 $ref: '#/paths/~1users~1me/put/responses/204'
1200 requestBody:
1201 $ref: '#/components/requestBodies/VideoChannelInput'
1202 '/video-channels/{id}':
1203 get:
1204 summary: Get a video channel by its id
1205 tags:
1206 - Video Channel
1207 parameters:
1208 - $ref: '#/components/parameters/id3'
1209 responses:
1210 '200':
1211 description: successful operation
1212 content:
1213 application/json:
1214 schema:
1215 $ref: '#/components/schemas/VideoChannel'
1216 put:
1217 summary: Update a video channel by its id
1218 security:
1219 - OAuth2: []
1220 tags:
1221 - Video Channel
1222 parameters:
1223 - $ref: '#/components/parameters/id3'
1224 responses:
1225 '204':
1226 $ref: '#/paths/~1users~1me/put/responses/204'
1227 requestBody:
1228 $ref: '#/components/requestBodies/VideoChannelInput'
1229 delete:
1230 summary: Delete a video channel by its id
1231 security:
1232 - OAuth2: []
1233 tags:
1234 - Video Channel
1235 parameters:
1236 - $ref: '#/components/parameters/id3'
1237 responses:
1238 '204':
1239 $ref: '#/paths/~1users~1me/put/responses/204'
1240 '/video-channels/{id}/videos':
1241 get:
1242 summary: Get videos of a video channel by its id
1243 tags:
1244 - Video Channel
1245 parameters:
1246 - $ref: '#/components/parameters/id3'
1247 responses:
1248 '200':
1249 description: successful operation
1250 content:
1251 application/json:
1252 schema:
1253 $ref: '#/components/schemas/Video'
1254 '/accounts/{name}/video-channels':
1255 get:
1256 summary: Get video channels of an account by its name
1257 tags:
1258 - Video Channel
1259 parameters:
1260 - $ref: '#/components/parameters/name'
1261 responses:
1262 '200':
1263 description: successful operation
1264 content:
1265 application/json:
1266 schema:
1267 type: array
1268 items:
1269 $ref: '#/components/schemas/VideoChannel'
1270 '/videos/{id}/comment-threads':
1271 get:
1272 summary: Get the comment threads of a video by its id
1273 tags:
1274 - Video Comment
1275 parameters:
1276 - $ref: '#/components/parameters/id2'
1277 - $ref: '#/components/parameters/start'
1278 - $ref: '#/components/parameters/count'
1279 - $ref: '#/components/parameters/sort'
1280 responses:
1281 '200':
1282 description: successful operation
1283 content:
1284 application/json:
1285 schema:
1286 $ref: '#/components/schemas/CommentThreadResponse'
1287 post:
1288 summary: 'Creates a comment thread, on a video by its id'
1289 security:
1290 - OAuth2: []
1291 tags:
1292 - Video Comment
1293 parameters:
1294 - $ref: '#/components/parameters/id2'
1295 responses:
1296 '200':
1297 description: successful operation
1298 content:
1299 application/json:
1300 schema:
1301 $ref: '#/components/schemas/CommentThreadPostResponse'
1302 '/videos/{id}/comment-threads/{threadId}':
1303 get:
1304 summary: 'Get the comment thread by its id, of a video by its id'
1305 tags:
1306 - Video Comment
1307 parameters:
1308 - $ref: '#/components/parameters/id2'
1309 - name: threadId
1310 in: path
1311 required: true
1312 description: The thread id (root comment id)
1313 schema:
1314 type: number
1315 responses:
1316 '200':
1317 description: successful operation
1318 content:
1319 application/json:
1320 schema:
1321 $ref: '#/components/schemas/VideoCommentThreadTree'
1322 '/videos/{id}/comments/{commentId}':
1323 post:
1324 summary: 'Creates a comment in a comment thread by its id, of a video by its id'
1325 security:
1326 - OAuth2: []
1327 tags:
1328 - Video Comment
1329 parameters:
1330 - $ref: '#/components/parameters/id2'
1331 - $ref: '#/components/parameters/commentId'
1332 responses:
1333 '200':
1334 description: successful operation
1335 content:
1336 application/json:
1337 schema:
1338 $ref: '#/components/schemas/CommentThreadPostResponse'
1339 delete:
1340 summary: 'Delete a comment in a comment therad by its id, of a video by its id'
1341 security:
1342 - OAuth2: []
1343 tags:
1344 - Video Comment
1345 parameters:
1346 - $ref: '#/components/parameters/id2'
1347 - $ref: '#/components/parameters/commentId'
1348 responses:
1349 '204':
1350 $ref: '#/paths/~1users~1me/put/responses/204'
1351 '/videos/{id}/rate':
1352 put:
1353 summary: Vote for a video by its id
1354 security:
1355 - OAuth2: []
1356 tags:
1357 - Video Rate
1358 parameters:
1359 - $ref: '#/components/parameters/id2'
1360 responses:
1361 '204':
1362 $ref: '#/paths/~1users~1me/put/responses/204'
1363 /search/videos:
1364 get:
1365 tags:
1366 - Search
1367 summary: Get the videos corresponding to a given query
1368 parameters:
1369 - $ref: '#/components/parameters/start'
1370 - $ref: '#/components/parameters/count'
1371 - $ref: '#/components/parameters/videosSearchSort'
1372 - name: search
1373 in: query
1374 required: true
1375 description: String to search
1376 schema:
1377 type: string
1378 responses:
1379 '200':
1380 description: successful operation
1381 content:
1382 application/json:
1383 schema:
1384 type: array
1385 items:
1386 $ref: '#/components/schemas/Video'
1387 servers:
1388 - url: 'https://peertube.cpy.re/api/v1'
1389 description: Live Test Server (live data - stable version)
1390 - url: 'https://peertube2.cpy.re/api/v1'
1391 description: Live Test Server (live data - bleeding edge version)
1392 - url: 'https://peertube3.cpy.re/api/v1'
1393 description: Live Test Server (live data - bleeding edge version)
1394 components:
1395 parameters:
1396 start:
1397 name: start
1398 in: query
1399 required: false
1400 description: Offset
1401 schema:
1402 type: number
1403 count:
1404 name: count
1405 in: query
1406 required: false
1407 description: Number of items
1408 schema:
1409 type: number
1410 sort:
1411 name: sort
1412 in: query
1413 required: false
1414 description: Sort column (-createdAt for example)
1415 schema:
1416 type: string
1417 videosSort:
1418 name: sort
1419 in: query
1420 required: false
1421 description: Sort videos by criteria
1422 schema:
1423 type: string
1424 enum:
1425 - -name
1426 - -duration
1427 - -createdAt
1428 - -publishedAt
1429 - -views
1430 - -likes
1431 - -trending
1432 videosSearchSort:
1433 name: sort
1434 in: query
1435 required: false
1436 description: Sort videos by criteria
1437 schema:
1438 type: string
1439 enum:
1440 - -name
1441 - -duration
1442 - -createdAt
1443 - -publishedAt
1444 - -views
1445 - -likes
1446 - -match
1447 blacklistsSort:
1448 name: sort
1449 in: query
1450 required: false
1451 description: Sort blacklists by criteria
1452 schema:
1453 type: string
1454 enum:
1455 - -id
1456 - -name
1457 - -duration
1458 - -views
1459 - -likes
1460 - -dislikes
1461 - -uuid
1462 - -createdAt
1463 usersSort:
1464 name: sort
1465 in: query
1466 required: false
1467 description: Sort users by criteria
1468 schema:
1469 type: string
1470 enum:
1471 - -id
1472 - -username
1473 - -createdAt
1474 abusesSort:
1475 name: sort
1476 in: query
1477 required: false
1478 description: Sort abuses by criteria
1479 schema:
1480 type: string
1481 enum:
1482 - -id
1483 - -createdAt
1484 - -state
1485 name:
1486 name: name
1487 in: path
1488 required: true
1489 description: >-
1490 The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
1491 example)
1492 schema:
1493 type: string
1494 id:
1495 name: id
1496 in: path
1497 required: true
1498 description: The user id
1499 schema:
1500 type: number
1501 id2:
1502 name: id
1503 in: path
1504 required: true
1505 description: The video id or uuid
1506 schema:
1507 type: string
1508 id3:
1509 name: id
1510 in: path
1511 required: true
1512 description: The video channel id or uuid
1513 schema:
1514 type: string
1515 commentId:
1516 name: threadId
1517 in: path
1518 required: true
1519 description: The comment id
1520 schema:
1521 type: number
1522 categoryOneOf:
1523 name: categoryOneOf
1524 in: query
1525 required: false
1526 description: category id of the video
1527 schema:
1528 oneOf:
1529 - type: number
1530 - type: array
1531 items:
1532 type: number
1533 style: form
1534 explode: false
1535 tagsOneOf:
1536 name: tagsOneOf
1537 in: query
1538 required: false
1539 description: tag(s) of the video
1540 schema:
1541 oneOf:
1542 - type: string
1543 - type: array
1544 items:
1545 type: string
1546 style: form
1547 explode: false
1548 tagsAllOf:
1549 name: tagsAllOf
1550 in: query
1551 required: false
1552 description: tag(s) of the video, where all should be present in the video
1553 schema:
1554 oneOf:
1555 - type: string
1556 - type: array
1557 items:
1558 type: string
1559 style: form
1560 explode: false
1561 languageOneOf:
1562 name: languageOneOf
1563 in: query
1564 required: false
1565 description: language id of the video
1566 schema:
1567 oneOf:
1568 - type: string
1569 - type: array
1570 items:
1571 type: string
1572 style: form
1573 explode: false
1574 licenceOneOf:
1575 name: licenceOneOf
1576 in: query
1577 required: false
1578 description: licence id of the video
1579 schema:
1580 oneOf:
1581 - type: number
1582 - type: array
1583 items:
1584 type: number
1585 style: form
1586 explode: false
1587 nsfw:
1588 name: nsfw
1589 in: query
1590 required: false
1591 description: whether to include nsfw videos, if any
1592 schema:
1593 type: string
1594 enum:
1595 - 'true'
1596 - 'false'
1597 filter:
1598 name: filter
1599 in: query
1600 required: false
1601 description: >
1602 Special filters (local for instance) which might require special rights:
1603 * `local` - only videos local to the instance
1604 * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges)
1605 schema:
1606 type: string
1607 enum:
1608 - local
1609 - all-local
1610 subscriptionsUris:
1611 name: uris
1612 in: query
1613 required: true
1614 description: list of uris to check if each is part of the user subscriptions
1615 schema:
1616 type: array
1617 items:
1618 type: string
1619 requestBodies:
1620 VideoChannelInput:
1621 content:
1622 application/json:
1623 schema:
1624 $ref: '#/components/schemas/VideoChannelInput'
1625 securitySchemes:
1626 OAuth2:
1627 description: >
1628 In the header: *Authorization: Bearer <token\>*
1629
1630
1631 Authenticating via OAuth requires the following steps:
1632
1633
1634 - Have an account with sufficient authorization levels
1635
1636 - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a
1637 Bearer Token
1638
1639 - Make Authenticated Requests
1640 type: oauth2
1641 flows:
1642 password:
1643 tokenUrl: 'https://peertube.example.com/api/v1/users/token'
1644 scopes:
1645 admin: Admin scope
1646 moderator: Moderator scope
1647 user: User scope
1648 schemas:
1649 VideoConstantNumber:
1650 properties:
1651 id:
1652 type: number
1653 label:
1654 type: string
1655 VideoConstantString:
1656 properties:
1657 id:
1658 type: string
1659 label:
1660 type: string
1661 VideoPrivacy:
1662 type: string
1663 enum:
1664 - Public
1665 - Unlisted
1666 - Private
1667 Video:
1668 properties:
1669 id:
1670 type: number
1671 uuid:
1672 type: string
1673 createdAt:
1674 type: string
1675 publishedAt:
1676 type: string
1677 updatedAt:
1678 type: string
1679 category:
1680 $ref: '#/components/schemas/VideoConstantNumber'
1681 licence:
1682 $ref: '#/components/schemas/VideoConstantNumber'
1683 language:
1684 $ref: '#/components/schemas/VideoConstantString'
1685 privacy:
1686 $ref: '#/components/schemas/VideoPrivacy'
1687 description:
1688 type: string
1689 duration:
1690 type: number
1691 isLocal:
1692 type: boolean
1693 name:
1694 type: string
1695 thumbnailPath:
1696 type: string
1697 previewPath:
1698 type: string
1699 embedPath:
1700 type: string
1701 views:
1702 type: number
1703 likes:
1704 type: number
1705 dislikes:
1706 type: number
1707 nsfw:
1708 type: boolean
1709 account:
1710 type: object
1711 properties:
1712 name:
1713 type: string
1714 displayName:
1715 type: string
1716 url:
1717 type: string
1718 host:
1719 type: string
1720 avatar:
1721 $ref: '#/components/schemas/Avatar'
1722 VideoAbuse:
1723 properties:
1724 id:
1725 type: number
1726 reason:
1727 type: string
1728 reporterAccount:
1729 $ref: '#/components/schemas/Account'
1730 video:
1731 type: object
1732 properties:
1733 id:
1734 type: number
1735 name:
1736 type: string
1737 uuid:
1738 type: string
1739 url:
1740 type: string
1741 createdAt:
1742 type: string
1743 VideoBlacklist:
1744 properties:
1745 id:
1746 type: number
1747 videoId:
1748 type: number
1749 createdAt:
1750 type: string
1751 updatedAt:
1752 type: string
1753 name:
1754 type: string
1755 uuid:
1756 type: string
1757 description:
1758 type: string
1759 duration:
1760 type: number
1761 views:
1762 type: number
1763 likes:
1764 type: number
1765 dislikes:
1766 type: number
1767 nsfw:
1768 type: boolean
1769 VideoChannel:
1770 properties:
1771 displayName:
1772 type: string
1773 description:
1774 type: string
1775 isLocal:
1776 type: boolean
1777 ownerAccount:
1778 type: object
1779 properties:
1780 id:
1781 type: number
1782 uuid:
1783 type: string
1784 VideoComment:
1785 properties:
1786 id:
1787 type: number
1788 url:
1789 type: string
1790 text:
1791 type: string
1792 threadId:
1793 type: number
1794 inReplyToCommentId:
1795 type: number
1796 videoId:
1797 type: number
1798 createdAt:
1799 type: string
1800 updatedAt:
1801 type: string
1802 totalReplies:
1803 type: number
1804 account:
1805 $ref: '#/components/schemas/Account'
1806 VideoCommentThreadTree:
1807 properties:
1808 comment:
1809 $ref: '#/components/schemas/VideoComment'
1810 children:
1811 type: array
1812 items:
1813 $ref: '#/components/schemas/VideoCommentThreadTree'
1814 Avatar:
1815 properties:
1816 path:
1817 type: string
1818 createdAt:
1819 type: string
1820 updatedAt:
1821 type: string
1822 Actor:
1823 properties:
1824 id:
1825 type: number
1826 uuid:
1827 type: string
1828 url:
1829 type: string
1830 name:
1831 type: string
1832 host:
1833 type: string
1834 followingCount:
1835 type: number
1836 followersCount:
1837 type: number
1838 createdAt:
1839 type: string
1840 updatedAt:
1841 type: string
1842 avatar:
1843 $ref: '#/components/schemas/Avatar'
1844 Account:
1845 allOf:
1846 - $ref: '#/components/schemas/Actor'
1847 - properties:
1848 displayName:
1849 type: string
1850 User:
1851 properties:
1852 id:
1853 type: number
1854 username:
1855 type: string
1856 email:
1857 type: string
1858 displayNSFW:
1859 type: boolean
1860 autoPlayVideo:
1861 type: boolean
1862 role:
1863 type: string
1864 enum:
1865 - User
1866 - Moderator
1867 - Administrator
1868 videoQuota:
1869 type: number
1870 createdAt:
1871 type: string
1872 account:
1873 $ref: '#/components/schemas/Account'
1874 videoChannels:
1875 type: array
1876 items:
1877 $ref: '#/components/schemas/VideoChannel'
1878 UserWatchingVideo:
1879 properties:
1880 currentTime:
1881 type: number
1882 ServerConfig:
1883 properties:
1884 signup:
1885 type: object
1886 properties:
1887 allowed:
1888 type: boolean
1889 transcoding:
1890 type: object
1891 properties:
1892 enabledResolutions:
1893 type: array
1894 items:
1895 type: number
1896 avatar:
1897 type: object
1898 properties:
1899 file:
1900 type: object
1901 properties:
1902 size:
1903 type: object
1904 properties:
1905 max:
1906 type: number
1907 extensions:
1908 type: array
1909 items:
1910 type: string
1911 video:
1912 type: object
1913 properties:
1914 file:
1915 type: object
1916 properties:
1917 extensions:
1918 type: array
1919 items:
1920 type: string
1921 Follow:
1922 properties:
1923 id:
1924 type: number
1925 follower:
1926 $ref: '#/components/schemas/Actor'
1927 following:
1928 $ref: '#/components/schemas/Actor'
1929 score:
1930 type: number
1931 state:
1932 type: string
1933 enum:
1934 - pending
1935 - accepted
1936 createdAt:
1937 type: string
1938 updatedAt:
1939 type: string
1940 Job:
1941 properties:
1942 id:
1943 type: number
1944 state:
1945 type: string
1946 enum:
1947 - pending
1948 - processing
1949 - error
1950 - success
1951 category:
1952 type: string
1953 enum:
1954 - transcoding
1955 - activitypub-http
1956 handlerName:
1957 type: string
1958 handlerInputData:
1959 type: string
1960 createdAt:
1961 type: string
1962 updatedAt:
1963 type: string
1964 AddUserResponse:
1965 properties:
1966 id:
1967 type: number
1968 uuid:
1969 type: string
1970 VideoUploadResponse:
1971 properties:
1972 video:
1973 type: object
1974 properties:
1975 id:
1976 type: number
1977 uuid:
1978 type: string
1979 CommentThreadResponse:
1980 properties:
1981 total:
1982 type: number
1983 data:
1984 type: array
1985 items:
1986 $ref: '#/components/schemas/VideoComment'
1987 CommentThreadPostResponse:
1988 properties:
1989 comment:
1990 $ref: '#/components/schemas/VideoComment'
1991 AddUser:
1992 properties:
1993 username:
1994 type: string
1995 description: 'The user username '
1996 password:
1997 type: string
1998 description: 'The user password '
1999 email:
2000 type: string
2001 description: 'The user email '
2002 videoQuota:
2003 type: string
2004 description: 'The user videoQuota '
2005 role:
2006 type: integer
2007 format: int32
2008 enum:
2009 - 0
2010 - 1
2011 - 2
2012 description: 'The user role '
2013 required:
2014 - username
2015 - password
2016 - email
2017 - videoQuota
2018 - role
2019 UpdateUser:
2020 properties:
2021 id:
2022 type: string
2023 description: 'The user id '
2024 email:
2025 type: string
2026 description: 'The updated email of the user '
2027 videoQuota:
2028 type: string
2029 description: 'The updated videoQuota of the user '
2030 role:
2031 type: string
2032 description: 'The updated role of the user '
2033 required:
2034 - id
2035 - email
2036 - videoQuota
2037 - role
2038 UpdateMe:
2039 properties:
2040 password:
2041 type: string
2042 description: 'Your new password '
2043 email:
2044 type: string
2045 description: 'Your new email '
2046 displayNSFW:
2047 type: string
2048 description: 'Your new displayNSFW '
2049 autoPlayVideo:
2050 type: string
2051 description: 'Your new autoPlayVideo '
2052 required:
2053 - password
2054 - email
2055 - displayNSFW
2056 - autoPlayVideo
2057 GetMeVideoRating:
2058 properties:
2059 id:
2060 type: string
2061 description: 'Id of the video '
2062 rating:
2063 type: number
2064 description: 'Rating of the video '
2065 required:
2066 - id
2067 - rating
2068 RegisterUser:
2069 properties:
2070 username:
2071 type: string
2072 description: 'The username of the user '
2073 password:
2074 type: string
2075 description: 'The password of the user '
2076 email:
2077 type: string
2078 description: 'The email of the user '
2079 required:
2080 - username
2081 - password
2082 - email
2083 VideoChannelInput:
2084 properties:
2085 name:
2086 type: string
2087 description:
2088 type: string
2089