openapi.yaml 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478
  1. openapi: 3.0.0
  2. info:
  3. title: PeerTube
  4. version: 1.3.1
  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. # Authentication
  24. When you sign up for an account, you are given the possibility to generate
  25. sessions, and authenticate using this session token. One session token can
  26. currently be used at a time.
  27. # Errors
  28. The API uses standard HTTP status codes to indicate the success or failure
  29. of the API call. The body of the response will be JSON in the following
  30. format.
  31. ```
  32. {
  33. "code": "unauthorized_request", // example inner error code
  34. "error": "Token is invalid." // example exposed error message
  35. }
  36. ```
  37. externalDocs:
  38. url: https://docs.joinpeertube.org/#/api-rest-reference.html
  39. tags:
  40. - name: Accounts
  41. description: >
  42. Using some features of PeerTube require authentication, for which Accounts
  43. provide different levels of permission as well as associated user
  44. information. Accounts also encompass remote accounts discovered across the federation.
  45. - name: Config
  46. description: >
  47. Each server exposes public information regarding supported videos and
  48. options.
  49. - name: Feeds
  50. description: |
  51. Feeds of videos and feeds of comments allow to see updates and get them in
  52. an aggregator or script of your choice.
  53. - name: Job
  54. description: >
  55. Jobs are long-running tasks enqueued and processed by the instance
  56. itself. No additional worker registration is currently available.
  57. - name: Server Following
  58. description: >
  59. Managing servers which the instance interacts with is crucial to the
  60. concept of federation in PeerTube and external video indexation. The PeerTube
  61. server then deals with inter-server ActivityPub operations and propagates
  62. information across its social graph by posting activities to actors' inbox
  63. endpoints.
  64. - name: Video Abuse
  65. description: |
  66. Video abuses deal with reports of local or remote videos alike.
  67. - name: Video
  68. description: |
  69. Operations dealing with listing, uploading, fetching or modifying videos.
  70. - name: Search
  71. description: |
  72. The search helps to find _videos_ from within the instance and beyond.
  73. Videos from other instances federated by the instance (that is, instances
  74. followed by the instance) can be found via keywords and other criteria of
  75. the advanced search.
  76. - name: Video Comment
  77. description: >
  78. Operations dealing with comments to a video. Comments are organized in
  79. threads.
  80. - name: Video Channel
  81. description: >
  82. Operations dealing with creation, modification and video listing of a
  83. user's channels.
  84. - name: Video Blacklist
  85. description: >
  86. Operations dealing with blacklisting videos (removing them from view and
  87. preventing interactions).
  88. - name: Video Rate
  89. description: >
  90. Voting for a video.
  91. x-tagGroups:
  92. - name: Accounts
  93. tags:
  94. - Accounts
  95. - User
  96. - name: Videos
  97. tags:
  98. - Video
  99. - Video Caption
  100. - Video Channel
  101. - Video Comment
  102. - Video Following
  103. - Video Rate
  104. - name: Moderation
  105. tags:
  106. - Video Abuse
  107. - Video Blacklist
  108. - name: Instance Configuration
  109. tags:
  110. - Config
  111. - Server Following
  112. - name: Notifications
  113. tags:
  114. - Feeds
  115. - name: Jobs
  116. tags:
  117. - Job
  118. - name: Search
  119. tags:
  120. - Search
  121. paths:
  122. '/accounts/{name}':
  123. get:
  124. tags:
  125. - Accounts
  126. summary: Get the account by name
  127. parameters:
  128. - $ref: '#/components/parameters/name'
  129. - $ref: '#/components/parameters/start'
  130. - $ref: '#/components/parameters/count'
  131. - $ref: '#/components/parameters/sort'
  132. responses:
  133. '200':
  134. description: successful operation
  135. content:
  136. application/json:
  137. schema:
  138. $ref: '#/components/schemas/Account'
  139. '/accounts/{name}/videos':
  140. get:
  141. tags:
  142. - Accounts
  143. - Video
  144. summary: 'Get videos for an account, provided the name of that account'
  145. parameters:
  146. - $ref: '#/components/parameters/name'
  147. responses:
  148. '200':
  149. description: successful operation
  150. content:
  151. application/json:
  152. schema:
  153. $ref: '#/components/schemas/VideoListResponse'
  154. x-code-samples:
  155. - lang: JavaScript
  156. source: |
  157. fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
  158. .then(function(response) {
  159. return response.json()
  160. }).then(function(data) {
  161. console.log(data)
  162. })
  163. - lang: Shell
  164. source: |
  165. # pip install httpie
  166. http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
  167. - lang: Ruby
  168. source: |
  169. require 'uri'
  170. require 'net/http'
  171. url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos")
  172. http = Net::HTTP.new(url.host, url.port)
  173. http.use_ssl = true
  174. http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  175. request = Net::HTTP::Post.new(url)
  176. request["content-type"] = 'application/json'
  177. response = http.request(request)
  178. puts response.read_body
  179. - lang: Python
  180. source: |
  181. import http.client
  182. conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1")
  183. headers = {
  184. 'content-type': "application/json"
  185. }
  186. conn.request("POST", "/accounts/{name}/videos", None, headers)
  187. res = conn.getresponse()
  188. data = res.read()
  189. print(data.decode("utf-8"))
  190. /accounts:
  191. get:
  192. tags:
  193. - Accounts
  194. summary: Get all accounts
  195. responses:
  196. '200':
  197. description: successful operation
  198. content:
  199. 'application/json':
  200. schema:
  201. type: array
  202. items:
  203. $ref: '#/components/schemas/Account'
  204. /config:
  205. get:
  206. tags:
  207. - Config
  208. summary: Get the public configuration of the server
  209. responses:
  210. '200':
  211. description: successful operation
  212. content:
  213. application/json:
  214. schema:
  215. $ref: '#/components/schemas/ServerConfig'
  216. /config/about:
  217. get:
  218. summary: Get the instance about page content
  219. tags:
  220. - Config
  221. responses:
  222. '200':
  223. description: successful operation
  224. /config/custom:
  225. get:
  226. summary: Get the runtime configuration of the server
  227. tags:
  228. - Config
  229. security:
  230. - OAuth2:
  231. - admin
  232. responses:
  233. '200':
  234. description: successful operation
  235. put:
  236. summary: Set 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. delete:
  246. summary: Delete 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. '/feeds/videos.{format}':
  256. get:
  257. summary: >-
  258. Get the feed of videos for the server, with optional filter by account
  259. name or id
  260. tags:
  261. - Feeds
  262. parameters:
  263. - name: format
  264. in: path
  265. required: true
  266. description: >-
  267. The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and
  268. json to JSON FEED 1.0
  269. schema:
  270. type: string
  271. enum:
  272. - xml
  273. - atom
  274. - json
  275. default: xml
  276. - name: accountId
  277. in: query
  278. required: false
  279. description: >-
  280. The id of the local account to filter to (beware, users IDs and not
  281. actors IDs which will return empty feeds
  282. schema:
  283. type: number
  284. - name: accountName
  285. in: query
  286. required: false
  287. description: The name of the local account to filter to
  288. schema:
  289. type: string
  290. responses:
  291. '200':
  292. description: successful operation
  293. /jobs/{state}:
  294. get:
  295. summary: Get list of jobs
  296. security:
  297. - OAuth2:
  298. - admin
  299. tags:
  300. - Job
  301. parameters:
  302. - name: state
  303. in: path
  304. required: true
  305. description: The state of the job
  306. schema:
  307. type: string
  308. enum:
  309. - active
  310. - completed
  311. - failed
  312. - waiting
  313. - delayed
  314. - $ref: '#/components/parameters/start'
  315. - $ref: '#/components/parameters/count'
  316. - $ref: '#/components/parameters/sort'
  317. responses:
  318. '200':
  319. description: successful operation
  320. content:
  321. application/json:
  322. schema:
  323. type: array
  324. items:
  325. $ref: '#/components/schemas/Job'
  326. '/server/following/{host}':
  327. delete:
  328. security:
  329. - OAuth2:
  330. - admin
  331. tags:
  332. - Server Following
  333. summary: Unfollow a server by hostname
  334. parameters:
  335. - name: host
  336. in: path
  337. required: true
  338. description: 'The host to unfollow '
  339. schema:
  340. type: string
  341. responses:
  342. '201':
  343. description: successful operation
  344. /server/followers:
  345. get:
  346. tags:
  347. - Server Following
  348. summary: Get followers of the server
  349. parameters:
  350. - $ref: '#/components/parameters/start'
  351. - $ref: '#/components/parameters/count'
  352. - $ref: '#/components/parameters/sort'
  353. responses:
  354. '200':
  355. description: successful operation
  356. content:
  357. application/json:
  358. schema:
  359. type: array
  360. items:
  361. $ref: '#/components/schemas/Follow'
  362. /server/following:
  363. get:
  364. tags:
  365. - Server Following
  366. summary: Get servers followed by the server
  367. parameters:
  368. - $ref: '#/components/parameters/start'
  369. - $ref: '#/components/parameters/count'
  370. - $ref: '#/components/parameters/sort'
  371. responses:
  372. '200':
  373. description: successful operation
  374. content:
  375. application/json:
  376. schema:
  377. type: array
  378. items:
  379. $ref: '#/components/schemas/Follow'
  380. post:
  381. security:
  382. - OAuth2:
  383. - admin
  384. tags:
  385. - Server Following
  386. summary: Follow a server
  387. responses:
  388. '204':
  389. $ref: '#/paths/~1users~1me/put/responses/204'
  390. requestBody:
  391. content:
  392. application/json:
  393. schema:
  394. $ref: '#/components/schemas/Follow'
  395. /users:
  396. post:
  397. summary: Creates user
  398. security:
  399. - OAuth2:
  400. - admin
  401. tags:
  402. - User
  403. responses:
  404. '200':
  405. description: successful operation
  406. content:
  407. application/json:
  408. schema:
  409. $ref: '#/components/schemas/AddUserResponse'
  410. requestBody:
  411. content:
  412. application/json:
  413. schema:
  414. $ref: '#/components/schemas/AddUser'
  415. description: User to create
  416. required: true
  417. get:
  418. summary: Get a list of users
  419. security:
  420. - OAuth2: []
  421. tags:
  422. - User
  423. parameters:
  424. - $ref: '#/components/parameters/start'
  425. - $ref: '#/components/parameters/count'
  426. - $ref: '#/components/parameters/usersSort'
  427. responses:
  428. '200':
  429. description: successful operation
  430. content:
  431. application/json:
  432. schema:
  433. type: array
  434. items:
  435. $ref: '#/components/schemas/User'
  436. '/users/{id}':
  437. delete:
  438. summary: Delete a user by its id
  439. security:
  440. - OAuth2:
  441. - admin
  442. tags:
  443. - User
  444. parameters:
  445. - $ref: '#/components/parameters/id'
  446. responses:
  447. '204':
  448. $ref: '#/paths/~1users~1me/put/responses/204'
  449. get:
  450. summary: Get user by its id
  451. security:
  452. - OAuth2: []
  453. tags:
  454. - User
  455. parameters:
  456. - $ref: '#/components/parameters/id'
  457. responses:
  458. '200':
  459. description: successful operation
  460. content:
  461. application/json:
  462. schema:
  463. $ref: '#/components/schemas/User'
  464. put:
  465. summary: Update user profile by its id
  466. security:
  467. - OAuth2: []
  468. tags:
  469. - User
  470. parameters:
  471. - $ref: '#/components/parameters/id'
  472. responses:
  473. '204':
  474. $ref: '#/paths/~1users~1me/put/responses/204'
  475. requestBody:
  476. content:
  477. application/json:
  478. schema:
  479. $ref: '#/components/schemas/UpdateUser'
  480. required: true
  481. /users/me:
  482. get:
  483. summary: Get current user information
  484. security:
  485. - OAuth2:
  486. - user
  487. tags:
  488. - User
  489. responses:
  490. '200':
  491. description: successful operation
  492. content:
  493. application/json:
  494. schema:
  495. type: array
  496. items:
  497. $ref: '#/components/schemas/User'
  498. put:
  499. summary: Update current user information
  500. security:
  501. - OAuth2:
  502. - user
  503. tags:
  504. - User
  505. responses:
  506. '204':
  507. description: Successful operation
  508. requestBody:
  509. content:
  510. application/json:
  511. schema:
  512. $ref: '#/components/schemas/UpdateMe'
  513. required: true
  514. /users/me/video-quota-used:
  515. get:
  516. summary: Get current user used quota
  517. security:
  518. - OAuth2:
  519. - user
  520. tags:
  521. - User
  522. responses:
  523. '200':
  524. description: successful operation
  525. content:
  526. application/json:
  527. schema:
  528. type: number
  529. '/users/me/videos/{videoId}/rating':
  530. get:
  531. summary: 'Get rating of video by its id, among those of the current user'
  532. security:
  533. - OAuth2: []
  534. tags:
  535. - User
  536. parameters:
  537. - name: videoId
  538. in: path
  539. required: true
  540. description: 'The video id '
  541. schema:
  542. type: string
  543. responses:
  544. '200':
  545. description: successful operation
  546. content:
  547. application/json:
  548. schema:
  549. $ref: '#/components/schemas/GetMeVideoRating'
  550. /users/me/videos:
  551. get:
  552. summary: Get videos of the current user
  553. security:
  554. - OAuth2:
  555. - user
  556. tags:
  557. - User
  558. parameters:
  559. - $ref: '#/components/parameters/start'
  560. - $ref: '#/components/parameters/count'
  561. - $ref: '#/components/parameters/sort'
  562. responses:
  563. '200':
  564. description: successful operation
  565. content:
  566. application/json:
  567. schema:
  568. $ref: '#/components/schemas/VideoListResponse'
  569. /users/me/subscriptions:
  570. get:
  571. summary: Get subscriptions of the current user
  572. security:
  573. - OAuth2:
  574. - user
  575. tags:
  576. - User
  577. parameters:
  578. - $ref: '#/components/parameters/start'
  579. - $ref: '#/components/parameters/count'
  580. - $ref: '#/components/parameters/sort'
  581. responses:
  582. '200':
  583. description: successful operation
  584. post:
  585. summary: Add subscription to the current user
  586. security:
  587. - OAuth2:
  588. - user
  589. tags:
  590. - User
  591. responses:
  592. '200':
  593. description: successful operation
  594. /users/me/subscriptions/exist:
  595. get:
  596. summary: Get if subscriptions exist for the current user
  597. security:
  598. - OAuth2:
  599. - user
  600. tags:
  601. - User
  602. parameters:
  603. - $ref: '#/components/parameters/subscriptionsUris'
  604. responses:
  605. '200':
  606. description: successful operation
  607. content:
  608. application/json:
  609. schema:
  610. type: object
  611. /users/me/subscriptions/videos:
  612. get:
  613. summary: Get videos of subscriptions of the current user
  614. security:
  615. - OAuth2:
  616. - user
  617. tags:
  618. - User
  619. parameters:
  620. - $ref: '#/components/parameters/start'
  621. - $ref: '#/components/parameters/count'
  622. - $ref: '#/components/parameters/sort'
  623. responses:
  624. '200':
  625. description: successful operation
  626. content:
  627. application/json:
  628. schema:
  629. $ref: '#/components/schemas/VideoListResponse'
  630. '/users/me/subscriptions/{uri}':
  631. get:
  632. summary: Get subscription of the current user for a given uri
  633. security:
  634. - OAuth2:
  635. - user
  636. tags:
  637. - User
  638. responses:
  639. '200':
  640. description: successful operation
  641. content:
  642. application/json:
  643. schema:
  644. $ref: '#/components/schemas/VideoChannel'
  645. delete:
  646. summary: Delete 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. /users/register:
  656. post:
  657. summary: Register a user
  658. tags:
  659. - User
  660. responses:
  661. '204':
  662. $ref: '#/paths/~1users~1me/put/responses/204'
  663. requestBody:
  664. content:
  665. application/json:
  666. schema:
  667. $ref: '#/components/schemas/RegisterUser'
  668. required: true
  669. /users/me/avatar/pick:
  670. post:
  671. summary: Update current user avatar
  672. security:
  673. - OAuth2: []
  674. tags:
  675. - User
  676. responses:
  677. '200':
  678. description: successful operation
  679. content:
  680. application/json:
  681. schema:
  682. $ref: '#/components/schemas/Avatar'
  683. requestBody:
  684. content:
  685. multipart/form-data:
  686. schema:
  687. type: object
  688. properties:
  689. avatarfile:
  690. description: The file to upload.
  691. type: string
  692. format: binary
  693. encoding:
  694. profileImage:
  695. # only accept png/jpeg
  696. contentType: image/png, image/jpeg
  697. /videos:
  698. get:
  699. summary: Get list of videos
  700. tags:
  701. - Video
  702. parameters:
  703. - $ref: '#/components/parameters/categoryOneOf'
  704. - $ref: '#/components/parameters/tagsOneOf'
  705. - $ref: '#/components/parameters/tagsAllOf'
  706. - $ref: '#/components/parameters/licenceOneOf'
  707. - $ref: '#/components/parameters/languageOneOf'
  708. - $ref: '#/components/parameters/nsfw'
  709. - $ref: '#/components/parameters/filter'
  710. - $ref: '#/components/parameters/start'
  711. - $ref: '#/components/parameters/count'
  712. - $ref: '#/components/parameters/videosSort'
  713. responses:
  714. '200':
  715. description: successful operation
  716. content:
  717. application/json:
  718. schema:
  719. $ref: '#/components/schemas/VideoListResponse'
  720. /videos/categories:
  721. get:
  722. summary: Get list of video licences known by the server
  723. tags:
  724. - Video
  725. responses:
  726. '200':
  727. description: successful operation
  728. content:
  729. application/json:
  730. schema:
  731. type: array
  732. items:
  733. type: string
  734. /videos/licences:
  735. get:
  736. summary: Get list of video licences known by the server
  737. tags:
  738. - Video
  739. responses:
  740. '200':
  741. description: successful operation
  742. content:
  743. application/json:
  744. schema:
  745. type: array
  746. items:
  747. type: string
  748. /videos/languages:
  749. get:
  750. summary: Get list of languages known by the server
  751. tags:
  752. - Video
  753. responses:
  754. '200':
  755. description: successful operation
  756. content:
  757. application/json:
  758. schema:
  759. type: array
  760. items:
  761. type: string
  762. /videos/privacies:
  763. get:
  764. summary: Get list of privacy policies supported by the server
  765. tags:
  766. - Video
  767. responses:
  768. '200':
  769. description: successful operation
  770. content:
  771. application/json:
  772. schema:
  773. type: array
  774. items:
  775. type: string
  776. '/videos/{id}':
  777. put:
  778. summary: Update metadata for a video by its id
  779. security:
  780. - OAuth2: []
  781. tags:
  782. - Video
  783. parameters:
  784. - $ref: '#/components/parameters/id2'
  785. responses:
  786. '200':
  787. description: successful operation
  788. content:
  789. application/json:
  790. schema:
  791. $ref: '#/components/schemas/Video'
  792. requestBody:
  793. content:
  794. multipart/form-data:
  795. schema:
  796. type: object
  797. properties:
  798. thumbnailfile:
  799. description: Video thumbnail file
  800. type: string
  801. previewfile:
  802. description: Video preview file
  803. type: string
  804. category:
  805. description: Video category
  806. type: string
  807. licence:
  808. description: Video licence
  809. type: string
  810. language:
  811. description: Video language
  812. type: string
  813. description:
  814. description: Video description
  815. type: string
  816. waitTranscoding:
  817. description: Whether or not we wait transcoding before publish the video
  818. type: string
  819. support:
  820. description: Text describing how to support the video uploader
  821. type: string
  822. nsfw:
  823. description: Whether or not this video contains sensitive content
  824. type: string
  825. name:
  826. description: Video name
  827. type: string
  828. tags:
  829. description: Video tags (maximum 5 tags each between 2 and 30 characters)
  830. type: array
  831. items:
  832. type: string
  833. commentsEnabled:
  834. description: Enable or disable comments for this video
  835. type: string
  836. scheduleUpdate:
  837. $ref: '#/components/schemas/VideoScheduledUpdate'
  838. get:
  839. summary: Get a video by its id
  840. tags:
  841. - Video
  842. parameters:
  843. - $ref: '#/components/parameters/id2'
  844. responses:
  845. '200':
  846. description: successful operation
  847. content:
  848. application/json:
  849. schema:
  850. $ref: '#/components/schemas/VideoDetails'
  851. delete:
  852. summary: Delete a video by its id
  853. security:
  854. - OAuth2: []
  855. tags:
  856. - Video
  857. parameters:
  858. - $ref: '#/components/parameters/id2'
  859. responses:
  860. '204':
  861. $ref: '#/paths/~1users~1me/put/responses/204'
  862. '/videos/{id}/description':
  863. get:
  864. summary: Get a video description by its id
  865. tags:
  866. - Video
  867. parameters:
  868. - $ref: '#/components/parameters/id2'
  869. responses:
  870. '200':
  871. description: successful operation
  872. content:
  873. application/json:
  874. schema:
  875. type: string
  876. '/videos/{id}/views':
  877. post:
  878. summary: Add a view to the video by its id
  879. tags:
  880. - Video
  881. parameters:
  882. - $ref: '#/components/parameters/id2'
  883. responses:
  884. '204':
  885. $ref: '#/paths/~1users~1me/put/responses/204'
  886. '/videos/{id}/watching':
  887. put:
  888. summary: Set watching progress of a video by its id for a user
  889. tags:
  890. - Video
  891. security:
  892. - OAuth2: []
  893. parameters:
  894. - $ref: '#/components/parameters/id2'
  895. requestBody:
  896. content:
  897. application/json:
  898. schema:
  899. $ref: '#/components/schemas/UserWatchingVideo'
  900. required: true
  901. responses:
  902. '204':
  903. $ref: '#/paths/~1users~1me/put/responses/204'
  904. /videos/ownership:
  905. get:
  906. summary: Get list of video ownership changes requests
  907. tags:
  908. - Video
  909. security:
  910. - OAuth2: []
  911. parameters:
  912. - $ref: '#/components/parameters/id2'
  913. responses:
  914. '200':
  915. description: successful operation
  916. '/videos/ownership/{id}/accept':
  917. post:
  918. summary: Refuse ownership change request for video by its id
  919. tags:
  920. - Video
  921. security:
  922. - OAuth2: []
  923. parameters:
  924. - $ref: '#/components/parameters/id2'
  925. responses:
  926. '204':
  927. $ref: '#/paths/~1users~1me/put/responses/204'
  928. '/videos/ownership/{id}/refuse':
  929. post:
  930. summary: Accept ownership change request for video by its id
  931. tags:
  932. - Video
  933. security:
  934. - OAuth2: []
  935. parameters:
  936. - $ref: '#/components/parameters/id2'
  937. responses:
  938. '204':
  939. $ref: '#/paths/~1users~1me/put/responses/204'
  940. '/videos/{id}/give-ownership':
  941. post:
  942. summary: Request change of ownership for a video you own, by its id
  943. tags:
  944. - Video
  945. security:
  946. - OAuth2: []
  947. parameters:
  948. - $ref: '#/components/parameters/id2'
  949. requestBody:
  950. required: true
  951. content:
  952. application/x-www-form-urlencoded:
  953. schema:
  954. type: object
  955. properties:
  956. username:
  957. type: string
  958. required:
  959. - username
  960. responses:
  961. '204':
  962. $ref: '#/paths/~1users~1me/put/responses/204'
  963. '400':
  964. description: 'Changing video ownership to a remote account is not supported yet'
  965. /videos/upload:
  966. post:
  967. summary: Upload a video file with its metadata
  968. security:
  969. - OAuth2: []
  970. tags:
  971. - Video
  972. responses:
  973. '200':
  974. description: successful operation
  975. content:
  976. application/json:
  977. schema:
  978. $ref: '#/components/schemas/VideoUploadResponse'
  979. requestBody:
  980. content:
  981. multipart/form-data:
  982. schema:
  983. type: object
  984. properties:
  985. videofile:
  986. description: Video file
  987. type: string
  988. format: binary
  989. channelId:
  990. description: Channel id that will contain this video
  991. type: number
  992. thumbnailfile:
  993. description: Video thumbnail file
  994. type: string
  995. previewfile:
  996. description: Video preview file
  997. type: string
  998. privacy:
  999. $ref: '#/components/schemas/VideoPrivacySet'
  1000. category:
  1001. description: Video category
  1002. type: string
  1003. licence:
  1004. description: Video licence
  1005. type: string
  1006. language:
  1007. description: Video language
  1008. type: string
  1009. description:
  1010. description: Video description
  1011. type: string
  1012. waitTranscoding:
  1013. description: Whether or not we wait transcoding before publish the video
  1014. type: string
  1015. support:
  1016. description: Text describing how to support the video uploader
  1017. type: string
  1018. nsfw:
  1019. description: Whether or not this video contains sensitive content
  1020. type: string
  1021. name:
  1022. description: Video name
  1023. type: string
  1024. tags:
  1025. description: Video tags
  1026. type: array
  1027. items:
  1028. type: string
  1029. commentsEnabled:
  1030. description: Enable or disable comments for this video
  1031. type: string
  1032. scheduleUpdate:
  1033. $ref: '#/components/schemas/VideoScheduledUpdate'
  1034. required:
  1035. - videofile
  1036. - channelId
  1037. - name
  1038. x-code-samples:
  1039. - lang: Shell
  1040. source: |
  1041. ## DEPENDENCIES: httpie, jq
  1042. # pip install httpie
  1043. USERNAME="<your_username>"
  1044. PASSWORD="<your_password>"
  1045. FILE_PATH="<your_file_path>"
  1046. CHANNEL_ID="<your_channel_id>"
  1047. NAME="<video_name>"
  1048. API_PATH="https://peertube2.cpy.re/api/v1"
  1049. ## AUTH
  1050. client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
  1051. client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
  1052. token=$(http -b --form POST "$API_PATH/users/token" \
  1053. client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
  1054. username=$USERNAME \
  1055. password=$PASSWORD \
  1056. | jq -r ".access_token")
  1057. ## VIDEO UPLOAD
  1058. http -b --form POST "$API_PATH/videos/upload" \
  1059. videofile@$FILE_PATH \
  1060. channelId=$CHANNEL_ID \
  1061. name=$NAME \
  1062. "Authorization:Bearer $token"
  1063. /videos/imports:
  1064. post:
  1065. summary: Import a torrent or magnetURI or HTTP ressource (if enabled by the instance administrator)
  1066. security:
  1067. - OAuth2: []
  1068. tags:
  1069. - Video
  1070. responses:
  1071. '200':
  1072. description: successful operation
  1073. content:
  1074. application/json:
  1075. schema:
  1076. $ref: '#/components/schemas/VideoUploadResponse'
  1077. requestBody:
  1078. content:
  1079. multipart/form-data:
  1080. schema:
  1081. type: object
  1082. properties:
  1083. torrentfile:
  1084. description: Torrent File
  1085. type: string
  1086. format: binary
  1087. targetUrl:
  1088. description: HTTP target URL
  1089. type: string
  1090. magnetUri:
  1091. description: Magnet URI
  1092. type: string
  1093. channelId:
  1094. description: Channel id that will contain this video
  1095. type: number
  1096. thumbnailfile:
  1097. description: Video thumbnail file
  1098. type: string
  1099. previewfile:
  1100. description: Video preview file
  1101. type: string
  1102. privacy:
  1103. $ref: '#/components/schemas/VideoPrivacySet'
  1104. category:
  1105. description: Video category
  1106. type: string
  1107. licence:
  1108. description: Video licence
  1109. type: string
  1110. language:
  1111. description: Video language
  1112. type: string
  1113. description:
  1114. description: Video description
  1115. type: string
  1116. waitTranscoding:
  1117. description: Whether or not we wait transcoding before publish the video
  1118. type: string
  1119. support:
  1120. description: Text describing how to support the video uploader
  1121. type: string
  1122. nsfw:
  1123. description: Whether or not this video contains sensitive content
  1124. type: string
  1125. name:
  1126. description: Video name
  1127. type: string
  1128. tags:
  1129. description: Video tags
  1130. type: array
  1131. items:
  1132. type: string
  1133. commentsEnabled:
  1134. description: Enable or disable comments for this video
  1135. type: string
  1136. scheduleUpdate:
  1137. $ref: '#/components/schemas/VideoScheduledUpdate'
  1138. required:
  1139. - channelId
  1140. - name
  1141. /videos/abuse:
  1142. get:
  1143. summary: Get list of reported video abuses
  1144. security:
  1145. - OAuth2: []
  1146. tags:
  1147. - Video Abuse
  1148. parameters:
  1149. - $ref: '#/components/parameters/start'
  1150. - $ref: '#/components/parameters/count'
  1151. - $ref: '#/components/parameters/abusesSort'
  1152. responses:
  1153. '200':
  1154. description: successful operation
  1155. content:
  1156. application/json:
  1157. schema:
  1158. type: array
  1159. items:
  1160. $ref: '#/components/schemas/VideoAbuse'
  1161. '/videos/{id}/abuse':
  1162. post:
  1163. summary: 'Report an abuse, on a video by its id'
  1164. security:
  1165. - OAuth2: []
  1166. tags:
  1167. - Video Abuse
  1168. parameters:
  1169. - $ref: '#/components/parameters/id2'
  1170. responses:
  1171. '204':
  1172. $ref: '#/paths/~1users~1me/put/responses/204'
  1173. '/videos/{id}/blacklist':
  1174. post:
  1175. summary: Put on blacklist a video by its id
  1176. security:
  1177. - OAuth2:
  1178. - admin
  1179. - moderator
  1180. tags:
  1181. - Video Blacklist
  1182. parameters:
  1183. - $ref: '#/components/parameters/id2'
  1184. responses:
  1185. '204':
  1186. $ref: '#/paths/~1users~1me/put/responses/204'
  1187. delete:
  1188. summary: Delete an entry of the blacklist of a video by its id
  1189. security:
  1190. - OAuth2:
  1191. - admin
  1192. - moderator
  1193. tags:
  1194. - Video Blacklist
  1195. parameters:
  1196. - $ref: '#/components/parameters/id2'
  1197. responses:
  1198. '204':
  1199. $ref: '#/paths/~1users~1me/put/responses/204'
  1200. /videos/blacklist:
  1201. get:
  1202. summary: Get list of videos on blacklist
  1203. security:
  1204. - OAuth2:
  1205. - admin
  1206. - moderator
  1207. tags:
  1208. - Video Blacklist
  1209. parameters:
  1210. - $ref: '#/components/parameters/start'
  1211. - $ref: '#/components/parameters/count'
  1212. - $ref: '#/components/parameters/blacklistsSort'
  1213. responses:
  1214. '200':
  1215. description: successful operation
  1216. content:
  1217. application/json:
  1218. schema:
  1219. type: array
  1220. items:
  1221. $ref: '#/components/schemas/VideoBlacklist'
  1222. /videos/{id}/captions:
  1223. get:
  1224. summary: Get list of video's captions
  1225. tags:
  1226. - Video Caption
  1227. parameters:
  1228. - $ref: '#/components/parameters/id2'
  1229. responses:
  1230. '200':
  1231. description: successful operation
  1232. content:
  1233. application/json:
  1234. schema:
  1235. type: object
  1236. properties:
  1237. total:
  1238. type: integer
  1239. data:
  1240. type: array
  1241. items:
  1242. $ref: '#/components/schemas/VideoCaption'
  1243. /videos/{id}/captions/{captionLanguage}:
  1244. put:
  1245. summary: Add or replace a video caption
  1246. tags:
  1247. - Video Caption
  1248. parameters:
  1249. - $ref: '#/components/parameters/id2'
  1250. - $ref: '#/components/parameters/captionLanguage'
  1251. requestBody:
  1252. content:
  1253. multipart/form-data:
  1254. schema:
  1255. type: object
  1256. properties:
  1257. captionfile:
  1258. description: The file to upload.
  1259. type: string
  1260. format: binary
  1261. responses:
  1262. '204':
  1263. $ref: '#/paths/~1users~1me/put/responses/204'
  1264. delete:
  1265. summary: Delete a video caption
  1266. tags:
  1267. - Video Caption
  1268. parameters:
  1269. - $ref: '#/components/parameters/id2'
  1270. - $ref: '#/components/parameters/captionLanguage'
  1271. responses:
  1272. '204':
  1273. $ref: '#/paths/~1users~1me/put/responses/204'
  1274. /video-channels:
  1275. get:
  1276. summary: Get list of video channels
  1277. tags:
  1278. - Video Channel
  1279. parameters:
  1280. - $ref: '#/components/parameters/start'
  1281. - $ref: '#/components/parameters/count'
  1282. - $ref: '#/components/parameters/sort'
  1283. responses:
  1284. '200':
  1285. description: successful operation
  1286. content:
  1287. application/json:
  1288. schema:
  1289. type: array
  1290. items:
  1291. $ref: '#/components/schemas/VideoChannel'
  1292. post:
  1293. summary: Creates a video channel for the current user
  1294. security:
  1295. - OAuth2: []
  1296. tags:
  1297. - Video Channel
  1298. responses:
  1299. '204':
  1300. $ref: '#/paths/~1users~1me/put/responses/204'
  1301. requestBody:
  1302. content:
  1303. application/json:
  1304. schema:
  1305. $ref: '#/components/schemas/VideoChannelCreate'
  1306. '/video-channels/{channelHandle}':
  1307. get:
  1308. summary: Get a video channel by its id
  1309. tags:
  1310. - Video Channel
  1311. parameters:
  1312. - $ref: '#/components/parameters/channelHandle'
  1313. responses:
  1314. '200':
  1315. description: successful operation
  1316. content:
  1317. application/json:
  1318. schema:
  1319. $ref: '#/components/schemas/VideoChannel'
  1320. put:
  1321. summary: Update a video channel by its id
  1322. security:
  1323. - OAuth2: []
  1324. tags:
  1325. - Video Channel
  1326. parameters:
  1327. - $ref: '#/components/parameters/channelHandle'
  1328. responses:
  1329. '204':
  1330. $ref: '#/paths/~1users~1me/put/responses/204'
  1331. requestBody:
  1332. content:
  1333. application/json:
  1334. schema:
  1335. $ref: '#/components/schemas/VideoChannelUpdate'
  1336. delete:
  1337. summary: Delete a video channel by its id
  1338. security:
  1339. - OAuth2: []
  1340. tags:
  1341. - Video Channel
  1342. parameters:
  1343. - $ref: '#/components/parameters/channelHandle'
  1344. responses:
  1345. '204':
  1346. $ref: '#/paths/~1users~1me/put/responses/204'
  1347. '/video-channels/{channelHandle}/videos':
  1348. get:
  1349. summary: Get videos of a video channel by its id
  1350. tags:
  1351. - Video
  1352. - Video Channel
  1353. parameters:
  1354. - $ref: '#/components/parameters/channelHandle'
  1355. responses:
  1356. '200':
  1357. description: successful operation
  1358. content:
  1359. application/json:
  1360. schema:
  1361. $ref: '#/components/schemas/VideoListResponse'
  1362. '/accounts/{name}/video-channels':
  1363. get:
  1364. summary: Get video channels of an account by its name
  1365. tags:
  1366. - Video Channel
  1367. parameters:
  1368. - $ref: '#/components/parameters/name'
  1369. responses:
  1370. '200':
  1371. description: successful operation
  1372. content:
  1373. application/json:
  1374. schema:
  1375. type: array
  1376. items:
  1377. $ref: '#/components/schemas/VideoChannel'
  1378. '/accounts/{name}/ratings':
  1379. get:
  1380. summary: Get ratings of an account by its name
  1381. security:
  1382. - OAuth2: []
  1383. tags:
  1384. - User
  1385. parameters:
  1386. - $ref: '#/components/parameters/start'
  1387. - $ref: '#/components/parameters/count'
  1388. - $ref: '#/components/parameters/sort'
  1389. - name: rating
  1390. in: query
  1391. required: false
  1392. description: Optionaly filter which ratings to retrieve
  1393. schema:
  1394. type: string
  1395. enum:
  1396. - like
  1397. - dislike
  1398. responses:
  1399. '200':
  1400. description: successful operation
  1401. content:
  1402. application/json:
  1403. schema:
  1404. type: array
  1405. items:
  1406. $ref: '#/components/schemas/VideoRating'
  1407. '/videos/{id}/comment-threads':
  1408. get:
  1409. summary: Get the comment threads of a video by its id
  1410. tags:
  1411. - Video Comment
  1412. parameters:
  1413. - $ref: '#/components/parameters/id2'
  1414. - $ref: '#/components/parameters/start'
  1415. - $ref: '#/components/parameters/count'
  1416. - $ref: '#/components/parameters/sort'
  1417. responses:
  1418. '200':
  1419. description: successful operation
  1420. content:
  1421. application/json:
  1422. schema:
  1423. $ref: '#/components/schemas/CommentThreadResponse'
  1424. post:
  1425. summary: 'Creates a comment thread, on a video by its id'
  1426. security:
  1427. - OAuth2: []
  1428. tags:
  1429. - Video Comment
  1430. parameters:
  1431. - $ref: '#/components/parameters/id2'
  1432. responses:
  1433. '200':
  1434. description: successful operation
  1435. content:
  1436. application/json:
  1437. schema:
  1438. $ref: '#/components/schemas/CommentThreadPostResponse'
  1439. '/videos/{id}/comment-threads/{threadId}':
  1440. get:
  1441. summary: 'Get the comment thread by its id, of a video by its id'
  1442. tags:
  1443. - Video Comment
  1444. parameters:
  1445. - $ref: '#/components/parameters/id2'
  1446. - name: threadId
  1447. in: path
  1448. required: true
  1449. description: The thread id (root comment id)
  1450. schema:
  1451. type: number
  1452. responses:
  1453. '200':
  1454. description: successful operation
  1455. content:
  1456. application/json:
  1457. schema:
  1458. $ref: '#/components/schemas/VideoCommentThreadTree'
  1459. '/videos/{id}/comments/{commentId}':
  1460. post:
  1461. summary: 'Creates a comment in a comment thread by its id, of a video by its id'
  1462. security:
  1463. - OAuth2: []
  1464. tags:
  1465. - Video Comment
  1466. parameters:
  1467. - $ref: '#/components/parameters/id2'
  1468. - $ref: '#/components/parameters/commentId'
  1469. responses:
  1470. '200':
  1471. description: successful operation
  1472. content:
  1473. application/json:
  1474. schema:
  1475. $ref: '#/components/schemas/CommentThreadPostResponse'
  1476. delete:
  1477. summary: 'Delete a comment in a comment thread by its id, of a video by its id'
  1478. security:
  1479. - OAuth2: []
  1480. tags:
  1481. - Video Comment
  1482. parameters:
  1483. - $ref: '#/components/parameters/id2'
  1484. - $ref: '#/components/parameters/commentId'
  1485. responses:
  1486. '204':
  1487. $ref: '#/paths/~1users~1me/put/responses/204'
  1488. '/videos/{id}/rate':
  1489. put:
  1490. summary: Vote for a video by its id
  1491. security:
  1492. - OAuth2: []
  1493. tags:
  1494. - Video Rate
  1495. parameters:
  1496. - $ref: '#/components/parameters/id2'
  1497. responses:
  1498. '204':
  1499. $ref: '#/paths/~1users~1me/put/responses/204'
  1500. /search/videos:
  1501. get:
  1502. tags:
  1503. - Search
  1504. summary: Get the videos corresponding to a given query
  1505. parameters:
  1506. - $ref: '#/components/parameters/start'
  1507. - $ref: '#/components/parameters/count'
  1508. - $ref: '#/components/parameters/videosSearchSort'
  1509. - name: search
  1510. in: query
  1511. required: true
  1512. description: String to search
  1513. schema:
  1514. type: string
  1515. responses:
  1516. '200':
  1517. description: successful operation
  1518. content:
  1519. application/json:
  1520. schema:
  1521. $ref: '#/components/schemas/VideoListResponse'
  1522. servers:
  1523. - url: 'https://peertube.cpy.re/api/v1'
  1524. description: Live Test Server (live data - stable version)
  1525. - url: 'https://peertube2.cpy.re/api/v1'
  1526. description: Live Test Server (live data - bleeding edge version)
  1527. - url: 'https://peertube3.cpy.re/api/v1'
  1528. description: Live Test Server (live data - bleeding edge version)
  1529. components:
  1530. parameters:
  1531. start:
  1532. name: start
  1533. in: query
  1534. required: false
  1535. description: Offset
  1536. schema:
  1537. type: number
  1538. count:
  1539. name: count
  1540. in: query
  1541. required: false
  1542. description: Number of items
  1543. schema:
  1544. type: number
  1545. sort:
  1546. name: sort
  1547. in: query
  1548. required: false
  1549. description: Sort column (-createdAt for example)
  1550. schema:
  1551. type: string
  1552. videosSort:
  1553. name: sort
  1554. in: query
  1555. required: false
  1556. description: Sort videos by criteria
  1557. schema:
  1558. type: string
  1559. enum:
  1560. - -name
  1561. - -duration
  1562. - -createdAt
  1563. - -publishedAt
  1564. - -views
  1565. - -likes
  1566. - -trending
  1567. videosSearchSort:
  1568. name: sort
  1569. in: query
  1570. required: false
  1571. description: Sort videos by criteria
  1572. schema:
  1573. type: string
  1574. enum:
  1575. - -name
  1576. - -duration
  1577. - -createdAt
  1578. - -publishedAt
  1579. - -views
  1580. - -likes
  1581. - -match
  1582. blacklistsSort:
  1583. name: sort
  1584. in: query
  1585. required: false
  1586. description: Sort blacklists by criteria
  1587. schema:
  1588. type: string
  1589. enum:
  1590. - -id
  1591. - -name
  1592. - -duration
  1593. - -views
  1594. - -likes
  1595. - -dislikes
  1596. - -uuid
  1597. - -createdAt
  1598. usersSort:
  1599. name: sort
  1600. in: query
  1601. required: false
  1602. description: Sort users by criteria
  1603. schema:
  1604. type: string
  1605. enum:
  1606. - -id
  1607. - -username
  1608. - -createdAt
  1609. abusesSort:
  1610. name: sort
  1611. in: query
  1612. required: false
  1613. description: Sort abuses by criteria
  1614. schema:
  1615. type: string
  1616. enum:
  1617. - -id
  1618. - -createdAt
  1619. - -state
  1620. name:
  1621. name: name
  1622. in: path
  1623. required: true
  1624. description: >-
  1625. The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for
  1626. example)
  1627. schema:
  1628. type: string
  1629. id:
  1630. name: id
  1631. in: path
  1632. required: true
  1633. description: The user id
  1634. schema:
  1635. type: number
  1636. id2:
  1637. name: id
  1638. in: path
  1639. required: true
  1640. description: The video id or uuid
  1641. schema:
  1642. type: string
  1643. captionLanguage:
  1644. name: captionLanguage
  1645. in: path
  1646. required: true
  1647. description: The caption language
  1648. schema:
  1649. type: string
  1650. channelHandle:
  1651. name: channelHandle
  1652. in: path
  1653. required: true
  1654. description: "The video channel handle (example: 'my_username@example.com' or 'my_username')"
  1655. schema:
  1656. type: string
  1657. commentId:
  1658. name: threadId
  1659. in: path
  1660. required: true
  1661. description: The comment id
  1662. schema:
  1663. type: number
  1664. categoryOneOf:
  1665. name: categoryOneOf
  1666. in: query
  1667. required: false
  1668. description: category id of the video
  1669. schema:
  1670. oneOf:
  1671. - type: number
  1672. - type: array
  1673. items:
  1674. type: number
  1675. style: form
  1676. explode: false
  1677. tagsOneOf:
  1678. name: tagsOneOf
  1679. in: query
  1680. required: false
  1681. description: tag(s) of the video
  1682. schema:
  1683. oneOf:
  1684. - type: string
  1685. - type: array
  1686. items:
  1687. type: string
  1688. style: form
  1689. explode: false
  1690. tagsAllOf:
  1691. name: tagsAllOf
  1692. in: query
  1693. required: false
  1694. description: tag(s) of the video, where all should be present in the video
  1695. schema:
  1696. oneOf:
  1697. - type: string
  1698. - type: array
  1699. items:
  1700. type: string
  1701. style: form
  1702. explode: false
  1703. languageOneOf:
  1704. name: languageOneOf
  1705. in: query
  1706. required: false
  1707. description: language id of the video
  1708. schema:
  1709. oneOf:
  1710. - type: string
  1711. - type: array
  1712. items:
  1713. type: string
  1714. style: form
  1715. explode: false
  1716. licenceOneOf:
  1717. name: licenceOneOf
  1718. in: query
  1719. required: false
  1720. description: licence id of the video
  1721. schema:
  1722. oneOf:
  1723. - type: number
  1724. - type: array
  1725. items:
  1726. type: number
  1727. style: form
  1728. explode: false
  1729. nsfw:
  1730. name: nsfw
  1731. in: query
  1732. required: false
  1733. description: whether to include nsfw videos, if any
  1734. schema:
  1735. type: string
  1736. enum:
  1737. - 'true'
  1738. - 'false'
  1739. filter:
  1740. name: filter
  1741. in: query
  1742. required: false
  1743. description: >
  1744. Special filters (local for instance) which might require special rights:
  1745. * `local` - only videos local to the instance
  1746. * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges)
  1747. schema:
  1748. type: string
  1749. enum:
  1750. - local
  1751. - all-local
  1752. subscriptionsUris:
  1753. name: uris
  1754. in: query
  1755. required: true
  1756. description: list of uris to check if each is part of the user subscriptions
  1757. schema:
  1758. type: array
  1759. items:
  1760. type: string
  1761. securitySchemes:
  1762. OAuth2:
  1763. description: >
  1764. In the header: *Authorization: Bearer <token\>*
  1765. Authenticating via OAuth requires the following steps:
  1766. - Have an account with sufficient authorization levels
  1767. - [Generate](https://docs.joinpeertube.org/#/api-rest-getting-started) a
  1768. Bearer Token
  1769. - Make Authenticated Requests
  1770. type: oauth2
  1771. flows:
  1772. password:
  1773. tokenUrl: 'https://peertube.example.com/api/v1/users/token'
  1774. scopes:
  1775. admin: Admin scope
  1776. moderator: Moderator scope
  1777. user: User scope
  1778. schemas:
  1779. VideoConstantNumber:
  1780. properties:
  1781. id:
  1782. type: number
  1783. label:
  1784. type: string
  1785. VideoConstantString:
  1786. properties:
  1787. id:
  1788. type: string
  1789. label:
  1790. type: string
  1791. VideoPrivacySet:
  1792. type: integer
  1793. enum:
  1794. - 1
  1795. - 2
  1796. - 3
  1797. description: 'The video privacy (Public = 1, Unlisted = 2, Private = 3)'
  1798. VideoPrivacyConstant:
  1799. properties:
  1800. id:
  1801. type: integer
  1802. enum:
  1803. - 1
  1804. - 2
  1805. - 3
  1806. label:
  1807. type: string
  1808. VideoStateConstant:
  1809. properties:
  1810. id:
  1811. type: integer
  1812. enum:
  1813. - 1
  1814. - 2
  1815. - 3
  1816. description: 'The video state (Published = 1, to transcode = 2, to import = 3)'
  1817. label:
  1818. type: string
  1819. VideoResolutionConstant:
  1820. properties:
  1821. id:
  1822. type: integer
  1823. description: 'Video resolution (240, 360, 720 ...)'
  1824. label:
  1825. type: string
  1826. VideoScheduledUpdate:
  1827. properties:
  1828. privacy:
  1829. $ref: '#/components/schemas/VideoPrivacySet'
  1830. description: Video privacy target
  1831. updateAt:
  1832. type: string
  1833. format: date
  1834. description: When to update the video
  1835. required:
  1836. - updateAt
  1837. VideoAccountSummary:
  1838. properties:
  1839. id:
  1840. type: number
  1841. name:
  1842. type: string
  1843. displayName:
  1844. type: string
  1845. url:
  1846. type: string
  1847. host:
  1848. type: string
  1849. avatar:
  1850. nullable: true
  1851. $ref: '#/components/schemas/Avatar'
  1852. VideoChannelSummary:
  1853. properties:
  1854. id:
  1855. type: number
  1856. name:
  1857. type: string
  1858. displayName:
  1859. type: string
  1860. url:
  1861. type: string
  1862. host:
  1863. type: string
  1864. avatar:
  1865. nullable: true
  1866. $ref: '#/components/schemas/Avatar'
  1867. PlaylistElement:
  1868. properties:
  1869. position:
  1870. type: number
  1871. startTimestamp:
  1872. type: number
  1873. stopTimestamp:
  1874. type: number
  1875. VideoFile:
  1876. properties:
  1877. magnetUri:
  1878. type: string
  1879. resolution:
  1880. $ref: '#/components/schemas/VideoResolutionConstant'
  1881. size:
  1882. type: number
  1883. description: 'Video file size in bytes'
  1884. torrentUrl:
  1885. type: string
  1886. torrentDownaloadUrl:
  1887. type: string
  1888. fileUrl:
  1889. type: string
  1890. fileDownloadUrl:
  1891. type: string
  1892. fps:
  1893. type: number
  1894. VideoStreamingPlaylists:
  1895. properties:
  1896. id:
  1897. type: number
  1898. type:
  1899. type: number
  1900. enum:
  1901. - 1
  1902. description: 'Playlist type (HLS = 1)'
  1903. playlistUrl:
  1904. type: string
  1905. segmentsSha256Url:
  1906. type: string
  1907. redundancies:
  1908. type: array
  1909. items:
  1910. type: object
  1911. properties:
  1912. baseUrl:
  1913. type: string
  1914. Video:
  1915. properties:
  1916. id:
  1917. type: number
  1918. uuid:
  1919. type: string
  1920. createdAt:
  1921. type: string
  1922. publishedAt:
  1923. type: string
  1924. updatedAt:
  1925. type: string
  1926. originallyPublishedAt:
  1927. type: string
  1928. category:
  1929. $ref: '#/components/schemas/VideoConstantNumber'
  1930. licence:
  1931. $ref: '#/components/schemas/VideoConstantNumber'
  1932. language:
  1933. $ref: '#/components/schemas/VideoConstantString'
  1934. privacy:
  1935. $ref: '#/components/schemas/VideoPrivacyConstant'
  1936. description:
  1937. type: string
  1938. duration:
  1939. type: number
  1940. isLocal:
  1941. type: boolean
  1942. name:
  1943. type: string
  1944. thumbnailPath:
  1945. type: string
  1946. previewPath:
  1947. type: string
  1948. embedPath:
  1949. type: string
  1950. views:
  1951. type: number
  1952. likes:
  1953. type: number
  1954. dislikes:
  1955. type: number
  1956. nsfw:
  1957. type: boolean
  1958. waitTranscoding:
  1959. type: boolean
  1960. nullable: true
  1961. state:
  1962. $ref: '#/components/schemas/VideoStateConstant'
  1963. scheduledUpdate:
  1964. nullable: true
  1965. $ref: '#/components/schemas/VideoScheduledUpdate'
  1966. blacklisted:
  1967. nullable: true
  1968. type: boolean
  1969. blacklistedReason:
  1970. nullable: true
  1971. type: string
  1972. account:
  1973. $ref: '#/components/schemas/VideoAccountSummary'
  1974. channel:
  1975. $ref: '#/components/schemas/VideoChannelSummary'
  1976. userHistory:
  1977. nullable: true
  1978. type: object
  1979. properties:
  1980. currentTime:
  1981. type: number
  1982. playlistElement:
  1983. nullable: true
  1984. $ref: '#/components/schemas/PlaylistElement'
  1985. VideoDetails:
  1986. allOf:
  1987. - $ref: '#/components/schemas/Video'
  1988. - type: object
  1989. properties:
  1990. descriptionPath:
  1991. type: string
  1992. support:
  1993. type: string
  1994. channel:
  1995. $ref: '#/components/schemas/VideoChannel'
  1996. account:
  1997. $ref: '#/components/schemas/Account'
  1998. tags:
  1999. type: array
  2000. items:
  2001. type: string
  2002. files:
  2003. type: array
  2004. items:
  2005. $ref: '#/components/schemas/VideoFile'
  2006. commentsEnabled:
  2007. type: boolean
  2008. downloadEnabled:
  2009. type: boolean
  2010. trackerUrls:
  2011. type: array
  2012. items:
  2013. type: string
  2014. streamingPlaylists:
  2015. type: array
  2016. items:
  2017. $ref: '#/components/schemas/VideoStreamingPlaylists'
  2018. VideoAbuse:
  2019. properties:
  2020. id:
  2021. type: number
  2022. reason:
  2023. type: string
  2024. reporterAccount:
  2025. $ref: '#/components/schemas/Account'
  2026. video:
  2027. type: object
  2028. properties:
  2029. id:
  2030. type: number
  2031. name:
  2032. type: string
  2033. uuid:
  2034. type: string
  2035. url:
  2036. type: string
  2037. createdAt:
  2038. type: string
  2039. VideoBlacklist:
  2040. properties:
  2041. id:
  2042. type: number
  2043. videoId:
  2044. type: number
  2045. createdAt:
  2046. type: string
  2047. updatedAt:
  2048. type: string
  2049. name:
  2050. type: string
  2051. uuid:
  2052. type: string
  2053. description:
  2054. type: string
  2055. duration:
  2056. type: number
  2057. views:
  2058. type: number
  2059. likes:
  2060. type: number
  2061. dislikes:
  2062. type: number
  2063. nsfw:
  2064. type: boolean
  2065. VideoChannel:
  2066. properties:
  2067. displayName:
  2068. type: string
  2069. description:
  2070. type: string
  2071. isLocal:
  2072. type: boolean
  2073. ownerAccount:
  2074. type: object
  2075. properties:
  2076. id:
  2077. type: number
  2078. uuid:
  2079. type: string
  2080. VideoComment:
  2081. properties:
  2082. id:
  2083. type: number
  2084. url:
  2085. type: string
  2086. text:
  2087. type: string
  2088. threadId:
  2089. type: number
  2090. inReplyToCommentId:
  2091. type: number
  2092. videoId:
  2093. type: number
  2094. createdAt:
  2095. type: string
  2096. updatedAt:
  2097. type: string
  2098. totalReplies:
  2099. type: number
  2100. account:
  2101. $ref: '#/components/schemas/Account'
  2102. VideoCommentThreadTree:
  2103. properties:
  2104. comment:
  2105. $ref: '#/components/schemas/VideoComment'
  2106. children:
  2107. type: array
  2108. items:
  2109. $ref: '#/components/schemas/VideoCommentThreadTree'
  2110. VideoCaption:
  2111. properties:
  2112. language:
  2113. $ref: '#/components/schemas/VideoConstantString'
  2114. captionPath:
  2115. type: string
  2116. Avatar:
  2117. properties:
  2118. path:
  2119. type: string
  2120. createdAt:
  2121. type: string
  2122. updatedAt:
  2123. type: string
  2124. Actor:
  2125. properties:
  2126. id:
  2127. type: number
  2128. uuid:
  2129. type: string
  2130. url:
  2131. type: string
  2132. name:
  2133. type: string
  2134. host:
  2135. type: string
  2136. followingCount:
  2137. type: number
  2138. followersCount:
  2139. type: number
  2140. createdAt:
  2141. type: string
  2142. updatedAt:
  2143. type: string
  2144. avatar:
  2145. $ref: '#/components/schemas/Avatar'
  2146. Account:
  2147. allOf:
  2148. - $ref: '#/components/schemas/Actor'
  2149. - properties:
  2150. displayName:
  2151. type: string
  2152. User:
  2153. properties:
  2154. id:
  2155. type: number
  2156. username:
  2157. type: string
  2158. email:
  2159. type: string
  2160. displayNSFW:
  2161. type: boolean
  2162. autoPlayVideo:
  2163. type: boolean
  2164. role:
  2165. type: integer
  2166. enum:
  2167. - 0
  2168. - 1
  2169. - 2
  2170. description: 'The user role (Admin = 0, Moderator = 1, User = 2)'
  2171. roleLabel:
  2172. type: string
  2173. enum:
  2174. - User
  2175. - Moderator
  2176. - Administrator
  2177. videoQuota:
  2178. type: number
  2179. videoQuotaDaily:
  2180. type: number
  2181. createdAt:
  2182. type: string
  2183. account:
  2184. $ref: '#/components/schemas/Account'
  2185. videoChannels:
  2186. type: array
  2187. items:
  2188. $ref: '#/components/schemas/VideoChannel'
  2189. UserWatchingVideo:
  2190. properties:
  2191. currentTime:
  2192. type: number
  2193. ServerConfig:
  2194. properties:
  2195. signup:
  2196. type: object
  2197. properties:
  2198. allowed:
  2199. type: boolean
  2200. transcoding:
  2201. type: object
  2202. properties:
  2203. enabledResolutions:
  2204. type: array
  2205. items:
  2206. type: number
  2207. avatar:
  2208. type: object
  2209. properties:
  2210. file:
  2211. type: object
  2212. properties:
  2213. size:
  2214. type: object
  2215. properties:
  2216. max:
  2217. type: number
  2218. extensions:
  2219. type: array
  2220. items:
  2221. type: string
  2222. video:
  2223. type: object
  2224. properties:
  2225. file:
  2226. type: object
  2227. properties:
  2228. extensions:
  2229. type: array
  2230. items:
  2231. type: string
  2232. Follow:
  2233. properties:
  2234. id:
  2235. type: number
  2236. follower:
  2237. $ref: '#/components/schemas/Actor'
  2238. following:
  2239. $ref: '#/components/schemas/Actor'
  2240. score:
  2241. type: number
  2242. state:
  2243. type: string
  2244. enum:
  2245. - pending
  2246. - accepted
  2247. createdAt:
  2248. type: string
  2249. updatedAt:
  2250. type: string
  2251. Job:
  2252. properties:
  2253. id:
  2254. type: number
  2255. state:
  2256. type: string
  2257. enum:
  2258. - pending
  2259. - processing
  2260. - error
  2261. - success
  2262. category:
  2263. type: string
  2264. enum:
  2265. - transcoding
  2266. - activitypub-http
  2267. handlerName:
  2268. type: string
  2269. handlerInputData:
  2270. type: string
  2271. createdAt:
  2272. type: string
  2273. updatedAt:
  2274. type: string
  2275. AddUserResponse:
  2276. properties:
  2277. id:
  2278. type: number
  2279. uuid:
  2280. type: string
  2281. VideoUploadResponse:
  2282. properties:
  2283. video:
  2284. type: object
  2285. properties:
  2286. id:
  2287. type: number
  2288. uuid:
  2289. type: string
  2290. CommentThreadResponse:
  2291. properties:
  2292. total:
  2293. type: number
  2294. data:
  2295. type: array
  2296. items:
  2297. $ref: '#/components/schemas/VideoComment'
  2298. CommentThreadPostResponse:
  2299. properties:
  2300. comment:
  2301. $ref: '#/components/schemas/VideoComment'
  2302. VideoListResponse:
  2303. properties:
  2304. total:
  2305. type: number
  2306. data:
  2307. type: array
  2308. items:
  2309. $ref: '#/components/schemas/Video'
  2310. AddUser:
  2311. properties:
  2312. username:
  2313. type: string
  2314. description: 'The user username '
  2315. password:
  2316. type: string
  2317. description: 'The user password '
  2318. email:
  2319. type: string
  2320. description: 'The user email '
  2321. videoQuota:
  2322. type: string
  2323. description: 'The user videoQuota '
  2324. videoQuotaDaily:
  2325. type: string
  2326. description: 'The user daily video quota '
  2327. role:
  2328. type: integer
  2329. enum:
  2330. - 0
  2331. - 1
  2332. - 2
  2333. description: 'The user role (Admin = 0, Moderator = 1, User = 2)'
  2334. required:
  2335. - username
  2336. - password
  2337. - email
  2338. - videoQuota
  2339. - videoQuotaDaily
  2340. - role
  2341. UpdateUser:
  2342. properties:
  2343. id:
  2344. type: string
  2345. description: 'The user id '
  2346. email:
  2347. type: string
  2348. description: 'The updated email of the user '
  2349. videoQuota:
  2350. type: string
  2351. description: 'The updated videoQuota of the user '
  2352. videoQuotaDaily:
  2353. type: string
  2354. description: 'The updated daily video quota of the user '
  2355. role:
  2356. type: integer
  2357. enum:
  2358. - 0
  2359. - 1
  2360. - 2
  2361. description: 'The user role (Admin = 0, Moderator = 1, User = 2)'
  2362. required:
  2363. - id
  2364. - email
  2365. - videoQuota
  2366. - videoQuotaDaily
  2367. - role
  2368. UpdateMe:
  2369. properties:
  2370. password:
  2371. type: string
  2372. description: 'Your new password '
  2373. email:
  2374. type: string
  2375. description: 'Your new email '
  2376. displayNSFW:
  2377. type: string
  2378. description: 'Your new displayNSFW '
  2379. autoPlayVideo:
  2380. type: string
  2381. description: 'Your new autoPlayVideo '
  2382. required:
  2383. - password
  2384. - email
  2385. - displayNSFW
  2386. - autoPlayVideo
  2387. GetMeVideoRating:
  2388. properties:
  2389. id:
  2390. type: string
  2391. description: 'Id of the video '
  2392. rating:
  2393. type: number
  2394. description: 'Rating of the video '
  2395. required:
  2396. - id
  2397. - rating
  2398. VideoRating:
  2399. properties:
  2400. video:
  2401. $ref: '#/components/schemas/Video'
  2402. rating:
  2403. type: number
  2404. description: 'Rating of the video'
  2405. required:
  2406. - video
  2407. - rating
  2408. RegisterUser:
  2409. properties:
  2410. username:
  2411. type: string
  2412. description: 'The username of the user '
  2413. password:
  2414. type: string
  2415. description: 'The password of the user '
  2416. email:
  2417. type: string
  2418. description: 'The email of the user '
  2419. displayName:
  2420. type: string
  2421. description: 'The user display name'
  2422. channel:
  2423. type: object
  2424. properties:
  2425. name:
  2426. type: string
  2427. description: 'The default channel name'
  2428. displayName:
  2429. type: string
  2430. description: 'The default channel display name'
  2431. required:
  2432. - username
  2433. - password
  2434. - email
  2435. VideoChannelCreate:
  2436. properties:
  2437. name:
  2438. type: string
  2439. displayName:
  2440. type: string
  2441. description:
  2442. type: string
  2443. support:
  2444. type: string
  2445. required:
  2446. - name
  2447. - displayName
  2448. VideoChannelUpdate:
  2449. properties:
  2450. displayName:
  2451. type: string
  2452. description:
  2453. type: string
  2454. support:
  2455. type: string
  2456. bulkVideosSupportUpdate:
  2457. type: boolean
  2458. description: 'Update all videos support field of this channel'