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