openapi.yaml 94 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830
  1. openapi: 3.0.3
  2. tags:
  3. - name: healthcheck
  4. - name: token
  5. - name: maintenance
  6. - name: admins
  7. - name: connections
  8. - name: defender
  9. - name: quota
  10. - name: folders
  11. - name: users
  12. - name: users API
  13. info:
  14. title: SFTPGo
  15. description: |
  16. SFTPGo allows to securely share your files over SFTP and optionally FTP/S and WebDAV too.
  17. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one.
  18. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one.
  19. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user.
  20. version: 2.1.0
  21. contact:
  22. name: API support
  23. url: 'https://github.com/drakkan/sftpgo'
  24. license:
  25. name: AGPLv3
  26. url: 'https://www.gnu.org/licenses/agpl-3.0.en.html'
  27. servers:
  28. - url: /api/v2
  29. security:
  30. - BearerAuth: []
  31. paths:
  32. /healthz:
  33. get:
  34. security: []
  35. servers:
  36. - url: /
  37. tags:
  38. - healthcheck
  39. summary: health check
  40. description: This endpoint can be used to check if the application is running and responding to requests
  41. operationId: healthz
  42. responses:
  43. '200':
  44. description: successful operation
  45. content:
  46. text/plain:
  47. schema:
  48. type: string
  49. example: ok
  50. /token:
  51. get:
  52. security:
  53. - BasicAuth: []
  54. tags:
  55. - token
  56. summary: Get a new admin access token
  57. description: Returns an access token and its expiration
  58. operationId: get_token
  59. responses:
  60. '200':
  61. description: successful operation
  62. content:
  63. application/json:
  64. schema:
  65. $ref: '#/components/schemas/Token'
  66. '401':
  67. $ref: '#/components/responses/Unauthorized'
  68. '403':
  69. $ref: '#/components/responses/Forbidden'
  70. '500':
  71. $ref: '#/components/responses/InternalServerError'
  72. default:
  73. $ref: '#/components/responses/DefaultResponse'
  74. /logout:
  75. get:
  76. tags:
  77. - token
  78. summary: Invalidate an admin access token
  79. description: Allows to invalidate an admin token before its expiration
  80. operationId: logout
  81. responses:
  82. '200':
  83. description: successful operation
  84. content:
  85. application/json:
  86. schema:
  87. $ref: '#/components/schemas/ApiResponse'
  88. '401':
  89. $ref: '#/components/responses/Unauthorized'
  90. '403':
  91. $ref: '#/components/responses/Forbidden'
  92. '500':
  93. $ref: '#/components/responses/InternalServerError'
  94. default:
  95. $ref: '#/components/responses/DefaultResponse'
  96. /user/token:
  97. get:
  98. security:
  99. - BasicAuth: []
  100. tags:
  101. - token
  102. summary: Get a new user access token
  103. description: Returns an access token and its expiration
  104. operationId: get_user_token
  105. responses:
  106. '200':
  107. description: successful operation
  108. content:
  109. application/json:
  110. schema:
  111. $ref: '#/components/schemas/Token'
  112. '401':
  113. $ref: '#/components/responses/Unauthorized'
  114. '403':
  115. $ref: '#/components/responses/Forbidden'
  116. '500':
  117. $ref: '#/components/responses/InternalServerError'
  118. default:
  119. $ref: '#/components/responses/DefaultResponse'
  120. /user/logout:
  121. get:
  122. tags:
  123. - token
  124. summary: Invalidate a user access token
  125. description: Allows to invalidate a client token before its expiration
  126. operationId: client_logout
  127. responses:
  128. '200':
  129. description: successful operation
  130. content:
  131. application/json:
  132. schema:
  133. $ref: '#/components/schemas/ApiResponse'
  134. '401':
  135. $ref: '#/components/responses/Unauthorized'
  136. '403':
  137. $ref: '#/components/responses/Forbidden'
  138. '500':
  139. $ref: '#/components/responses/InternalServerError'
  140. default:
  141. $ref: '#/components/responses/DefaultResponse'
  142. /version:
  143. get:
  144. tags:
  145. - maintenance
  146. summary: Get version details
  147. description: 'Returns version details such as the version number, build date, commit hash and enabled features'
  148. operationId: get_version
  149. responses:
  150. '200':
  151. description: successful operation
  152. content:
  153. application/json:
  154. schema:
  155. $ref: '#/components/schemas/VersionInfo'
  156. '401':
  157. $ref: '#/components/responses/Unauthorized'
  158. '403':
  159. $ref: '#/components/responses/Forbidden'
  160. '500':
  161. $ref: '#/components/responses/InternalServerError'
  162. default:
  163. $ref: '#/components/responses/DefaultResponse'
  164. /changepwd/admin:
  165. put:
  166. tags:
  167. - admins
  168. summary: Change admin password
  169. description: Changes the password for the logged in admin. Please use '/admin/changepwd' instead
  170. operationId: change_admin_password_deprecated
  171. deprecated: true
  172. requestBody:
  173. required: true
  174. content:
  175. application/json:
  176. schema:
  177. $ref: '#/components/schemas/PwdChange'
  178. responses:
  179. '200':
  180. description: successful operation
  181. content:
  182. application/json:
  183. schema:
  184. $ref: '#/components/schemas/ApiResponse'
  185. '401':
  186. $ref: '#/components/responses/Unauthorized'
  187. '403':
  188. $ref: '#/components/responses/Forbidden'
  189. '500':
  190. $ref: '#/components/responses/InternalServerError'
  191. default:
  192. $ref: '#/components/responses/DefaultResponse'
  193. /admin/changepwd:
  194. put:
  195. tags:
  196. - admins
  197. summary: Change admin password
  198. description: Changes the password for the logged in admin
  199. operationId: change_admin_password
  200. requestBody:
  201. required: true
  202. content:
  203. application/json:
  204. schema:
  205. $ref: '#/components/schemas/PwdChange'
  206. responses:
  207. '200':
  208. description: successful operation
  209. content:
  210. application/json:
  211. schema:
  212. $ref: '#/components/schemas/ApiResponse'
  213. '401':
  214. $ref: '#/components/responses/Unauthorized'
  215. '403':
  216. $ref: '#/components/responses/Forbidden'
  217. '500':
  218. $ref: '#/components/responses/InternalServerError'
  219. default:
  220. $ref: '#/components/responses/DefaultResponse'
  221. /connections:
  222. get:
  223. tags:
  224. - connections
  225. summary: Get connections details
  226. description: Returns the active users and info about their current uploads/downloads
  227. operationId: get_connections
  228. responses:
  229. '200':
  230. description: successful operation
  231. content:
  232. application/json:
  233. schema:
  234. type: array
  235. items:
  236. $ref: '#/components/schemas/ConnectionStatus'
  237. '401':
  238. $ref: '#/components/responses/Unauthorized'
  239. '403':
  240. $ref: '#/components/responses/Forbidden'
  241. '500':
  242. $ref: '#/components/responses/InternalServerError'
  243. default:
  244. $ref: '#/components/responses/DefaultResponse'
  245. '/connections/{connectionID}':
  246. delete:
  247. tags:
  248. - connections
  249. summary: Close connection
  250. description: Terminates an active connection
  251. operationId: close_connection
  252. parameters:
  253. - name: connectionID
  254. in: path
  255. description: ID of the connection to close
  256. required: true
  257. schema:
  258. type: string
  259. responses:
  260. '200':
  261. description: successful operation
  262. content:
  263. application/json:
  264. schema:
  265. $ref: '#/components/schemas/ApiResponse'
  266. example:
  267. message: Connection closed
  268. '401':
  269. $ref: '#/components/responses/Unauthorized'
  270. '403':
  271. $ref: '#/components/responses/Forbidden'
  272. '404':
  273. $ref: '#/components/responses/NotFound'
  274. '500':
  275. $ref: '#/components/responses/InternalServerError'
  276. default:
  277. $ref: '#/components/responses/DefaultResponse'
  278. /defender/hosts:
  279. get:
  280. tags:
  281. - defender
  282. summary: Get hosts
  283. description: Returns hosts that are banned or for which some violations have been detected
  284. operationId: get_defender_hosts
  285. responses:
  286. '200':
  287. description: successful operation
  288. content:
  289. application/json:
  290. schema:
  291. type: array
  292. items:
  293. $ref: '#/components/schemas/DefenderEntry'
  294. '401':
  295. $ref: '#/components/responses/Unauthorized'
  296. '403':
  297. $ref: '#/components/responses/Forbidden'
  298. '404':
  299. $ref: '#/components/responses/NotFound'
  300. '500':
  301. $ref: '#/components/responses/InternalServerError'
  302. default:
  303. $ref: '#/components/responses/DefaultResponse'
  304. /defender/hosts/{id}:
  305. parameters:
  306. - name: id
  307. in: path
  308. description: host id
  309. required: true
  310. schema:
  311. type: string
  312. get:
  313. tags:
  314. - defender
  315. summary: Get host by id
  316. description: Returns the host with the given id, if it exists
  317. operationId: get_defender_host_by_id
  318. responses:
  319. '200':
  320. description: successful operation
  321. content:
  322. application/json:
  323. schema:
  324. $ref: '#/components/schemas/DefenderEntry'
  325. '401':
  326. $ref: '#/components/responses/Unauthorized'
  327. '403':
  328. $ref: '#/components/responses/Forbidden'
  329. '404':
  330. $ref: '#/components/responses/NotFound'
  331. '500':
  332. $ref: '#/components/responses/InternalServerError'
  333. default:
  334. $ref: '#/components/responses/DefaultResponse'
  335. delete:
  336. tags:
  337. - defender
  338. summary: Removes a host from the defender lists
  339. description: Unbans the specified host or clears its violations
  340. operationId: delete_defender_host_by_id
  341. responses:
  342. '200':
  343. description: successful operation
  344. content:
  345. application/json:
  346. schema:
  347. $ref: '#/components/schemas/ApiResponse'
  348. '401':
  349. $ref: '#/components/responses/Unauthorized'
  350. '403':
  351. $ref: '#/components/responses/Forbidden'
  352. '404':
  353. $ref: '#/components/responses/NotFound'
  354. '500':
  355. $ref: '#/components/responses/InternalServerError'
  356. default:
  357. $ref: '#/components/responses/DefaultResponse'
  358. /defender/bantime:
  359. get:
  360. deprecated: true
  361. tags:
  362. - defender
  363. summary: Get ban time
  364. description: Deprecated, please use '/defender/hosts', '/defender/hosts/{id}' instead
  365. operationId: get_ban_time
  366. parameters:
  367. - in: query
  368. name: ip
  369. required: true
  370. description: IPv4/IPv6 address
  371. schema:
  372. type: string
  373. responses:
  374. '200':
  375. description: successful operation
  376. content:
  377. application/json:
  378. schema:
  379. $ref: '#/components/schemas/BanStatus'
  380. '401':
  381. $ref: '#/components/responses/Unauthorized'
  382. '403':
  383. $ref: '#/components/responses/Forbidden'
  384. '404':
  385. $ref: '#/components/responses/NotFound'
  386. '500':
  387. $ref: '#/components/responses/InternalServerError'
  388. default:
  389. $ref: '#/components/responses/DefaultResponse'
  390. /defender/unban:
  391. post:
  392. deprecated: true
  393. tags:
  394. - defender
  395. summary: Unban
  396. description: Deprecated, please use '/defender/hosts/{id}' instead
  397. operationId: unban_host
  398. requestBody:
  399. required: true
  400. content:
  401. application/json:
  402. schema:
  403. type: object
  404. properties:
  405. ip:
  406. type: string
  407. description: IPv4/IPv6 address to remove
  408. responses:
  409. '200':
  410. description: successful operation
  411. content:
  412. application/json:
  413. schema:
  414. $ref: '#/components/schemas/ApiResponse'
  415. '400':
  416. $ref: '#/components/responses/BadRequest'
  417. '401':
  418. $ref: '#/components/responses/Unauthorized'
  419. '403':
  420. $ref: '#/components/responses/Forbidden'
  421. '404':
  422. $ref: '#/components/responses/NotFound'
  423. '500':
  424. $ref: '#/components/responses/InternalServerError'
  425. default:
  426. $ref: '#/components/responses/DefaultResponse'
  427. /defender/score:
  428. get:
  429. deprecated: true
  430. tags:
  431. - defender
  432. summary: Get score
  433. description: Deprecated, please use '/defender/hosts', '/defender/hosts/{id}' instead
  434. operationId: get_score
  435. parameters:
  436. - in: query
  437. name: ip
  438. required: true
  439. description: IPv4/IPv6 address
  440. schema:
  441. type: string
  442. responses:
  443. '200':
  444. description: successful operation
  445. content:
  446. application/json:
  447. schema:
  448. $ref: '#/components/schemas/ScoreStatus'
  449. '401':
  450. $ref: '#/components/responses/Unauthorized'
  451. '403':
  452. $ref: '#/components/responses/Forbidden'
  453. '404':
  454. $ref: '#/components/responses/NotFound'
  455. '500':
  456. $ref: '#/components/responses/InternalServerError'
  457. default:
  458. $ref: '#/components/responses/DefaultResponse'
  459. /quotas/users/scans:
  460. get:
  461. tags:
  462. - quota
  463. summary: Get active user quota scans
  464. description: Returns the active user quota scans
  465. operationId: get_users_quota_scans
  466. responses:
  467. '200':
  468. description: successful operation
  469. content:
  470. application/json:
  471. schema:
  472. type: array
  473. items:
  474. $ref: '#/components/schemas/QuotaScan'
  475. '401':
  476. $ref: '#/components/responses/Unauthorized'
  477. '403':
  478. $ref: '#/components/responses/Forbidden'
  479. '500':
  480. $ref: '#/components/responses/InternalServerError'
  481. default:
  482. $ref: '#/components/responses/DefaultResponse'
  483. /quotas/users/{username}/scan:
  484. parameters:
  485. - name: username
  486. in: path
  487. description: the username
  488. required: true
  489. schema:
  490. type: string
  491. post:
  492. tags:
  493. - quota
  494. summary: Start a user quota scan
  495. description: Starts a new quota scan for the given user. A quota scan updates the number of files and their total size for the specified user and the virtual folders, if any, included in his quota
  496. operationId: start_user_quota_scan
  497. responses:
  498. '202':
  499. description: successful operation
  500. content:
  501. application/json:
  502. schema:
  503. $ref: '#/components/schemas/ApiResponse'
  504. example:
  505. message: Scan started
  506. '400':
  507. $ref: '#/components/responses/BadRequest'
  508. '401':
  509. $ref: '#/components/responses/Unauthorized'
  510. '403':
  511. $ref: '#/components/responses/Forbidden'
  512. '404':
  513. $ref: '#/components/responses/NotFound'
  514. '409':
  515. $ref: '#/components/responses/Conflict'
  516. '500':
  517. $ref: '#/components/responses/InternalServerError'
  518. default:
  519. $ref: '#/components/responses/DefaultResponse'
  520. /quotas/users/{username}/usage:
  521. parameters:
  522. - name: username
  523. in: path
  524. description: the username
  525. required: true
  526. schema:
  527. type: string
  528. - in: query
  529. name: mode
  530. required: false
  531. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  532. schema:
  533. type: string
  534. enum:
  535. - add
  536. - reset
  537. description: |
  538. Update type:
  539. * `add` - add the specified quota limits to the current used ones
  540. * `reset` - reset the values to the specified ones. This is the default
  541. example: reset
  542. put:
  543. tags:
  544. - quota
  545. summary: Update quota usage limits
  546. description: Sets the current used quota limits for the given user
  547. operationId: user_quota_update_usage
  548. parameters:
  549. - in: query
  550. name: mode
  551. required: false
  552. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  553. schema:
  554. type: string
  555. enum:
  556. - add
  557. - reset
  558. description: |
  559. Update type:
  560. * `add` - add the specified quota limits to the current used ones
  561. * `reset` - reset the values to the specified ones. This is the default
  562. example: reset
  563. requestBody:
  564. required: true
  565. description: 'If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is "add" the current value, for the missing field, will remain unchanged, if mode is "reset" the missing field is set to 0'
  566. content:
  567. application/json:
  568. schema:
  569. $ref: '#/components/schemas/QuotaUsage'
  570. responses:
  571. '200':
  572. description: successful operation
  573. content:
  574. application/json:
  575. schema:
  576. $ref: '#/components/schemas/ApiResponse'
  577. example:
  578. message: Quota updated
  579. '400':
  580. $ref: '#/components/responses/BadRequest'
  581. '401':
  582. $ref: '#/components/responses/Unauthorized'
  583. '403':
  584. $ref: '#/components/responses/Forbidden'
  585. '404':
  586. $ref: '#/components/responses/NotFound'
  587. '409':
  588. $ref: '#/components/responses/Conflict'
  589. '500':
  590. $ref: '#/components/responses/InternalServerError'
  591. default:
  592. $ref: '#/components/responses/DefaultResponse'
  593. /quotas/folders/scans:
  594. get:
  595. tags:
  596. - quota
  597. summary: Get active folder quota scans
  598. description: Returns the active folder quota scans
  599. operationId: get_folders_quota_scans
  600. responses:
  601. '200':
  602. description: successful operation
  603. content:
  604. application/json:
  605. schema:
  606. type: array
  607. items:
  608. $ref: '#/components/schemas/FolderQuotaScan'
  609. '401':
  610. $ref: '#/components/responses/Unauthorized'
  611. '403':
  612. $ref: '#/components/responses/Forbidden'
  613. '500':
  614. $ref: '#/components/responses/InternalServerError'
  615. default:
  616. $ref: '#/components/responses/DefaultResponse'
  617. /quotas/folders/{name}/scan:
  618. parameters:
  619. - name: name
  620. in: path
  621. description: folder name
  622. required: true
  623. schema:
  624. type: string
  625. post:
  626. tags:
  627. - quota
  628. summary: Start a folder quota scan
  629. description: Starts a new quota scan for the given folder. A quota scan update the number of files and their total size for the specified folder
  630. operationId: start_folder_quota_scan
  631. responses:
  632. '202':
  633. description: successful operation
  634. content:
  635. application/json:
  636. schema:
  637. $ref: '#/components/schemas/ApiResponse'
  638. example:
  639. message: Scan started
  640. '400':
  641. $ref: '#/components/responses/BadRequest'
  642. '401':
  643. $ref: '#/components/responses/Unauthorized'
  644. '403':
  645. $ref: '#/components/responses/Forbidden'
  646. '404':
  647. $ref: '#/components/responses/NotFound'
  648. '409':
  649. $ref: '#/components/responses/Conflict'
  650. '500':
  651. $ref: '#/components/responses/InternalServerError'
  652. default:
  653. $ref: '#/components/responses/DefaultResponse'
  654. /quotas/folders/{name}/usage:
  655. parameters:
  656. - name: name
  657. in: path
  658. description: folder name
  659. required: true
  660. schema:
  661. type: string
  662. - in: query
  663. name: mode
  664. required: false
  665. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  666. schema:
  667. type: string
  668. enum:
  669. - add
  670. - reset
  671. description: |
  672. Update type:
  673. * `add` - add the specified quota limits to the current used ones
  674. * `reset` - reset the values to the specified ones. This is the default
  675. example: reset
  676. put:
  677. tags:
  678. - quota
  679. summary: Update folder quota usage limits
  680. description: Sets the current used quota limits for the given folder
  681. operationId: folder_quota_update_usage
  682. parameters:
  683. - in: query
  684. name: mode
  685. required: false
  686. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  687. schema:
  688. type: string
  689. enum:
  690. - add
  691. - reset
  692. description: |
  693. Update type:
  694. * `add` - add the specified quota limits to the current used ones
  695. * `reset` - reset the values to the specified ones. This is the default
  696. example: reset
  697. requestBody:
  698. required: true
  699. description: 'If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is "add" the current value, for the missing field, will remain unchanged, if mode is "reset" the missing field is set to 0'
  700. content:
  701. application/json:
  702. schema:
  703. $ref: '#/components/schemas/QuotaUsage'
  704. responses:
  705. '200':
  706. description: successful operation
  707. content:
  708. application/json:
  709. schema:
  710. $ref: '#/components/schemas/ApiResponse'
  711. example:
  712. message: Quota updated
  713. '400':
  714. $ref: '#/components/responses/BadRequest'
  715. '401':
  716. $ref: '#/components/responses/Unauthorized'
  717. '403':
  718. $ref: '#/components/responses/Forbidden'
  719. '404':
  720. $ref: '#/components/responses/NotFound'
  721. '409':
  722. $ref: '#/components/responses/Conflict'
  723. '500':
  724. $ref: '#/components/responses/InternalServerError'
  725. default:
  726. $ref: '#/components/responses/DefaultResponse'
  727. /quota-scans:
  728. get:
  729. deprecated: true
  730. tags:
  731. - quota
  732. summary: Get quota scans
  733. description: Deprecated, please use '/quotas/users/scans' instead
  734. operationId: get_users_quota_scans_deprecated
  735. responses:
  736. '200':
  737. description: successful operation
  738. content:
  739. application/json:
  740. schema:
  741. type: array
  742. items:
  743. $ref: '#/components/schemas/QuotaScan'
  744. '401':
  745. $ref: '#/components/responses/Unauthorized'
  746. '403':
  747. $ref: '#/components/responses/Forbidden'
  748. '500':
  749. $ref: '#/components/responses/InternalServerError'
  750. default:
  751. $ref: '#/components/responses/DefaultResponse'
  752. post:
  753. deprecated: true
  754. tags:
  755. - quota
  756. summary: Start user quota scan
  757. description: Deprecated, please use '/quotas/users/{username}/scan' instead
  758. operationId: start_user_quota_scan_deprecated
  759. requestBody:
  760. required: true
  761. content:
  762. application/json:
  763. schema:
  764. $ref: '#/components/schemas/User'
  765. responses:
  766. '202':
  767. description: successful operation
  768. content:
  769. application/json:
  770. schema:
  771. $ref: '#/components/schemas/ApiResponse'
  772. example:
  773. message: Scan started
  774. '400':
  775. $ref: '#/components/responses/BadRequest'
  776. '401':
  777. $ref: '#/components/responses/Unauthorized'
  778. '403':
  779. $ref: '#/components/responses/Forbidden'
  780. '404':
  781. $ref: '#/components/responses/NotFound'
  782. '409':
  783. $ref: '#/components/responses/Conflict'
  784. '500':
  785. $ref: '#/components/responses/InternalServerError'
  786. default:
  787. $ref: '#/components/responses/DefaultResponse'
  788. /quota-update:
  789. put:
  790. deprecated: true
  791. tags:
  792. - quota
  793. summary: Update quota usage limits
  794. description: Deprecated, please use '/quotas/users/{username}/usage' instead
  795. operationId: user_quota_update_usage_deprecated
  796. parameters:
  797. - in: query
  798. name: mode
  799. required: false
  800. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  801. schema:
  802. type: string
  803. enum:
  804. - add
  805. - reset
  806. description: |
  807. Update type:
  808. * `add` - add the specified quota limits to the current used ones
  809. * `reset` - reset the values to the specified ones. This is the default
  810. example: reset
  811. requestBody:
  812. required: true
  813. description: 'The only user mandatory fields are username, used_quota_size and used_quota_files. Please note that if the quota fields are missing they will default to 0, this means that if mode is "add" the current value will remain unchanged, if mode is "reset" the missing field is set to 0'
  814. content:
  815. application/json:
  816. schema:
  817. $ref: '#/components/schemas/User'
  818. responses:
  819. '200':
  820. description: successful operation
  821. content:
  822. application/json:
  823. schema:
  824. $ref: '#/components/schemas/ApiResponse'
  825. example:
  826. message: Quota updated
  827. '400':
  828. $ref: '#/components/responses/BadRequest'
  829. '401':
  830. $ref: '#/components/responses/Unauthorized'
  831. '403':
  832. $ref: '#/components/responses/Forbidden'
  833. '404':
  834. $ref: '#/components/responses/NotFound'
  835. '500':
  836. $ref: '#/components/responses/InternalServerError'
  837. default:
  838. $ref: '#/components/responses/DefaultResponse'
  839. /folder-quota-update:
  840. put:
  841. deprecated: true
  842. tags:
  843. - quota
  844. summary: Update folder quota limits
  845. description: Deprecated, please use '/quotas/folders/{name}/usage' instead
  846. operationId: folder_quota_update_usage_deprecated
  847. parameters:
  848. - in: query
  849. name: mode
  850. required: false
  851. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  852. schema:
  853. type: string
  854. enum:
  855. - add
  856. - reset
  857. description: |
  858. Update type:
  859. * `add` - add the specified quota limits to the current used ones
  860. * `reset` - reset the values to the specified ones. This is the default
  861. example: reset
  862. requestBody:
  863. required: true
  864. description: 'The only folder mandatory fields are mapped_path,used_quota_size and used_quota_files. Please note that if the used quota fields are missing they will default to 0, this means that if mode is "add" the current value will remain unchanged, if mode is "reset" the missing field is set to 0'
  865. content:
  866. application/json:
  867. schema:
  868. $ref: '#/components/schemas/BaseVirtualFolder'
  869. responses:
  870. '200':
  871. description: successful operation
  872. content:
  873. application/json:
  874. schema:
  875. $ref: '#/components/schemas/ApiResponse'
  876. example:
  877. message: Quota updated
  878. '400':
  879. $ref: '#/components/responses/BadRequest'
  880. '401':
  881. $ref: '#/components/responses/Unauthorized'
  882. '403':
  883. $ref: '#/components/responses/Forbidden'
  884. '404':
  885. $ref: '#/components/responses/NotFound'
  886. '500':
  887. $ref: '#/components/responses/InternalServerError'
  888. default:
  889. $ref: '#/components/responses/DefaultResponse'
  890. /folder-quota-scans:
  891. get:
  892. deprecated: true
  893. tags:
  894. - quota
  895. summary: Get folders quota scans
  896. description: Deprecated, please use '/quotas/folders/scans' instead
  897. operationId: get_folders_quota_scans_deprecated
  898. responses:
  899. '200':
  900. description: successful operation
  901. content:
  902. application/json:
  903. schema:
  904. type: array
  905. items:
  906. $ref: '#/components/schemas/FolderQuotaScan'
  907. '401':
  908. $ref: '#/components/responses/Unauthorized'
  909. '403':
  910. $ref: '#/components/responses/Forbidden'
  911. '500':
  912. $ref: '#/components/responses/InternalServerError'
  913. default:
  914. $ref: '#/components/responses/DefaultResponse'
  915. post:
  916. deprecated: true
  917. tags:
  918. - quota
  919. summary: Start a folder quota scan
  920. description: Deprecated, please use '/quotas/folders/{name}/scan' instead
  921. operationId: start_folder_quota_scan_deprecated
  922. requestBody:
  923. required: true
  924. content:
  925. application/json:
  926. schema:
  927. $ref: '#/components/schemas/BaseVirtualFolder'
  928. responses:
  929. '202':
  930. description: successful operation
  931. content:
  932. application/json:
  933. schema:
  934. $ref: '#/components/schemas/ApiResponse'
  935. example:
  936. message: Scan started
  937. '400':
  938. $ref: '#/components/responses/BadRequest'
  939. '401':
  940. $ref: '#/components/responses/Unauthorized'
  941. '403':
  942. $ref: '#/components/responses/Forbidden'
  943. '404':
  944. $ref: '#/components/responses/NotFound'
  945. '409':
  946. $ref: '#/components/responses/Conflict'
  947. '500':
  948. $ref: '#/components/responses/InternalServerError'
  949. default:
  950. $ref: '#/components/responses/DefaultResponse'
  951. /folders:
  952. get:
  953. tags:
  954. - folders
  955. summary: Get folders
  956. description: Returns an array with one or more folders
  957. operationId: get_folders
  958. parameters:
  959. - in: query
  960. name: offset
  961. schema:
  962. type: integer
  963. minimum: 0
  964. default: 0
  965. required: false
  966. - in: query
  967. name: limit
  968. schema:
  969. type: integer
  970. minimum: 1
  971. maximum: 500
  972. default: 100
  973. required: false
  974. description: 'The maximum number of items to return. Max value is 500, default is 100'
  975. - in: query
  976. name: order
  977. required: false
  978. description: Ordering folders by path. Default ASC
  979. schema:
  980. type: string
  981. enum:
  982. - ASC
  983. - DESC
  984. example: ASC
  985. responses:
  986. '200':
  987. description: successful operation
  988. content:
  989. application/json:
  990. schema:
  991. type: array
  992. items:
  993. $ref: '#/components/schemas/BaseVirtualFolder'
  994. '400':
  995. $ref: '#/components/responses/BadRequest'
  996. '401':
  997. $ref: '#/components/responses/Unauthorized'
  998. '403':
  999. $ref: '#/components/responses/Forbidden'
  1000. '500':
  1001. $ref: '#/components/responses/InternalServerError'
  1002. default:
  1003. $ref: '#/components/responses/DefaultResponse'
  1004. post:
  1005. tags:
  1006. - folders
  1007. summary: Add folder
  1008. operationId: add_folder
  1009. description: Adds a new folder. A quota scan is required to update the used files/size
  1010. requestBody:
  1011. required: true
  1012. content:
  1013. application/json:
  1014. schema:
  1015. $ref: '#/components/schemas/BaseVirtualFolder'
  1016. responses:
  1017. '201':
  1018. description: successful operation
  1019. content:
  1020. application/json:
  1021. schema:
  1022. $ref: '#/components/schemas/BaseVirtualFolder'
  1023. '400':
  1024. $ref: '#/components/responses/BadRequest'
  1025. '401':
  1026. $ref: '#/components/responses/Unauthorized'
  1027. '403':
  1028. $ref: '#/components/responses/Forbidden'
  1029. '500':
  1030. $ref: '#/components/responses/InternalServerError'
  1031. default:
  1032. $ref: '#/components/responses/DefaultResponse'
  1033. '/folders/{name}':
  1034. parameters:
  1035. - name: name
  1036. in: path
  1037. description: folder name
  1038. required: true
  1039. schema:
  1040. type: string
  1041. get:
  1042. tags:
  1043. - folders
  1044. summary: Find folders by name
  1045. description: Returns the folder with the given name if it exists.
  1046. operationId: get_folder_by_name
  1047. responses:
  1048. '200':
  1049. description: successful operation
  1050. content:
  1051. application/json:
  1052. schema:
  1053. $ref: '#/components/schemas/BaseVirtualFolder'
  1054. '400':
  1055. $ref: '#/components/responses/BadRequest'
  1056. '401':
  1057. $ref: '#/components/responses/Unauthorized'
  1058. '403':
  1059. $ref: '#/components/responses/Forbidden'
  1060. '404':
  1061. $ref: '#/components/responses/NotFound'
  1062. '500':
  1063. $ref: '#/components/responses/InternalServerError'
  1064. default:
  1065. $ref: '#/components/responses/DefaultResponse'
  1066. put:
  1067. tags:
  1068. - folders
  1069. summary: Update folder
  1070. description: Updates an existing folder
  1071. operationId: update_folder
  1072. requestBody:
  1073. required: true
  1074. content:
  1075. application/json:
  1076. schema:
  1077. $ref: '#/components/schemas/BaseVirtualFolder'
  1078. responses:
  1079. '200':
  1080. description: successful operation
  1081. content:
  1082. application/json:
  1083. schema:
  1084. $ref: '#/components/schemas/ApiResponse'
  1085. example:
  1086. message: User updated
  1087. '400':
  1088. $ref: '#/components/responses/BadRequest'
  1089. '401':
  1090. $ref: '#/components/responses/Unauthorized'
  1091. '403':
  1092. $ref: '#/components/responses/Forbidden'
  1093. '404':
  1094. $ref: '#/components/responses/NotFound'
  1095. '500':
  1096. $ref: '#/components/responses/InternalServerError'
  1097. default:
  1098. $ref: '#/components/responses/DefaultResponse'
  1099. delete:
  1100. tags:
  1101. - folders
  1102. summary: Delete folder
  1103. description: Deletes an existing folder
  1104. operationId: delete_folder
  1105. responses:
  1106. '200':
  1107. description: successful operation
  1108. content:
  1109. application/json:
  1110. schema:
  1111. $ref: '#/components/schemas/ApiResponse'
  1112. example:
  1113. message: User deleted
  1114. '400':
  1115. $ref: '#/components/responses/BadRequest'
  1116. '401':
  1117. $ref: '#/components/responses/Unauthorized'
  1118. '403':
  1119. $ref: '#/components/responses/Forbidden'
  1120. '404':
  1121. $ref: '#/components/responses/NotFound'
  1122. '500':
  1123. $ref: '#/components/responses/InternalServerError'
  1124. default:
  1125. $ref: '#/components/responses/DefaultResponse'
  1126. /admins:
  1127. get:
  1128. tags:
  1129. - admins
  1130. summary: Get admins
  1131. description: Returns an array with one or more admins. For security reasons hashed passwords are omitted in the response
  1132. operationId: get_admins
  1133. parameters:
  1134. - in: query
  1135. name: offset
  1136. schema:
  1137. type: integer
  1138. minimum: 0
  1139. default: 0
  1140. required: false
  1141. - in: query
  1142. name: limit
  1143. schema:
  1144. type: integer
  1145. minimum: 1
  1146. maximum: 500
  1147. default: 100
  1148. required: false
  1149. description: 'The maximum number of items to return. Max value is 500, default is 100'
  1150. - in: query
  1151. name: order
  1152. required: false
  1153. description: Ordering admins by username. Default ASC
  1154. schema:
  1155. type: string
  1156. enum:
  1157. - ASC
  1158. - DESC
  1159. example: ASC
  1160. responses:
  1161. '200':
  1162. description: successful operation
  1163. content:
  1164. application/json:
  1165. schema:
  1166. type: array
  1167. items:
  1168. $ref: '#/components/schemas/Admin'
  1169. '400':
  1170. $ref: '#/components/responses/BadRequest'
  1171. '401':
  1172. $ref: '#/components/responses/Unauthorized'
  1173. '403':
  1174. $ref: '#/components/responses/Forbidden'
  1175. '500':
  1176. $ref: '#/components/responses/InternalServerError'
  1177. default:
  1178. $ref: '#/components/responses/DefaultResponse'
  1179. post:
  1180. tags:
  1181. - admins
  1182. summary: Add admin
  1183. description: Adds a new admin
  1184. operationId: add_admin
  1185. requestBody:
  1186. required: true
  1187. content:
  1188. application/json:
  1189. schema:
  1190. $ref: '#/components/schemas/Admin'
  1191. examples:
  1192. example-1:
  1193. value:
  1194. id: 1
  1195. status: 0
  1196. username: string
  1197. description: string
  1198. password: pa$$word
  1199. email: [email protected]
  1200. permissions:
  1201. - '*'
  1202. filters:
  1203. allow_list:
  1204. - 192.0.2.0/24
  1205. - '2001:db8::/32'
  1206. additional_info: string
  1207. responses:
  1208. '201':
  1209. description: successful operation
  1210. content:
  1211. application/json:
  1212. schema:
  1213. $ref: '#/components/schemas/Admin'
  1214. '400':
  1215. $ref: '#/components/responses/BadRequest'
  1216. '401':
  1217. $ref: '#/components/responses/Unauthorized'
  1218. '403':
  1219. $ref: '#/components/responses/Forbidden'
  1220. '500':
  1221. $ref: '#/components/responses/InternalServerError'
  1222. default:
  1223. $ref: '#/components/responses/DefaultResponse'
  1224. '/admins/{username}':
  1225. parameters:
  1226. - name: username
  1227. in: path
  1228. description: the admin username
  1229. required: true
  1230. schema:
  1231. type: string
  1232. get:
  1233. tags:
  1234. - admins
  1235. summary: Find admins by username
  1236. description: Returns the admin with the given username, if it exists. For security reasons the hashed password is omitted in the response
  1237. operationId: get_admin_by_username
  1238. responses:
  1239. '200':
  1240. description: successful operation
  1241. content:
  1242. application/json:
  1243. schema:
  1244. $ref: '#/components/schemas/Admin'
  1245. '400':
  1246. $ref: '#/components/responses/BadRequest'
  1247. '401':
  1248. $ref: '#/components/responses/Unauthorized'
  1249. '403':
  1250. $ref: '#/components/responses/Forbidden'
  1251. '404':
  1252. $ref: '#/components/responses/NotFound'
  1253. '500':
  1254. $ref: '#/components/responses/InternalServerError'
  1255. default:
  1256. $ref: '#/components/responses/DefaultResponse'
  1257. put:
  1258. tags:
  1259. - admins
  1260. summary: Update admin
  1261. description: Updates an existing admin
  1262. operationId: update_admin
  1263. requestBody:
  1264. required: true
  1265. content:
  1266. application/json:
  1267. schema:
  1268. $ref: '#/components/schemas/Admin'
  1269. responses:
  1270. '200':
  1271. description: successful operation
  1272. content:
  1273. application/json:
  1274. schema:
  1275. $ref: '#/components/schemas/ApiResponse'
  1276. example:
  1277. message: Admin updated
  1278. '400':
  1279. $ref: '#/components/responses/BadRequest'
  1280. '401':
  1281. $ref: '#/components/responses/Unauthorized'
  1282. '403':
  1283. $ref: '#/components/responses/Forbidden'
  1284. '404':
  1285. $ref: '#/components/responses/NotFound'
  1286. '500':
  1287. $ref: '#/components/responses/InternalServerError'
  1288. default:
  1289. $ref: '#/components/responses/DefaultResponse'
  1290. delete:
  1291. tags:
  1292. - admins
  1293. summary: Delete admin
  1294. description: Deletes an existing admin
  1295. operationId: delete_admin
  1296. responses:
  1297. '200':
  1298. description: successful operation
  1299. content:
  1300. application/json:
  1301. schema:
  1302. $ref: '#/components/schemas/ApiResponse'
  1303. example:
  1304. message: Admin deleted
  1305. '400':
  1306. $ref: '#/components/responses/BadRequest'
  1307. '401':
  1308. $ref: '#/components/responses/Unauthorized'
  1309. '403':
  1310. $ref: '#/components/responses/Forbidden'
  1311. '404':
  1312. $ref: '#/components/responses/NotFound'
  1313. '500':
  1314. $ref: '#/components/responses/InternalServerError'
  1315. default:
  1316. $ref: '#/components/responses/DefaultResponse'
  1317. /users:
  1318. get:
  1319. tags:
  1320. - users
  1321. summary: Get users
  1322. description: Returns an array with one or more users. For security reasons hashed passwords are omitted in the response
  1323. operationId: get_users
  1324. parameters:
  1325. - in: query
  1326. name: offset
  1327. schema:
  1328. type: integer
  1329. minimum: 0
  1330. default: 0
  1331. required: false
  1332. - in: query
  1333. name: limit
  1334. schema:
  1335. type: integer
  1336. minimum: 1
  1337. maximum: 500
  1338. default: 100
  1339. required: false
  1340. description: 'The maximum number of items to return. Max value is 500, default is 100'
  1341. - in: query
  1342. name: order
  1343. required: false
  1344. description: Ordering users by username. Default ASC
  1345. schema:
  1346. type: string
  1347. enum:
  1348. - ASC
  1349. - DESC
  1350. example: ASC
  1351. responses:
  1352. '200':
  1353. description: successful operation
  1354. content:
  1355. application/json:
  1356. schema:
  1357. type: array
  1358. items:
  1359. $ref: '#/components/schemas/User'
  1360. '400':
  1361. $ref: '#/components/responses/BadRequest'
  1362. '401':
  1363. $ref: '#/components/responses/Unauthorized'
  1364. '403':
  1365. $ref: '#/components/responses/Forbidden'
  1366. '500':
  1367. $ref: '#/components/responses/InternalServerError'
  1368. default:
  1369. $ref: '#/components/responses/DefaultResponse'
  1370. post:
  1371. tags:
  1372. - users
  1373. summary: Add user
  1374. description: Adds a new user
  1375. operationId: add_user
  1376. requestBody:
  1377. required: true
  1378. content:
  1379. application/json:
  1380. schema:
  1381. $ref: '#/components/schemas/User'
  1382. responses:
  1383. '201':
  1384. description: successful operation
  1385. content:
  1386. application/json:
  1387. schema:
  1388. $ref: '#/components/schemas/User'
  1389. '400':
  1390. $ref: '#/components/responses/BadRequest'
  1391. '401':
  1392. $ref: '#/components/responses/Unauthorized'
  1393. '403':
  1394. $ref: '#/components/responses/Forbidden'
  1395. '500':
  1396. $ref: '#/components/responses/InternalServerError'
  1397. default:
  1398. $ref: '#/components/responses/DefaultResponse'
  1399. '/users/{username}':
  1400. parameters:
  1401. - name: username
  1402. in: path
  1403. description: the username
  1404. required: true
  1405. schema:
  1406. type: string
  1407. get:
  1408. tags:
  1409. - users
  1410. summary: Find users by username
  1411. description: Returns the user with the given username if it exists. For security reasons the hashed password is omitted in the response
  1412. operationId: get_user_by_username
  1413. responses:
  1414. '200':
  1415. description: successful operation
  1416. content:
  1417. application/json:
  1418. schema:
  1419. $ref: '#/components/schemas/User'
  1420. '400':
  1421. $ref: '#/components/responses/BadRequest'
  1422. '401':
  1423. $ref: '#/components/responses/Unauthorized'
  1424. '403':
  1425. $ref: '#/components/responses/Forbidden'
  1426. '404':
  1427. $ref: '#/components/responses/NotFound'
  1428. '500':
  1429. $ref: '#/components/responses/InternalServerError'
  1430. default:
  1431. $ref: '#/components/responses/DefaultResponse'
  1432. put:
  1433. tags:
  1434. - users
  1435. summary: Update user
  1436. description: 'Updates an existing user and optionally disconnects it, if connected, to apply the new settings'
  1437. operationId: update_user
  1438. parameters:
  1439. - in: query
  1440. name: disconnect
  1441. schema:
  1442. type: integer
  1443. enum:
  1444. - 0
  1445. - 1
  1446. description: |
  1447. Disconnect:
  1448. * `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default
  1449. * `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration
  1450. requestBody:
  1451. required: true
  1452. content:
  1453. application/json:
  1454. schema:
  1455. $ref: '#/components/schemas/User'
  1456. responses:
  1457. '200':
  1458. description: successful operation
  1459. content:
  1460. application/json:
  1461. schema:
  1462. $ref: '#/components/schemas/ApiResponse'
  1463. example:
  1464. message: User updated
  1465. '400':
  1466. $ref: '#/components/responses/BadRequest'
  1467. '401':
  1468. $ref: '#/components/responses/Unauthorized'
  1469. '403':
  1470. $ref: '#/components/responses/Forbidden'
  1471. '404':
  1472. $ref: '#/components/responses/NotFound'
  1473. '500':
  1474. $ref: '#/components/responses/InternalServerError'
  1475. default:
  1476. $ref: '#/components/responses/DefaultResponse'
  1477. delete:
  1478. tags:
  1479. - users
  1480. summary: Delete user
  1481. description: Deletes an existing user
  1482. operationId: delete_user
  1483. responses:
  1484. '200':
  1485. description: successful operation
  1486. content:
  1487. application/json:
  1488. schema:
  1489. $ref: '#/components/schemas/ApiResponse'
  1490. example:
  1491. message: User deleted
  1492. '400':
  1493. $ref: '#/components/responses/BadRequest'
  1494. '401':
  1495. $ref: '#/components/responses/Unauthorized'
  1496. '403':
  1497. $ref: '#/components/responses/Forbidden'
  1498. '404':
  1499. $ref: '#/components/responses/NotFound'
  1500. '500':
  1501. $ref: '#/components/responses/InternalServerError'
  1502. default:
  1503. $ref: '#/components/responses/DefaultResponse'
  1504. /status:
  1505. get:
  1506. tags:
  1507. - maintenance
  1508. summary: Get status
  1509. description: Retrieves the status of the active services
  1510. operationId: get_status
  1511. responses:
  1512. '200':
  1513. description: successful operation
  1514. content:
  1515. application/json:
  1516. schema:
  1517. $ref: '#/components/schemas/ServicesStatus'
  1518. '400':
  1519. $ref: '#/components/responses/BadRequest'
  1520. '401':
  1521. $ref: '#/components/responses/Unauthorized'
  1522. '403':
  1523. $ref: '#/components/responses/Forbidden'
  1524. '500':
  1525. $ref: '#/components/responses/InternalServerError'
  1526. default:
  1527. $ref: '#/components/responses/DefaultResponse'
  1528. /dumpdata:
  1529. get:
  1530. tags:
  1531. - maintenance
  1532. summary: Dump data
  1533. description: 'Backups data as data provider independent JSON. The backup can be saved in a local file on the server, to avoid exposing sensitive data over the network, or returned as response body. The output of dumpdata can be used as input for loaddata'
  1534. operationId: dumpdata
  1535. parameters:
  1536. - in: query
  1537. name: output-file
  1538. schema:
  1539. type: string
  1540. description: Path for the file to write the JSON serialized data to. This path is relative to the configured "backups_path". If this file already exists it will be overwritten. To return the backup as response body set `output_data` to true instead.
  1541. - in: query
  1542. name: output-data
  1543. schema:
  1544. type: integer
  1545. enum:
  1546. - 0
  1547. - 1
  1548. description: |
  1549. output data:
  1550. * `0` or any other value != 1, the backup will be saved to a file on the server, `output_file` is required
  1551. * `1` the backup will be returned as response body
  1552. - in: query
  1553. name: indent
  1554. schema:
  1555. type: integer
  1556. enum:
  1557. - 0
  1558. - 1
  1559. description: |
  1560. indent:
  1561. * `0` no indentation. This is the default
  1562. * `1` format the output JSON
  1563. responses:
  1564. '200':
  1565. description: successful operation
  1566. content:
  1567. application/json:
  1568. schema:
  1569. oneOf:
  1570. - $ref: '#/components/schemas/ApiResponse'
  1571. - $ref: '#/components/schemas/BackupData'
  1572. '400':
  1573. $ref: '#/components/responses/BadRequest'
  1574. '401':
  1575. $ref: '#/components/responses/Unauthorized'
  1576. '403':
  1577. $ref: '#/components/responses/Forbidden'
  1578. '500':
  1579. $ref: '#/components/responses/InternalServerError'
  1580. default:
  1581. $ref: '#/components/responses/DefaultResponse'
  1582. /loaddata:
  1583. parameters:
  1584. - in: query
  1585. name: scan-quota
  1586. schema:
  1587. type: integer
  1588. enum:
  1589. - 0
  1590. - 1
  1591. - 2
  1592. description: |
  1593. Quota scan:
  1594. * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default
  1595. * `1` scan quota
  1596. * `2` scan quota if the user has quota restrictions
  1597. required: false
  1598. - in: query
  1599. name: mode
  1600. schema:
  1601. type: integer
  1602. enum:
  1603. - 0
  1604. - 1
  1605. - 2
  1606. description: |
  1607. Mode:
  1608. * `0` New users/admins are added, existing users/admins are updated. This is the default
  1609. * `1` New users/admins are added, existing users/admins are not modified
  1610. * `2` New users are added, existing users are updated and, if connected, they are disconnected and so forced to use the new configuration
  1611. get:
  1612. tags:
  1613. - maintenance
  1614. summary: Load data from path
  1615. description: 'Restores SFTPGo data from a JSON backup file on the server. Users, folders and admins will be restored one by one and the restore is stopped if a user/folder/admin cannot be added or updated, so it could happen a partial restore'
  1616. operationId: loaddata_from_file
  1617. parameters:
  1618. - in: query
  1619. name: input-file
  1620. schema:
  1621. type: string
  1622. required: true
  1623. description: Path for the file to read the JSON serialized data from. This can be an absolute path or a path relative to the configured "backups_path". The max allowed file size is 10MB
  1624. responses:
  1625. '200':
  1626. description: successful operation
  1627. content:
  1628. application/json:
  1629. schema:
  1630. $ref: '#/components/schemas/ApiResponse'
  1631. example:
  1632. message: Data restored
  1633. '400':
  1634. $ref: '#/components/responses/BadRequest'
  1635. '401':
  1636. $ref: '#/components/responses/Unauthorized'
  1637. '403':
  1638. $ref: '#/components/responses/Forbidden'
  1639. '500':
  1640. $ref: '#/components/responses/InternalServerError'
  1641. default:
  1642. $ref: '#/components/responses/DefaultResponse'
  1643. post:
  1644. tags:
  1645. - maintenance
  1646. summary: Load data
  1647. description: 'Restores SFTPGo data from a JSON backup. Users, folders and admins will be restored one by one and the restore is stopped if a user/folder/admin cannot be added or updated, so it could happen a partial restore'
  1648. operationId: loaddata_from_request_body
  1649. requestBody:
  1650. required: true
  1651. content:
  1652. application/json:
  1653. schema:
  1654. $ref: '#/components/schemas/BackupData'
  1655. responses:
  1656. '200':
  1657. description: successful operation
  1658. content:
  1659. application/json:
  1660. schema:
  1661. $ref: '#/components/schemas/ApiResponse'
  1662. example:
  1663. message: Data restored
  1664. '400':
  1665. $ref: '#/components/responses/BadRequest'
  1666. '401':
  1667. $ref: '#/components/responses/Unauthorized'
  1668. '403':
  1669. $ref: '#/components/responses/Forbidden'
  1670. '500':
  1671. $ref: '#/components/responses/InternalServerError'
  1672. default:
  1673. $ref: '#/components/responses/DefaultResponse'
  1674. /user/changepwd:
  1675. put:
  1676. tags:
  1677. - users API
  1678. summary: Change user password
  1679. description: Changes the password for the logged in user
  1680. operationId: change_user_password
  1681. requestBody:
  1682. required: true
  1683. content:
  1684. application/json:
  1685. schema:
  1686. $ref: '#/components/schemas/PwdChange'
  1687. responses:
  1688. '200':
  1689. description: successful operation
  1690. content:
  1691. application/json:
  1692. schema:
  1693. $ref: '#/components/schemas/ApiResponse'
  1694. '401':
  1695. $ref: '#/components/responses/Unauthorized'
  1696. '403':
  1697. $ref: '#/components/responses/Forbidden'
  1698. '500':
  1699. $ref: '#/components/responses/InternalServerError'
  1700. default:
  1701. $ref: '#/components/responses/DefaultResponse'
  1702. /user/publickeys:
  1703. get:
  1704. tags:
  1705. - users API
  1706. summary: Get the user's public keys
  1707. description: Returns the public keys for the logged in user
  1708. operationId: get_user_public_keys
  1709. responses:
  1710. '200':
  1711. description: successful operation
  1712. content:
  1713. application/json:
  1714. schema:
  1715. type: array
  1716. items:
  1717. type: string
  1718. '400':
  1719. $ref: '#/components/responses/BadRequest'
  1720. '401':
  1721. $ref: '#/components/responses/Unauthorized'
  1722. '403':
  1723. $ref: '#/components/responses/Forbidden'
  1724. '500':
  1725. $ref: '#/components/responses/InternalServerError'
  1726. default:
  1727. $ref: '#/components/responses/DefaultResponse'
  1728. put:
  1729. tags:
  1730. - users API
  1731. summary: Set the user's public keys
  1732. description: Sets the public keys for the logged in user. Public keys must be in OpenSSH format
  1733. operationId: set_user_public_keys
  1734. requestBody:
  1735. required: true
  1736. content:
  1737. application/json:
  1738. schema:
  1739. type: array
  1740. items:
  1741. type: string
  1742. description: Public key in OpenSSH format
  1743. example: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPVILdH2u3yV5SAeE6XksD1z1vXRg0E4hJUov8ITDAZ2 user@host
  1744. responses:
  1745. '200':
  1746. description: successful operation
  1747. content:
  1748. application/json:
  1749. schema:
  1750. $ref: '#/components/schemas/ApiResponse'
  1751. '400':
  1752. $ref: '#/components/responses/BadRequest'
  1753. '401':
  1754. $ref: '#/components/responses/Unauthorized'
  1755. '403':
  1756. $ref: '#/components/responses/Forbidden'
  1757. '500':
  1758. $ref: '#/components/responses/InternalServerError'
  1759. default:
  1760. $ref: '#/components/responses/DefaultResponse'
  1761. /user/folder:
  1762. get:
  1763. tags:
  1764. - users API
  1765. summary: Read folders contents
  1766. description: Returns the contents of the specified folder for the logged in user
  1767. operationId: get_user_folder_contents
  1768. parameters:
  1769. - in: query
  1770. name: path
  1771. description: Path to the folder to read. It must be URL encoded, for example the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir". If empty or missing the root folder is assumed
  1772. schema:
  1773. type: string
  1774. responses:
  1775. '200':
  1776. description: successful operation
  1777. content:
  1778. application/json:
  1779. schema:
  1780. type: array
  1781. items:
  1782. $ref: '#/components/schemas/DirEntry'
  1783. '400':
  1784. $ref: '#/components/responses/BadRequest'
  1785. '401':
  1786. $ref: '#/components/responses/Unauthorized'
  1787. '403':
  1788. $ref: '#/components/responses/Forbidden'
  1789. '500':
  1790. $ref: '#/components/responses/InternalServerError'
  1791. default:
  1792. $ref: '#/components/responses/DefaultResponse'
  1793. /user/file:
  1794. get:
  1795. tags:
  1796. - users API
  1797. summary: Download a single file
  1798. description: Returns the file contents as response body
  1799. operationId: get_user_file
  1800. parameters:
  1801. - in: query
  1802. name: path
  1803. required: true
  1804. description: Path to the file to download. It must be URL encoded, for example the path "my dir/àdir/file.txt" must be sent as "my%20dir%2F%C3%A0dir%2Ffile.txt"
  1805. schema:
  1806. type: string
  1807. responses:
  1808. '200':
  1809. description: successful operation
  1810. content:
  1811. '*/*':
  1812. schema:
  1813. type: string
  1814. format: binary
  1815. '206':
  1816. description: successful operation
  1817. content:
  1818. '*/*':
  1819. schema:
  1820. type: string
  1821. format: binary
  1822. '400':
  1823. $ref: '#/components/responses/BadRequest'
  1824. '401':
  1825. $ref: '#/components/responses/Unauthorized'
  1826. '403':
  1827. $ref: '#/components/responses/Forbidden'
  1828. '500':
  1829. $ref: '#/components/responses/InternalServerError'
  1830. default:
  1831. $ref: '#/components/responses/DefaultResponse'
  1832. /user/streamzip:
  1833. post:
  1834. tags:
  1835. - users API
  1836. summary: Download multiple files and folders as a single zip file
  1837. description: A zip file, containing the specified files and folders, will be generated on the fly and returned as response body. Only folders and regular files will be included in the zip
  1838. operationId: streamzip
  1839. requestBody:
  1840. required: true
  1841. content:
  1842. application/json:
  1843. schema:
  1844. type: array
  1845. items:
  1846. type: string
  1847. description: Absolute file or folder path
  1848. responses:
  1849. '200':
  1850. description: successful operation
  1851. content:
  1852. 'application/zip':
  1853. schema:
  1854. type: string
  1855. format: binary
  1856. '400':
  1857. $ref: '#/components/responses/BadRequest'
  1858. '401':
  1859. $ref: '#/components/responses/Unauthorized'
  1860. '403':
  1861. $ref: '#/components/responses/Forbidden'
  1862. '500':
  1863. $ref: '#/components/responses/InternalServerError'
  1864. default:
  1865. $ref: '#/components/responses/DefaultResponse'
  1866. components:
  1867. responses:
  1868. BadRequest:
  1869. description: Bad Request
  1870. content:
  1871. application/json:
  1872. schema:
  1873. $ref: '#/components/schemas/ApiResponse'
  1874. Unauthorized:
  1875. description: Unauthorized
  1876. content:
  1877. application/json:
  1878. schema:
  1879. $ref: '#/components/schemas/ApiResponse'
  1880. Forbidden:
  1881. description: Forbidden
  1882. content:
  1883. application/json:
  1884. schema:
  1885. $ref: '#/components/schemas/ApiResponse'
  1886. NotFound:
  1887. description: Not Found
  1888. content:
  1889. application/json:
  1890. schema:
  1891. $ref: '#/components/schemas/ApiResponse'
  1892. Conflict:
  1893. description: Conflict
  1894. content:
  1895. application/json:
  1896. schema:
  1897. $ref: '#/components/schemas/ApiResponse'
  1898. InternalServerError:
  1899. description: Internal Server Error
  1900. content:
  1901. application/json:
  1902. schema:
  1903. $ref: '#/components/schemas/ApiResponse'
  1904. DefaultResponse:
  1905. description: Unexpected Error
  1906. content:
  1907. application/json:
  1908. schema:
  1909. $ref: '#/components/schemas/ApiResponse'
  1910. schemas:
  1911. Permission:
  1912. type: string
  1913. enum:
  1914. - '*'
  1915. - list
  1916. - download
  1917. - upload
  1918. - overwrite
  1919. - delete
  1920. - rename
  1921. - create_dirs
  1922. - create_symlinks
  1923. - chmod
  1924. - chown
  1925. - chtimes
  1926. description: |
  1927. Permissions:
  1928. * `*` - all permissions are granted
  1929. * `list` - list items is allowed
  1930. * `download` - download files is allowed
  1931. * `upload` - upload files is allowed
  1932. * `overwrite` - overwrite an existing file, while uploading, is allowed. upload permission is required to allow file overwrite
  1933. * `delete` - delete files or directories is allowed
  1934. * `rename` - rename files or directories is allowed
  1935. * `create_dirs` - create directories is allowed
  1936. * `create_symlinks` - create links is allowed
  1937. * `chmod` changing file or directory permissions is allowed
  1938. * `chown` changing file or directory owner and group is allowed
  1939. * `chtimes` changing file or directory access and modification time is allowed
  1940. DirPermissions:
  1941. type: object
  1942. additionalProperties:
  1943. type: array
  1944. items:
  1945. $ref: '#/components/schemas/Permission'
  1946. minItems: 1
  1947. minProperties: 1
  1948. description: 'hash map with directory as key and an array of permissions as value. Directories must be absolute paths, permissions for root directory ("/") are required'
  1949. AdminPermissions:
  1950. type: string
  1951. enum:
  1952. - '*'
  1953. - add_users
  1954. - edit_users
  1955. - del_users
  1956. - view_users
  1957. - view_conns
  1958. - close_conns
  1959. - view_status
  1960. - manage_admins
  1961. - quota_scans
  1962. - manage_system
  1963. - manage_defender
  1964. - view_defender
  1965. description: |
  1966. Admin permissions:
  1967. * `*` - all permissions are granted
  1968. * `add_users` - add new users is allowed
  1969. * `edit_users` - change existing users is allowed
  1970. * `del_users` - remove users is allowed
  1971. * `view_users` - list users is allowed
  1972. * `view_conns` - list active connections is allowed
  1973. * `close_conns` - close active connections is allowed
  1974. * `view_status` - view the server status is allowed
  1975. * `manage_admins` - manage other admins is allowed
  1976. * `manage_defender` - remove ip from the dynamic blocklist is allowed
  1977. * `view_defender` - list the dynamic blocklist is allowed
  1978. LoginMethods:
  1979. type: string
  1980. enum:
  1981. - publickey
  1982. - password
  1983. - keyboard-interactive
  1984. - publickey+password
  1985. - publickey+keyboard-interactive
  1986. - TLSCertificate
  1987. - TLSCertificate+password
  1988. description: |
  1989. Available login methods. To enable multi-step authentication you have to allow only multi-step login methods
  1990. * `publickey`
  1991. * `password`
  1992. * `keyboard-interactive`
  1993. * `publickey+password` - multi-step auth: public key and password
  1994. * `publickey+keyboard-interactive` - multi-step auth: public key and keyboard interactive
  1995. * `TLSCertificate`
  1996. * `TLSCertificate+password` - multi-step auth: TLS client certificate and password
  1997. SupportedProtocols:
  1998. type: string
  1999. enum:
  2000. - SSH
  2001. - FTP
  2002. - DAV
  2003. - HTTP
  2004. description: |
  2005. Protocols:
  2006. * `SSH` - includes both SFTP and SSH commands
  2007. * `FTP` - plain FTP and FTPES/FTPS
  2008. * `DAV` - WebDAV over HTTP/HTTPS
  2009. * `HTTP` - WebClient
  2010. WebClientOptions:
  2011. type: string
  2012. enum:
  2013. - publickey-change-disabled
  2014. description: |
  2015. Options:
  2016. * `publickey-change-disabled` - changing SSH public keys is not allowed
  2017. PatternsFilter:
  2018. type: object
  2019. properties:
  2020. path:
  2021. type: string
  2022. description: 'exposed virtual path, if no other specific filter is defined, the filter apply for sub directories too. For example if filters are defined for the paths "/" and "/sub" then the filters for "/" are applied for any file outside the "/sub" directory'
  2023. allowed_patterns:
  2024. type: array
  2025. items:
  2026. type: string
  2027. description: 'list of, case insensitive, allowed shell like file patterns.'
  2028. example:
  2029. - '*.jpg'
  2030. - a*b?.png
  2031. denied_patterns:
  2032. type: array
  2033. items:
  2034. type: string
  2035. description: 'list of, case insensitive, denied shell like file patterns. Denied patterns are evaluated before the allowed ones'
  2036. example:
  2037. - '*.zip'
  2038. HooksFilter:
  2039. type: object
  2040. properties:
  2041. external_auth_disabled:
  2042. type: boolean
  2043. example: false
  2044. description: If true, the external auth hook, if defined, will not be executed
  2045. pre_login_disabled:
  2046. type: boolean
  2047. example: false
  2048. description: If true, the pre-login hook, if defined, will not be executed
  2049. check_password_disabled:
  2050. type: boolean
  2051. example: false
  2052. description: If true, the check password hook, if defined, will not be executed
  2053. description: User specific hook overrides
  2054. UserFilters:
  2055. type: object
  2056. properties:
  2057. allowed_ip:
  2058. type: array
  2059. items:
  2060. type: string
  2061. description: 'only clients connecting from these IP/Mask are allowed. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example "192.0.2.0/24" or "2001:db8::/32"'
  2062. example:
  2063. - 192.0.2.0/24
  2064. - '2001:db8::/32'
  2065. denied_ip:
  2066. type: array
  2067. items:
  2068. type: string
  2069. description: clients connecting from these IP/Mask are not allowed. Denied rules are evaluated before allowed ones
  2070. example:
  2071. - 172.16.0.0/16
  2072. denied_login_methods:
  2073. type: array
  2074. items:
  2075. $ref: '#/components/schemas/LoginMethods'
  2076. description: if null or empty any available login method is allowed
  2077. denied_protocols:
  2078. type: array
  2079. items:
  2080. $ref: '#/components/schemas/SupportedProtocols'
  2081. description: if null or empty any available protocol is allowed
  2082. file_patterns:
  2083. type: array
  2084. items:
  2085. $ref: '#/components/schemas/PatternsFilter'
  2086. description: 'filters based on shell like file patterns. These restrictions do not apply to files listing for performance reasons, so a denied file cannot be downloaded/overwritten/renamed but it will still be in the list of files. Please note that these restrictions can be easily bypassed'
  2087. max_upload_file_size:
  2088. type: integer
  2089. format: int64
  2090. description: 'maximum allowed size, as bytes, for a single file upload. The upload will be aborted if/when the size of the file being sent exceeds this limit. 0 means unlimited. This restriction does not apply for SSH system commands such as `git` and `rsync`'
  2091. tls_username:
  2092. type: string
  2093. enum:
  2094. - None
  2095. - CommonName
  2096. description: 'defines the TLS certificate field to use as username. For FTP clients it must match the name provided using the "USER" command. For WebDAV, if no username is provided, the CN will be used as username. For WebDAV clients it must match the implicit or provided username. Ignored if mutual TLS is disabled'
  2097. hooks:
  2098. $ref: '#/components/schemas/HooksFilter'
  2099. disable_fs_checks:
  2100. type: boolean
  2101. example: false
  2102. description: Disable checks for existence and automatic creation of home directory and virtual folders. SFTPGo requires that the user's home directory, virtual folder root, and intermediate paths to virtual folders exist to work properly. If you already know that the required directories exist, disabling these checks will speed up login. You could, for example, disable these checks after the first login
  2103. web_client:
  2104. type: array
  2105. items:
  2106. $ref: '#/components/schemas/WebClientOptions'
  2107. description: WebClient related configuration options
  2108. description: Additional user options
  2109. Secret:
  2110. type: object
  2111. properties:
  2112. status:
  2113. type: string
  2114. enum:
  2115. - Plain
  2116. - AES-256-GCM
  2117. - Secretbox
  2118. - GCP
  2119. - AWS
  2120. - VaultTransit
  2121. - Redacted
  2122. description: 'Set to "Plain" to add or update an existing secret, set to "Redacted" to preserve the existing value'
  2123. payload:
  2124. type: string
  2125. key:
  2126. type: string
  2127. additional_data:
  2128. type: string
  2129. mode:
  2130. type: integer
  2131. description: 1 means encrypted using a master key
  2132. description: The secret is encrypted before saving, so to set a new secret you must provide a payload and set the status to "Plain". The encryption key and additional data will be generated automatically. If you set the status to "Redacted" the existig secret will be preserved
  2133. S3Config:
  2134. type: object
  2135. properties:
  2136. bucket:
  2137. type: string
  2138. minLength: 1
  2139. region:
  2140. type: string
  2141. minLength: 1
  2142. access_key:
  2143. type: string
  2144. access_secret:
  2145. $ref: '#/components/schemas/Secret'
  2146. endpoint:
  2147. type: string
  2148. description: optional endpoint
  2149. storage_class:
  2150. type: string
  2151. upload_part_size:
  2152. type: integer
  2153. description: 'the buffer size (in MB) to use for multipart uploads. The minimum allowed part size is 5MB, and if this value is set to zero, the default value (5MB) for the AWS SDK will be used. The minimum allowed value is 5.'
  2154. upload_concurrency:
  2155. type: integer
  2156. description: 'the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used'
  2157. key_prefix:
  2158. type: string
  2159. description: 'key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with "/" and must end with "/". If empty the whole bucket contents will be available'
  2160. example: folder/subfolder/
  2161. description: S3 Compatible Object Storage configuration details
  2162. GCSConfig:
  2163. type: object
  2164. properties:
  2165. bucket:
  2166. type: string
  2167. minLength: 1
  2168. credentials:
  2169. $ref: '#/components/schemas/Secret'
  2170. automatic_credentials:
  2171. type: integer
  2172. enum:
  2173. - 0
  2174. - 1
  2175. description: |
  2176. Automatic credentials:
  2177. * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null
  2178. * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials
  2179. storage_class:
  2180. type: string
  2181. key_prefix:
  2182. type: string
  2183. description: 'key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with "/" and must end with "/". If empty the whole bucket contents will be available'
  2184. example: folder/subfolder/
  2185. description: 'Google Cloud Storage configuration details. The "credentials" field must be populated only when adding/updating a user. It will be always omitted, since there are sensitive data, when you search/get users'
  2186. AzureBlobFsConfig:
  2187. type: object
  2188. properties:
  2189. container:
  2190. type: string
  2191. account_name:
  2192. type: string
  2193. description: 'Storage Account Name, leave blank to use SAS URL'
  2194. account_key:
  2195. $ref: '#/components/schemas/Secret'
  2196. sas_url:
  2197. $ref: '#/components/schemas/Secret'
  2198. endpoint:
  2199. type: string
  2200. description: 'optional endpoint. Default is "blob.core.windows.net". If you use the emulator the endpoint must include the protocol, for example "http://127.0.0.1:10000"'
  2201. upload_part_size:
  2202. type: integer
  2203. description: 'the buffer size (in MB) to use for multipart uploads. If this value is set to zero, the default value (4MB) will be used.'
  2204. upload_concurrency:
  2205. type: integer
  2206. description: 'the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used'
  2207. access_tier:
  2208. type: string
  2209. enum:
  2210. - ''
  2211. - Archive
  2212. - Hot
  2213. - Cool
  2214. key_prefix:
  2215. type: string
  2216. description: 'key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with "/" and must end with "/". If empty the whole container contents will be available'
  2217. example: folder/subfolder/
  2218. use_emulator:
  2219. type: boolean
  2220. description: Azure Blob Storage configuration details
  2221. CryptFsConfig:
  2222. type: object
  2223. properties:
  2224. passphrase:
  2225. $ref: '#/components/schemas/Secret'
  2226. description: Crypt filesystem configuration details
  2227. SFTPFsConfig:
  2228. type: object
  2229. properties:
  2230. endpoint:
  2231. type: string
  2232. description: 'remote SFTP endpoint as host:port'
  2233. username:
  2234. type: string
  2235. description: you can specify a password or private key or both. In the latter case the private key will be tried first.
  2236. password:
  2237. $ref: '#/components/schemas/Secret'
  2238. private_key:
  2239. $ref: '#/components/schemas/Secret'
  2240. fingerprints:
  2241. type: array
  2242. items:
  2243. type: string
  2244. description: 'SHA256 fingerprints to use for host key verification. If you don''t provide any fingerprint the remote host key will not be verified, this is a security risk'
  2245. prefix:
  2246. type: string
  2247. description: Specifying a prefix you can restrict all operations to a given path within the remote SFTP server.
  2248. disable_concurrent_reads:
  2249. type: boolean
  2250. description: Concurrent reads are safe to use and disabling them will degrade performance. Some servers automatically delete files once they are downloaded. Using concurrent reads is problematic with such servers.
  2251. buffer_size:
  2252. type: integer
  2253. minimum: 0
  2254. maximum: 16
  2255. example: 2
  2256. description: The size of the buffer (in MB) to use for transfers. By enabling buffering, the reads and writes, from/to the remote SFTP server, are split in multiple concurrent requests and this allows data to be transferred at a faster rate, over high latency networks, by overlapping round-trip times. With buffering enabled, resuming uploads is not supported and a file cannot be opened for both reading and writing at the same time. 0 means disabled.
  2257. FilesystemConfig:
  2258. type: object
  2259. properties:
  2260. provider:
  2261. type: integer
  2262. enum:
  2263. - 0
  2264. - 1
  2265. - 2
  2266. - 3
  2267. - 4
  2268. - 5
  2269. description: |
  2270. Providers:
  2271. * `0` - Local filesystem
  2272. * `1` - S3 Compatible Object Storage
  2273. * `2` - Google Cloud Storage
  2274. * `3` - Azure Blob Storage
  2275. * `4` - Local filesystem encrypted
  2276. * `5` - SFTP
  2277. s3config:
  2278. $ref: '#/components/schemas/S3Config'
  2279. gcsconfig:
  2280. $ref: '#/components/schemas/GCSConfig'
  2281. azblobconfig:
  2282. $ref: '#/components/schemas/AzureBlobFsConfig'
  2283. cryptconfig:
  2284. $ref: '#/components/schemas/CryptFsConfig'
  2285. sftpconfig:
  2286. $ref: '#/components/schemas/SFTPFsConfig'
  2287. description: Storage filesystem details
  2288. BaseVirtualFolder:
  2289. type: object
  2290. properties:
  2291. id:
  2292. type: integer
  2293. format: int32
  2294. minimum: 1
  2295. name:
  2296. type: string
  2297. description: unique name for this virtual folder
  2298. mapped_path:
  2299. type: string
  2300. description: absolute filesystem path to use as virtual folder
  2301. description:
  2302. type: string
  2303. description: optional description
  2304. used_quota_size:
  2305. type: integer
  2306. format: int64
  2307. used_quota_files:
  2308. type: integer
  2309. format: int32
  2310. last_quota_update:
  2311. type: integer
  2312. format: int64
  2313. description: Last quota update as unix timestamp in milliseconds
  2314. users:
  2315. type: array
  2316. items:
  2317. type: string
  2318. description: list of usernames associated with this virtual folder
  2319. filesystem:
  2320. $ref: '#/components/schemas/FilesystemConfig'
  2321. description: Defines the filesystem for the virtual folder and the used quota limits. The same folder can be shared among multiple users and each user can have different quota limits or a different virtual path.
  2322. VirtualFolder:
  2323. allOf:
  2324. - $ref: '#/components/schemas/BaseVirtualFolder'
  2325. - type: object
  2326. properties:
  2327. virtual_path:
  2328. type: string
  2329. quota_size:
  2330. type: integer
  2331. format: int64
  2332. description: 'Quota as size in bytes. 0 menas unlimited, -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed'
  2333. quota_files:
  2334. type: integer
  2335. format: int32
  2336. description: 'Quota as number of files. 0 menas unlimited, , -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed'
  2337. required:
  2338. - virtual_path
  2339. description: 'A virtual folder is a mapping between a SFTPGo virtual path and a filesystem path outside the user home directory. The specified paths must be absolute and the virtual path cannot be "/", it must be a sub directory. The parent directory for the specified virtual path must exist. SFTPGo will try to automatically create any missing parent directory for the configured virtual folders at user login.'
  2340. User:
  2341. type: object
  2342. properties:
  2343. id:
  2344. type: integer
  2345. format: int32
  2346. minimum: 1
  2347. status:
  2348. type: integer
  2349. enum:
  2350. - 0
  2351. - 1
  2352. description: |
  2353. status:
  2354. * `0` user is disabled, login is not allowed
  2355. * `1` user is enabled
  2356. username:
  2357. type: string
  2358. description: username is unique
  2359. description:
  2360. type: string
  2361. description: 'optional description, for example the user full name'
  2362. expiration_date:
  2363. type: integer
  2364. format: int64
  2365. description: expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration
  2366. password:
  2367. type: string
  2368. format: password
  2369. description: password or public key/SSH user certificate are mandatory. If the password has no known hashing algo prefix it will be stored, by default, using bcrypt, argon2id is supported too. You can send a password hashed as bcrypt ($2a$ prefix), argon2id, pbkdf2 or unix crypt and it will be stored as is. For security reasons this field is omitted when you search/get users
  2370. public_keys:
  2371. type: array
  2372. items:
  2373. type: string
  2374. example: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= user@host
  2375. description: Public keys in OpenSSH format. A password or at least one public key/SSH user certificate are mandatory.
  2376. home_dir:
  2377. type: string
  2378. description: path to the user home directory. The user cannot upload or download files outside this directory. SFTPGo tries to automatically create this folder if missing. Must be an absolute path
  2379. virtual_folders:
  2380. type: array
  2381. items:
  2382. $ref: '#/components/schemas/VirtualFolder'
  2383. description: mapping between virtual SFTPGo paths and filesystem paths outside the user home directory. Supported for local filesystem only. If one or more of the specified folders are not inside the dataprovider they will be automatically created. You have to create the folder on the filesystem yourself
  2384. uid:
  2385. type: integer
  2386. format: int32
  2387. minimum: 0
  2388. maximum: 2147483647
  2389. description: 'if you run SFTPGo as root user, the created files and directories will be assigned to this uid. 0 means no change, the owner will be the user that runs SFTPGo. Ignored on windows'
  2390. gid:
  2391. type: integer
  2392. format: int32
  2393. minimum: 0
  2394. maximum: 2147483647
  2395. description: 'if you run SFTPGo as root user, the created files and directories will be assigned to this gid. 0 means no change, the group will be the one of the user that runs SFTPGo. Ignored on windows'
  2396. max_sessions:
  2397. type: integer
  2398. format: int32
  2399. description: Limit the sessions that a user can open. 0 means unlimited
  2400. quota_size:
  2401. type: integer
  2402. format: int64
  2403. description: Quota as size in bytes. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed
  2404. quota_files:
  2405. type: integer
  2406. format: int32
  2407. description: Quota as number of files. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed
  2408. permissions:
  2409. type: object
  2410. items:
  2411. $ref: '#/components/schemas/DirPermissions'
  2412. minItems: 1
  2413. example:
  2414. /:
  2415. - '*'
  2416. /somedir:
  2417. - list
  2418. - download
  2419. used_quota_size:
  2420. type: integer
  2421. format: int64
  2422. used_quota_files:
  2423. type: integer
  2424. format: int32
  2425. last_quota_update:
  2426. type: integer
  2427. format: int64
  2428. description: Last quota update as unix timestamp in milliseconds
  2429. upload_bandwidth:
  2430. type: integer
  2431. format: int32
  2432. description: 'Maximum upload bandwidth as KB/s, 0 means unlimited'
  2433. download_bandwidth:
  2434. type: integer
  2435. format: int32
  2436. description: 'Maximum download bandwidth as KB/s, 0 means unlimited'
  2437. last_login:
  2438. type: integer
  2439. format: int64
  2440. description: Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes
  2441. filters:
  2442. $ref: '#/components/schemas/UserFilters'
  2443. filesystem:
  2444. $ref: '#/components/schemas/FilesystemConfig'
  2445. additional_info:
  2446. type: string
  2447. description: Free form text field for external systems
  2448. AdminFilters:
  2449. type: object
  2450. properties:
  2451. allow_list:
  2452. type: array
  2453. items:
  2454. type: string
  2455. description: 'only clients connecting from these IP/Mask are allowed. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example "192.0.2.0/24" or "2001:db8::/32"'
  2456. example:
  2457. - 192.0.2.0/24
  2458. - '2001:db8::/32'
  2459. Admin:
  2460. type: object
  2461. properties:
  2462. id:
  2463. type: integer
  2464. format: int32
  2465. minimum: 1
  2466. status:
  2467. type: integer
  2468. enum:
  2469. - 0
  2470. - 1
  2471. description: |
  2472. status:
  2473. * `0` user is disabled, login is not allowed
  2474. * `1` user is enabled
  2475. username:
  2476. type: string
  2477. description: username is unique
  2478. description:
  2479. type: string
  2480. description: 'optional description, for example the admin full name'
  2481. password:
  2482. type: string
  2483. format: password
  2484. description: Admin password. For security reasons this field is omitted when you search/get admins
  2485. email:
  2486. type: string
  2487. format: email
  2488. permissions:
  2489. type: array
  2490. items:
  2491. $ref: '#/components/schemas/AdminPermissions'
  2492. filters:
  2493. $ref: '#/components/schemas/AdminFilters'
  2494. additional_info:
  2495. type: string
  2496. description: Free form text field
  2497. QuotaUsage:
  2498. type: object
  2499. properties:
  2500. used_quota_size:
  2501. type: integer
  2502. format: int64
  2503. used_quota_files:
  2504. type: integer
  2505. format: int32
  2506. Transfer:
  2507. type: object
  2508. properties:
  2509. operation_type:
  2510. type: string
  2511. enum:
  2512. - upload
  2513. - download
  2514. description: |
  2515. Operations:
  2516. * `upload`
  2517. * `download`
  2518. path:
  2519. type: string
  2520. description: file path for the upload/download
  2521. start_time:
  2522. type: integer
  2523. format: int64
  2524. description: start time as unix timestamp in milliseconds
  2525. size:
  2526. type: integer
  2527. format: int64
  2528. description: bytes transferred
  2529. ConnectionStatus:
  2530. type: object
  2531. properties:
  2532. username:
  2533. type: string
  2534. description: connected username
  2535. connection_id:
  2536. type: string
  2537. description: unique connection identifier
  2538. client_version:
  2539. type: string
  2540. description: client version
  2541. remote_address:
  2542. type: string
  2543. description: Remote address for the connected client
  2544. connection_time:
  2545. type: integer
  2546. format: int64
  2547. description: connection time as unix timestamp in milliseconds
  2548. command:
  2549. type: string
  2550. description: Last SSH/FTP command or WebDAV method
  2551. last_activity:
  2552. type: integer
  2553. format: int64
  2554. description: last client activity as unix timestamp in milliseconds
  2555. protocol:
  2556. type: string
  2557. enum:
  2558. - SFTP
  2559. - SCP
  2560. - SSH
  2561. - FTP
  2562. - DAV
  2563. active_transfers:
  2564. type: array
  2565. items:
  2566. $ref: '#/components/schemas/Transfer'
  2567. QuotaScan:
  2568. type: object
  2569. properties:
  2570. username:
  2571. type: string
  2572. description: username with an active scan
  2573. start_time:
  2574. type: integer
  2575. format: int64
  2576. description: scan start time as unix timestamp in milliseconds
  2577. FolderQuotaScan:
  2578. type: object
  2579. properties:
  2580. name:
  2581. type: string
  2582. description: folder name with an active scan
  2583. start_time:
  2584. type: integer
  2585. format: int64
  2586. description: scan start time as unix timestamp in milliseconds
  2587. DefenderEntry:
  2588. type: object
  2589. properties:
  2590. id:
  2591. type: string
  2592. ip:
  2593. type: string
  2594. score:
  2595. type: integer
  2596. description: the score increases whenever a violation is detected, such as an attempt to log in using an incorrect password or invalid username. If the score exceeds the configured threshold, the IP is banned. Omitted for banned IPs
  2597. ban_time:
  2598. type: string
  2599. format: date-time
  2600. description: date time until the IP is banned. For already banned hosts, the ban time is increased each time a new violation is detected. Omitted if the IP is not banned
  2601. SSHHostKey:
  2602. type: object
  2603. properties:
  2604. path:
  2605. type: string
  2606. fingerprint:
  2607. type: string
  2608. SSHBinding:
  2609. type: object
  2610. properties:
  2611. address:
  2612. type: string
  2613. description: TCP address the server listen on
  2614. port:
  2615. type: integer
  2616. description: the port used for serving requests
  2617. apply_proxy_config:
  2618. type: boolean
  2619. description: 'apply the proxy configuration, if any'
  2620. WebDAVBinding:
  2621. type: object
  2622. properties:
  2623. address:
  2624. type: string
  2625. description: TCP address the server listen on
  2626. port:
  2627. type: integer
  2628. description: the port used for serving requests
  2629. enable_https:
  2630. type: boolean
  2631. client_auth_type:
  2632. type: integer
  2633. description: 1 means that client certificate authentication is required in addition to HTTP basic authentication
  2634. FTPDBinding:
  2635. type: object
  2636. properties:
  2637. address:
  2638. type: string
  2639. description: TCP address the server listen on
  2640. port:
  2641. type: integer
  2642. description: the port used for serving requests
  2643. apply_proxy_config:
  2644. type: boolean
  2645. description: 'apply the proxy configuration, if any'
  2646. tls_mode:
  2647. type: integer
  2648. enum:
  2649. - 0
  2650. - 1
  2651. - 2
  2652. description: |
  2653. * `0` - clear or explicit TLS * `1` - explicit TLS required * `2` - implicit TLS
  2654. force_passive_ip:
  2655. type: string
  2656. description: External IP address to expose for passive connections
  2657. client_auth_type:
  2658. type: integer
  2659. description: 1 means that client certificate authentication is required in addition to FTP authentication
  2660. SSHServiceStatus:
  2661. type: object
  2662. properties:
  2663. is_active:
  2664. type: boolean
  2665. bindings:
  2666. type: array
  2667. items:
  2668. $ref: '#/components/schemas/SSHBinding'
  2669. nullable: true
  2670. host_keys:
  2671. type: array
  2672. items:
  2673. $ref: '#/components/schemas/SSHHostKey'
  2674. nullable: true
  2675. ssh_commands:
  2676. type: array
  2677. items:
  2678. type: string
  2679. FTPPassivePortRange:
  2680. type: object
  2681. properties:
  2682. start:
  2683. type: integer
  2684. end:
  2685. type: integer
  2686. FTPServiceStatus:
  2687. type: object
  2688. properties:
  2689. is_active:
  2690. type: boolean
  2691. bindings:
  2692. type: array
  2693. items:
  2694. $ref: '#/components/schemas/FTPDBinding'
  2695. nullable: true
  2696. passive_port_range:
  2697. $ref: '#/components/schemas/FTPPassivePortRange'
  2698. WebDAVServiceStatus:
  2699. type: object
  2700. properties:
  2701. is_active:
  2702. type: boolean
  2703. bindings:
  2704. type: array
  2705. items:
  2706. $ref: '#/components/schemas/WebDAVBinding'
  2707. nullable: true
  2708. DataProviderStatus:
  2709. type: object
  2710. properties:
  2711. is_active:
  2712. type: boolean
  2713. driver:
  2714. type: string
  2715. error:
  2716. type: string
  2717. ServicesStatus:
  2718. type: object
  2719. properties:
  2720. ssh:
  2721. $ref: '#/components/schemas/SSHServiceStatus'
  2722. ftp:
  2723. $ref: '#/components/schemas/FTPServiceStatus'
  2724. webdav:
  2725. $ref: '#/components/schemas/WebDAVServiceStatus'
  2726. data_provider:
  2727. $ref: '#/components/schemas/DataProviderStatus'
  2728. defender:
  2729. type: object
  2730. properties:
  2731. is_active:
  2732. type: boolean
  2733. BanStatus:
  2734. type: object
  2735. properties:
  2736. date_time:
  2737. type: string
  2738. format: date-time
  2739. nullable: true
  2740. description: if null the host is not banned
  2741. ScoreStatus:
  2742. type: object
  2743. properties:
  2744. score:
  2745. type: integer
  2746. description: if 0 the host is not listed
  2747. BackupData:
  2748. type: object
  2749. properties:
  2750. users:
  2751. type: array
  2752. items:
  2753. $ref: '#/components/schemas/User'
  2754. folders:
  2755. type: array
  2756. items:
  2757. $ref: '#/components/schemas/BaseVirtualFolder'
  2758. admins:
  2759. type: array
  2760. items:
  2761. $ref: '#/components/schemas/Admin'
  2762. version:
  2763. type: integer
  2764. PwdChange:
  2765. type: object
  2766. properties:
  2767. current_password:
  2768. type: string
  2769. new_password:
  2770. type: string
  2771. DirEntry:
  2772. type: object
  2773. properties:
  2774. name:
  2775. type: string
  2776. description: name of the file (or subdirectory) described by the entry. This name is the final element of the path (the base name), not the entire path
  2777. size:
  2778. type: integer
  2779. format: int64
  2780. description: file size, omitted for folders and non regular files
  2781. mode:
  2782. type: integer
  2783. description: |
  2784. File mode and permission bits. More details here: https://golang.org/pkg/io/fs/#FileMode.
  2785. Let's see some examples:
  2786. - for a directory mode&2147483648 != 0
  2787. - for a symlink mode&134217728 != 0
  2788. - for a regular file mode&2401763328 == 0
  2789. last_modified:
  2790. type: string
  2791. format: date-time
  2792. ApiResponse:
  2793. type: object
  2794. properties:
  2795. message:
  2796. type: string
  2797. description: 'message, can be empty'
  2798. error:
  2799. type: string
  2800. description: error description if any
  2801. VersionInfo:
  2802. type: object
  2803. properties:
  2804. version:
  2805. type: string
  2806. build_date:
  2807. type: string
  2808. commit_hash:
  2809. type: string
  2810. features:
  2811. type: array
  2812. items:
  2813. type: string
  2814. description: 'Features for the current build. Available features are "portable", "bolt", "mysql", "sqlite", "pgsql", "s3", "gcs", "metrics". If a feature is available it has a "+" prefix, otherwise a "-" prefix'
  2815. Token:
  2816. type: object
  2817. properties:
  2818. access_token:
  2819. type: string
  2820. expires_at:
  2821. type: string
  2822. format: date-time
  2823. securitySchemes:
  2824. BasicAuth:
  2825. type: http
  2826. scheme: basic
  2827. BearerAuth:
  2828. type: http
  2829. scheme: bearer
  2830. bearerFormat: JWT