openapi.yaml 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148
  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. info:
  13. title: SFTPGo
  14. description: SFTPGo REST API
  15. version: 2.0.4
  16. contact:
  17. url: 'https://github.com/drakkan/sftpgo'
  18. license:
  19. name: AGPLv3
  20. url: 'https://www.gnu.org/licenses/agpl-3.0.en.html'
  21. servers:
  22. - url: /api/v2
  23. security:
  24. - BearerAuth: []
  25. paths:
  26. /healthz:
  27. get:
  28. security: []
  29. servers:
  30. - url: /
  31. tags:
  32. - healthcheck
  33. summary: health check
  34. description: This endpoint can be used to check if the application is running and responding to requests
  35. operationId: healthz
  36. responses:
  37. '200':
  38. description: successful operation
  39. content:
  40. text/plain:
  41. schema:
  42. type: string
  43. example: ok
  44. /token:
  45. get:
  46. security:
  47. - BasicAuth: []
  48. tags:
  49. - token
  50. summary: Get a new access token
  51. description: Returns an access token and its expiration
  52. operationId: get_token
  53. responses:
  54. '200':
  55. description: successful operation
  56. content:
  57. application/json:
  58. schema:
  59. $ref: '#/components/schemas/Token'
  60. '401':
  61. $ref: '#/components/responses/Unauthorized'
  62. '403':
  63. $ref: '#/components/responses/Forbidden'
  64. '500':
  65. $ref: '#/components/responses/InternalServerError'
  66. default:
  67. $ref: '#/components/responses/DefaultResponse'
  68. /logout:
  69. get:
  70. tags:
  71. - token
  72. summary: Invalidate
  73. description: Allows to invalidate a token before its expiration
  74. operationId: logout
  75. responses:
  76. '200':
  77. description: successful operation
  78. content:
  79. application/json:
  80. schema:
  81. $ref: '#/components/schemas/ApiResponse'
  82. '401':
  83. $ref: '#/components/responses/Unauthorized'
  84. '403':
  85. $ref: '#/components/responses/Forbidden'
  86. '500':
  87. $ref: '#/components/responses/InternalServerError'
  88. default:
  89. $ref: '#/components/responses/DefaultResponse'
  90. /version:
  91. get:
  92. tags:
  93. - maintenance
  94. summary: Get version details
  95. description: 'Returns version details such as the version number, build date, commit hash and enabled features'
  96. operationId: get_version
  97. responses:
  98. '200':
  99. description: successful operation
  100. content:
  101. application/json:
  102. schema:
  103. $ref: '#/components/schemas/VersionInfo'
  104. '401':
  105. $ref: '#/components/responses/Unauthorized'
  106. '403':
  107. $ref: '#/components/responses/Forbidden'
  108. '500':
  109. $ref: '#/components/responses/InternalServerError'
  110. default:
  111. $ref: '#/components/responses/DefaultResponse'
  112. /changepwd/admin:
  113. put:
  114. tags:
  115. - admins
  116. summary: Change admin password
  117. description: Changes the password for the logged in admin
  118. operationId: change_admin_password
  119. requestBody:
  120. required: true
  121. content:
  122. application/json:
  123. schema:
  124. $ref: '#/components/schemas/PwdChange'
  125. responses:
  126. '200':
  127. description: successful operation
  128. content:
  129. application/json:
  130. schema:
  131. $ref: '#/components/schemas/ApiResponse'
  132. '401':
  133. $ref: '#/components/responses/Unauthorized'
  134. '403':
  135. $ref: '#/components/responses/Forbidden'
  136. '500':
  137. $ref: '#/components/responses/InternalServerError'
  138. default:
  139. $ref: '#/components/responses/DefaultResponse'
  140. /connections:
  141. get:
  142. tags:
  143. - connections
  144. summary: Get connections details
  145. description: Returns the active users and info about their current uploads/downloads
  146. operationId: get_connections
  147. responses:
  148. '200':
  149. description: successful operation
  150. content:
  151. application/json:
  152. schema:
  153. type: array
  154. items:
  155. $ref: '#/components/schemas/ConnectionStatus'
  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. '/connections/{connectionID}':
  165. delete:
  166. tags:
  167. - connections
  168. summary: Close connection
  169. description: Terminates an active connection
  170. operationId: close_connection
  171. parameters:
  172. - name: connectionID
  173. in: path
  174. description: ID of the connection to close
  175. required: true
  176. schema:
  177. type: string
  178. responses:
  179. '200':
  180. description: successful operation
  181. content:
  182. application/json:
  183. schema:
  184. $ref: '#/components/schemas/ApiResponse'
  185. example:
  186. message: Connection closed
  187. '401':
  188. $ref: '#/components/responses/Unauthorized'
  189. '403':
  190. $ref: '#/components/responses/Forbidden'
  191. '404':
  192. $ref: '#/components/responses/NotFound'
  193. '500':
  194. $ref: '#/components/responses/InternalServerError'
  195. default:
  196. $ref: '#/components/responses/DefaultResponse'
  197. /defender/bantime:
  198. get:
  199. tags:
  200. - defender
  201. summary: Get ban time
  202. description: Returns the ban time for the specified IPv4/IPv6 address
  203. operationId: get_ban_time
  204. parameters:
  205. - in: query
  206. name: ip
  207. required: true
  208. description: IPv4/IPv6 address
  209. schema:
  210. type: string
  211. responses:
  212. '200':
  213. description: successful operation
  214. content:
  215. application/json:
  216. schema:
  217. $ref: '#/components/schemas/BanStatus'
  218. '401':
  219. $ref: '#/components/responses/Unauthorized'
  220. '403':
  221. $ref: '#/components/responses/Forbidden'
  222. '404':
  223. $ref: '#/components/responses/NotFound'
  224. '500':
  225. $ref: '#/components/responses/InternalServerError'
  226. default:
  227. $ref: '#/components/responses/DefaultResponse'
  228. /defender/unban:
  229. post:
  230. tags:
  231. - defender
  232. summary: Unban
  233. description: Removes the specified IPv4/IPv6 from the banned ones
  234. operationId: unban_host
  235. requestBody:
  236. required: true
  237. content:
  238. application/json:
  239. schema:
  240. type: object
  241. properties:
  242. ip:
  243. type: string
  244. description: IPv4/IPv6 address to remove
  245. responses:
  246. '200':
  247. description: successful operation
  248. content:
  249. application/json:
  250. schema:
  251. $ref: '#/components/schemas/ApiResponse'
  252. '400':
  253. $ref: '#/components/responses/BadRequest'
  254. '401':
  255. $ref: '#/components/responses/Unauthorized'
  256. '403':
  257. $ref: '#/components/responses/Forbidden'
  258. '404':
  259. $ref: '#/components/responses/NotFound'
  260. '500':
  261. $ref: '#/components/responses/InternalServerError'
  262. default:
  263. $ref: '#/components/responses/DefaultResponse'
  264. /defender/score:
  265. get:
  266. tags:
  267. - defender
  268. summary: Get score
  269. description: Returns the score for the specified IPv4/IPv6 address
  270. operationId: get_score
  271. parameters:
  272. - in: query
  273. name: ip
  274. required: true
  275. description: IPv4/IPv6 address
  276. schema:
  277. type: string
  278. responses:
  279. '200':
  280. description: successful operation
  281. content:
  282. application/json:
  283. schema:
  284. $ref: '#/components/schemas/ScoreStatus'
  285. '401':
  286. $ref: '#/components/responses/Unauthorized'
  287. '403':
  288. $ref: '#/components/responses/Forbidden'
  289. '404':
  290. $ref: '#/components/responses/NotFound'
  291. '500':
  292. $ref: '#/components/responses/InternalServerError'
  293. default:
  294. $ref: '#/components/responses/DefaultResponse'
  295. /quota-scans:
  296. get:
  297. tags:
  298. - quota
  299. summary: Get quota scans
  300. description: Returns active user quota scans
  301. operationId: get_quota_scans
  302. responses:
  303. '200':
  304. description: successful operation
  305. content:
  306. application/json:
  307. schema:
  308. type: array
  309. items:
  310. $ref: '#/components/schemas/QuotaScan'
  311. '401':
  312. $ref: '#/components/responses/Unauthorized'
  313. '403':
  314. $ref: '#/components/responses/Forbidden'
  315. '500':
  316. $ref: '#/components/responses/InternalServerError'
  317. default:
  318. $ref: '#/components/responses/DefaultResponse'
  319. post:
  320. tags:
  321. - quota
  322. summary: Start user quota scan
  323. description: Starts a new quota scan for the given user. A quota scan update the number of files and their total size for the specified user
  324. operationId: start_quota_scan
  325. requestBody:
  326. required: true
  327. content:
  328. application/json:
  329. schema:
  330. $ref: '#/components/schemas/User'
  331. responses:
  332. '202':
  333. description: successful operation
  334. content:
  335. application/json:
  336. schema:
  337. $ref: '#/components/schemas/ApiResponse'
  338. example:
  339. message: Scan started
  340. '400':
  341. $ref: '#/components/responses/BadRequest'
  342. '401':
  343. $ref: '#/components/responses/Unauthorized'
  344. '403':
  345. $ref: '#/components/responses/Forbidden'
  346. '404':
  347. $ref: '#/components/responses/NotFound'
  348. '409':
  349. $ref: '#/components/responses/Conflict'
  350. '500':
  351. $ref: '#/components/responses/InternalServerError'
  352. default:
  353. $ref: '#/components/responses/DefaultResponse'
  354. /quota-update:
  355. put:
  356. tags:
  357. - quota
  358. summary: Update user quota limits
  359. description: Sets the current used quota limits for the given user
  360. operationId: quota_update
  361. parameters:
  362. - in: query
  363. name: mode
  364. required: false
  365. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  366. schema:
  367. type: string
  368. enum:
  369. - add
  370. - reset
  371. description: |
  372. Update type:
  373. * `add` - add the specified quota limits to the current used ones
  374. * `reset` - reset the values to the specified ones. This is the default
  375. example: reset
  376. requestBody:
  377. required: true
  378. 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'
  379. content:
  380. application/json:
  381. schema:
  382. $ref: '#/components/schemas/User'
  383. responses:
  384. '200':
  385. description: successful operation
  386. content:
  387. application/json:
  388. schema:
  389. $ref: '#/components/schemas/ApiResponse'
  390. example:
  391. message: Quota updated
  392. '400':
  393. $ref: '#/components/responses/BadRequest'
  394. '401':
  395. $ref: '#/components/responses/Unauthorized'
  396. '403':
  397. $ref: '#/components/responses/Forbidden'
  398. '404':
  399. $ref: '#/components/responses/NotFound'
  400. '409':
  401. $ref: '#/components/responses/Conflict'
  402. '500':
  403. $ref: '#/components/responses/InternalServerError'
  404. default:
  405. $ref: '#/components/responses/DefaultResponse'
  406. /folder-quota-update:
  407. put:
  408. tags:
  409. - quota
  410. summary: Update folder quota limits
  411. description: Sets the current used quota limits for the given folder
  412. operationId: folder_quota_update
  413. parameters:
  414. - in: query
  415. name: mode
  416. required: false
  417. description: the update mode specifies if the given quota usage values should be added or replace the current ones
  418. schema:
  419. type: string
  420. enum:
  421. - add
  422. - reset
  423. description: |
  424. Update type:
  425. * `add` - add the specified quota limits to the current used ones
  426. * `reset` - reset the values to the specified ones. This is the default
  427. example: reset
  428. requestBody:
  429. required: true
  430. 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'
  431. content:
  432. application/json:
  433. schema:
  434. $ref: '#/components/schemas/BaseVirtualFolder'
  435. responses:
  436. '200':
  437. description: successful operation
  438. content:
  439. application/json:
  440. schema:
  441. $ref: '#/components/schemas/ApiResponse'
  442. example:
  443. message: Quota updated
  444. '400':
  445. $ref: '#/components/responses/BadRequest'
  446. '401':
  447. $ref: '#/components/responses/Unauthorized'
  448. '403':
  449. $ref: '#/components/responses/Forbidden'
  450. '404':
  451. $ref: '#/components/responses/NotFound'
  452. '409':
  453. $ref: '#/components/responses/Conflict'
  454. '500':
  455. $ref: '#/components/responses/InternalServerError'
  456. default:
  457. $ref: '#/components/responses/DefaultResponse'
  458. /folder-quota-scans:
  459. get:
  460. tags:
  461. - quota
  462. summary: Get folders quota scans
  463. description: Returns the active quota scans for folders
  464. operationId: get_folders_quota_scans
  465. responses:
  466. '200':
  467. description: successful operation
  468. content:
  469. application/json:
  470. schema:
  471. type: array
  472. items:
  473. $ref: '#/components/schemas/FolderQuotaScan'
  474. '401':
  475. $ref: '#/components/responses/Unauthorized'
  476. '403':
  477. $ref: '#/components/responses/Forbidden'
  478. '500':
  479. $ref: '#/components/responses/InternalServerError'
  480. default:
  481. $ref: '#/components/responses/DefaultResponse'
  482. post:
  483. tags:
  484. - quota
  485. summary: Start folder quota scan
  486. 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
  487. operationId: start_folder_quota_scan
  488. requestBody:
  489. required: true
  490. content:
  491. application/json:
  492. schema:
  493. $ref: '#/components/schemas/BaseVirtualFolder'
  494. responses:
  495. '202':
  496. description: successful operation
  497. content:
  498. application/json:
  499. schema:
  500. $ref: '#/components/schemas/ApiResponse'
  501. example:
  502. message: Scan started
  503. '400':
  504. $ref: '#/components/responses/BadRequest'
  505. '401':
  506. $ref: '#/components/responses/Unauthorized'
  507. '403':
  508. $ref: '#/components/responses/Forbidden'
  509. '404':
  510. $ref: '#/components/responses/NotFound'
  511. '409':
  512. $ref: '#/components/responses/Conflict'
  513. '500':
  514. $ref: '#/components/responses/InternalServerError'
  515. default:
  516. $ref: '#/components/responses/DefaultResponse'
  517. /folders:
  518. get:
  519. tags:
  520. - folders
  521. summary: Get folders
  522. description: Returns an array with one or more folders
  523. operationId: get_folders
  524. parameters:
  525. - in: query
  526. name: offset
  527. schema:
  528. type: integer
  529. minimum: 0
  530. default: 0
  531. required: false
  532. - in: query
  533. name: limit
  534. schema:
  535. type: integer
  536. minimum: 1
  537. maximum: 500
  538. default: 100
  539. required: false
  540. description: 'The maximum number of items to return. Max value is 500, default is 100'
  541. - in: query
  542. name: order
  543. required: false
  544. description: Ordering folders by path. Default ASC
  545. schema:
  546. type: string
  547. enum:
  548. - ASC
  549. - DESC
  550. example: ASC
  551. responses:
  552. '200':
  553. description: successful operation
  554. content:
  555. application/json:
  556. schema:
  557. type: array
  558. items:
  559. $ref: '#/components/schemas/BaseVirtualFolder'
  560. '400':
  561. $ref: '#/components/responses/BadRequest'
  562. '401':
  563. $ref: '#/components/responses/Unauthorized'
  564. '403':
  565. $ref: '#/components/responses/Forbidden'
  566. '500':
  567. $ref: '#/components/responses/InternalServerError'
  568. default:
  569. $ref: '#/components/responses/DefaultResponse'
  570. post:
  571. tags:
  572. - folders
  573. summary: Add folder
  574. operationId: add_folder
  575. description: Adds a new folder. A quota scan is required to update the used files/size
  576. requestBody:
  577. required: true
  578. content:
  579. application/json:
  580. schema:
  581. $ref: '#/components/schemas/BaseVirtualFolder'
  582. responses:
  583. '201':
  584. description: successful operation
  585. content:
  586. application/json:
  587. schema:
  588. $ref: '#/components/schemas/BaseVirtualFolder'
  589. '400':
  590. $ref: '#/components/responses/BadRequest'
  591. '401':
  592. $ref: '#/components/responses/Unauthorized'
  593. '403':
  594. $ref: '#/components/responses/Forbidden'
  595. '500':
  596. $ref: '#/components/responses/InternalServerError'
  597. default:
  598. $ref: '#/components/responses/DefaultResponse'
  599. '/folders/{name}':
  600. parameters:
  601. - name: name
  602. in: path
  603. description: folder name
  604. required: true
  605. schema:
  606. type: string
  607. get:
  608. tags:
  609. - folders
  610. summary: Find folders by name
  611. description: Returns the folder with the given name if it exists.
  612. operationId: get_folder_by_name
  613. responses:
  614. '200':
  615. description: successful operation
  616. content:
  617. application/json:
  618. schema:
  619. $ref: '#/components/schemas/BaseVirtualFolder'
  620. '400':
  621. $ref: '#/components/responses/BadRequest'
  622. '401':
  623. $ref: '#/components/responses/Unauthorized'
  624. '403':
  625. $ref: '#/components/responses/Forbidden'
  626. '404':
  627. $ref: '#/components/responses/NotFound'
  628. '500':
  629. $ref: '#/components/responses/InternalServerError'
  630. default:
  631. $ref: '#/components/responses/DefaultResponse'
  632. put:
  633. tags:
  634. - folders
  635. summary: Update folder
  636. description: Updates an existing folder
  637. operationId: update_folder
  638. requestBody:
  639. required: true
  640. content:
  641. application/json:
  642. schema:
  643. $ref: '#/components/schemas/BaseVirtualFolder'
  644. responses:
  645. '200':
  646. description: successful operation
  647. content:
  648. application/json:
  649. schema:
  650. $ref: '#/components/schemas/ApiResponse'
  651. example:
  652. message: User updated
  653. '400':
  654. $ref: '#/components/responses/BadRequest'
  655. '401':
  656. $ref: '#/components/responses/Unauthorized'
  657. '403':
  658. $ref: '#/components/responses/Forbidden'
  659. '404':
  660. $ref: '#/components/responses/NotFound'
  661. '500':
  662. $ref: '#/components/responses/InternalServerError'
  663. default:
  664. $ref: '#/components/responses/DefaultResponse'
  665. delete:
  666. tags:
  667. - folders
  668. summary: Delete folder
  669. description: Deletes an existing folder
  670. operationId: delete_folder
  671. responses:
  672. '200':
  673. description: successful operation
  674. content:
  675. application/json:
  676. schema:
  677. $ref: '#/components/schemas/ApiResponse'
  678. example:
  679. message: User deleted
  680. '400':
  681. $ref: '#/components/responses/BadRequest'
  682. '401':
  683. $ref: '#/components/responses/Unauthorized'
  684. '403':
  685. $ref: '#/components/responses/Forbidden'
  686. '404':
  687. $ref: '#/components/responses/NotFound'
  688. '500':
  689. $ref: '#/components/responses/InternalServerError'
  690. default:
  691. $ref: '#/components/responses/DefaultResponse'
  692. /admins:
  693. get:
  694. tags:
  695. - admins
  696. summary: Get admins
  697. description: Returns an array with one or more admins. For security reasons hashed passwords are omitted in the response
  698. operationId: get_admins
  699. parameters:
  700. - in: query
  701. name: offset
  702. schema:
  703. type: integer
  704. minimum: 0
  705. default: 0
  706. required: false
  707. - in: query
  708. name: limit
  709. schema:
  710. type: integer
  711. minimum: 1
  712. maximum: 500
  713. default: 100
  714. required: false
  715. description: 'The maximum number of items to return. Max value is 500, default is 100'
  716. - in: query
  717. name: order
  718. required: false
  719. description: Ordering admins by username. Default ASC
  720. schema:
  721. type: string
  722. enum:
  723. - ASC
  724. - DESC
  725. example: ASC
  726. responses:
  727. '200':
  728. description: successful operation
  729. content:
  730. application/json:
  731. schema:
  732. type: array
  733. items:
  734. $ref: '#/components/schemas/Admin'
  735. '400':
  736. $ref: '#/components/responses/BadRequest'
  737. '401':
  738. $ref: '#/components/responses/Unauthorized'
  739. '403':
  740. $ref: '#/components/responses/Forbidden'
  741. '500':
  742. $ref: '#/components/responses/InternalServerError'
  743. default:
  744. $ref: '#/components/responses/DefaultResponse'
  745. post:
  746. tags:
  747. - admins
  748. summary: Add admin
  749. description: Adds a new admin
  750. operationId: add_admin
  751. requestBody:
  752. required: true
  753. content:
  754. application/json:
  755. schema:
  756. $ref: '#/components/schemas/Admin'
  757. examples:
  758. example-1:
  759. value:
  760. id: 1
  761. status: 0
  762. username: string
  763. description: string
  764. password: pa$$word
  765. email: [email protected]
  766. permissions:
  767. - '*'
  768. filters:
  769. allow_list:
  770. - 192.0.2.0/24
  771. - '2001:db8::/32'
  772. additional_info: string
  773. responses:
  774. '201':
  775. description: successful operation
  776. content:
  777. application/json:
  778. schema:
  779. $ref: '#/components/schemas/Admin'
  780. '400':
  781. $ref: '#/components/responses/BadRequest'
  782. '401':
  783. $ref: '#/components/responses/Unauthorized'
  784. '403':
  785. $ref: '#/components/responses/Forbidden'
  786. '500':
  787. $ref: '#/components/responses/InternalServerError'
  788. default:
  789. $ref: '#/components/responses/DefaultResponse'
  790. '/admins/{username}':
  791. parameters:
  792. - name: username
  793. in: path
  794. description: the admin username
  795. required: true
  796. schema:
  797. type: string
  798. get:
  799. tags:
  800. - admins
  801. summary: Find admins by username
  802. description: Returns the admin with the given username, if it exists. For security reasons the hashed password is omitted in the response
  803. operationId: get_admin_by_username
  804. responses:
  805. '200':
  806. description: successful operation
  807. content:
  808. application/json:
  809. schema:
  810. $ref: '#/components/schemas/Admin'
  811. '400':
  812. $ref: '#/components/responses/BadRequest'
  813. '401':
  814. $ref: '#/components/responses/Unauthorized'
  815. '403':
  816. $ref: '#/components/responses/Forbidden'
  817. '404':
  818. $ref: '#/components/responses/NotFound'
  819. '500':
  820. $ref: '#/components/responses/InternalServerError'
  821. default:
  822. $ref: '#/components/responses/DefaultResponse'
  823. put:
  824. tags:
  825. - admins
  826. summary: Update admin
  827. description: Updates an existing admin
  828. operationId: update_admin
  829. requestBody:
  830. required: true
  831. content:
  832. application/json:
  833. schema:
  834. $ref: '#/components/schemas/Admin'
  835. responses:
  836. '200':
  837. description: successful operation
  838. content:
  839. application/json:
  840. schema:
  841. $ref: '#/components/schemas/ApiResponse'
  842. example:
  843. message: Admin updated
  844. '400':
  845. $ref: '#/components/responses/BadRequest'
  846. '401':
  847. $ref: '#/components/responses/Unauthorized'
  848. '403':
  849. $ref: '#/components/responses/Forbidden'
  850. '404':
  851. $ref: '#/components/responses/NotFound'
  852. '500':
  853. $ref: '#/components/responses/InternalServerError'
  854. default:
  855. $ref: '#/components/responses/DefaultResponse'
  856. delete:
  857. tags:
  858. - admins
  859. summary: Delete admin
  860. description: Deletes an existing admin
  861. operationId: delete_admin
  862. responses:
  863. '200':
  864. description: successful operation
  865. content:
  866. application/json:
  867. schema:
  868. $ref: '#/components/schemas/ApiResponse'
  869. example:
  870. message: Admin deleted
  871. '400':
  872. $ref: '#/components/responses/BadRequest'
  873. '401':
  874. $ref: '#/components/responses/Unauthorized'
  875. '403':
  876. $ref: '#/components/responses/Forbidden'
  877. '404':
  878. $ref: '#/components/responses/NotFound'
  879. '500':
  880. $ref: '#/components/responses/InternalServerError'
  881. default:
  882. $ref: '#/components/responses/DefaultResponse'
  883. /users:
  884. get:
  885. tags:
  886. - users
  887. summary: Get users
  888. description: Returns an array with one or more users. For security reasons hashed passwords are omitted in the response
  889. operationId: get_users
  890. parameters:
  891. - in: query
  892. name: offset
  893. schema:
  894. type: integer
  895. minimum: 0
  896. default: 0
  897. required: false
  898. - in: query
  899. name: limit
  900. schema:
  901. type: integer
  902. minimum: 1
  903. maximum: 500
  904. default: 100
  905. required: false
  906. description: 'The maximum number of items to return. Max value is 500, default is 100'
  907. - in: query
  908. name: order
  909. required: false
  910. description: Ordering users by username. Default ASC
  911. schema:
  912. type: string
  913. enum:
  914. - ASC
  915. - DESC
  916. example: ASC
  917. responses:
  918. '200':
  919. description: successful operation
  920. content:
  921. application/json:
  922. schema:
  923. type: array
  924. items:
  925. $ref: '#/components/schemas/User'
  926. '400':
  927. $ref: '#/components/responses/BadRequest'
  928. '401':
  929. $ref: '#/components/responses/Unauthorized'
  930. '403':
  931. $ref: '#/components/responses/Forbidden'
  932. '500':
  933. $ref: '#/components/responses/InternalServerError'
  934. default:
  935. $ref: '#/components/responses/DefaultResponse'
  936. post:
  937. tags:
  938. - users
  939. summary: Add user
  940. description: Adds a new user
  941. operationId: add_user
  942. requestBody:
  943. required: true
  944. content:
  945. application/json:
  946. schema:
  947. $ref: '#/components/schemas/User'
  948. responses:
  949. '201':
  950. description: successful operation
  951. content:
  952. application/json:
  953. schema:
  954. $ref: '#/components/schemas/User'
  955. '400':
  956. $ref: '#/components/responses/BadRequest'
  957. '401':
  958. $ref: '#/components/responses/Unauthorized'
  959. '403':
  960. $ref: '#/components/responses/Forbidden'
  961. '500':
  962. $ref: '#/components/responses/InternalServerError'
  963. default:
  964. $ref: '#/components/responses/DefaultResponse'
  965. '/users/{username}':
  966. parameters:
  967. - name: username
  968. in: path
  969. description: the username
  970. required: true
  971. schema:
  972. type: string
  973. get:
  974. tags:
  975. - users
  976. summary: Find users by username
  977. description: Returns the user with the given username if it exists. For security reasons the hashed password is omitted in the response
  978. operationId: get_user_by_username
  979. responses:
  980. '200':
  981. description: successful operation
  982. content:
  983. application/json:
  984. schema:
  985. $ref: '#/components/schemas/User'
  986. '400':
  987. $ref: '#/components/responses/BadRequest'
  988. '401':
  989. $ref: '#/components/responses/Unauthorized'
  990. '403':
  991. $ref: '#/components/responses/Forbidden'
  992. '404':
  993. $ref: '#/components/responses/NotFound'
  994. '500':
  995. $ref: '#/components/responses/InternalServerError'
  996. default:
  997. $ref: '#/components/responses/DefaultResponse'
  998. put:
  999. tags:
  1000. - users
  1001. summary: Update user
  1002. description: 'Updates an existing user and optionally disconnects it, if connected, to apply the new settings'
  1003. operationId: update_user
  1004. parameters:
  1005. - in: query
  1006. name: disconnect
  1007. schema:
  1008. type: integer
  1009. enum:
  1010. - 0
  1011. - 1
  1012. description: |
  1013. Disconnect:
  1014. * `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default
  1015. * `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
  1016. requestBody:
  1017. required: true
  1018. content:
  1019. application/json:
  1020. schema:
  1021. $ref: '#/components/schemas/User'
  1022. responses:
  1023. '200':
  1024. description: successful operation
  1025. content:
  1026. application/json:
  1027. schema:
  1028. $ref: '#/components/schemas/ApiResponse'
  1029. example:
  1030. message: User updated
  1031. '400':
  1032. $ref: '#/components/responses/BadRequest'
  1033. '401':
  1034. $ref: '#/components/responses/Unauthorized'
  1035. '403':
  1036. $ref: '#/components/responses/Forbidden'
  1037. '404':
  1038. $ref: '#/components/responses/NotFound'
  1039. '500':
  1040. $ref: '#/components/responses/InternalServerError'
  1041. default:
  1042. $ref: '#/components/responses/DefaultResponse'
  1043. delete:
  1044. tags:
  1045. - users
  1046. summary: Delete user
  1047. description: Deletes an existing user
  1048. operationId: delete_user
  1049. responses:
  1050. '200':
  1051. description: successful operation
  1052. content:
  1053. application/json:
  1054. schema:
  1055. $ref: '#/components/schemas/ApiResponse'
  1056. example:
  1057. message: User deleted
  1058. '400':
  1059. $ref: '#/components/responses/BadRequest'
  1060. '401':
  1061. $ref: '#/components/responses/Unauthorized'
  1062. '403':
  1063. $ref: '#/components/responses/Forbidden'
  1064. '404':
  1065. $ref: '#/components/responses/NotFound'
  1066. '500':
  1067. $ref: '#/components/responses/InternalServerError'
  1068. default:
  1069. $ref: '#/components/responses/DefaultResponse'
  1070. /status:
  1071. get:
  1072. tags:
  1073. - maintenance
  1074. summary: Get status
  1075. description: Retrieves the status of the active services
  1076. operationId: get_status
  1077. responses:
  1078. '200':
  1079. description: successful operation
  1080. content:
  1081. application/json:
  1082. schema:
  1083. $ref: '#/components/schemas/ServicesStatus'
  1084. '400':
  1085. $ref: '#/components/responses/BadRequest'
  1086. '401':
  1087. $ref: '#/components/responses/Unauthorized'
  1088. '403':
  1089. $ref: '#/components/responses/Forbidden'
  1090. '500':
  1091. $ref: '#/components/responses/InternalServerError'
  1092. default:
  1093. $ref: '#/components/responses/DefaultResponse'
  1094. /dumpdata:
  1095. get:
  1096. tags:
  1097. - maintenance
  1098. summary: Dump data
  1099. 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'
  1100. operationId: dumpdata
  1101. parameters:
  1102. - in: query
  1103. name: output-file
  1104. schema:
  1105. type: string
  1106. 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.
  1107. - in: query
  1108. name: output-data
  1109. schema:
  1110. type: integer
  1111. enum:
  1112. - 0
  1113. - 1
  1114. description: |
  1115. output data:
  1116. * `0` or any other value != 1, the backup will be saved to a file on the server, `output_file` is required
  1117. * `1` the backup will be returned as response body
  1118. - in: query
  1119. name: indent
  1120. schema:
  1121. type: integer
  1122. enum:
  1123. - 0
  1124. - 1
  1125. description: |
  1126. indent:
  1127. * `0` no indentation. This is the default
  1128. * `1` format the output JSON
  1129. responses:
  1130. '200':
  1131. description: successful operation
  1132. content:
  1133. application/json:
  1134. schema:
  1135. oneOf:
  1136. - $ref: '#/components/schemas/ApiResponse'
  1137. - $ref: '#/components/schemas/BackupData'
  1138. '400':
  1139. $ref: '#/components/responses/BadRequest'
  1140. '401':
  1141. $ref: '#/components/responses/Unauthorized'
  1142. '403':
  1143. $ref: '#/components/responses/Forbidden'
  1144. '500':
  1145. $ref: '#/components/responses/InternalServerError'
  1146. default:
  1147. $ref: '#/components/responses/DefaultResponse'
  1148. /loaddata:
  1149. parameters:
  1150. - in: query
  1151. name: scan-quota
  1152. schema:
  1153. type: integer
  1154. enum:
  1155. - 0
  1156. - 1
  1157. - 2
  1158. description: |
  1159. Quota scan:
  1160. * `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
  1161. * `1` scan quota
  1162. * `2` scan quota if the user has quota restrictions
  1163. required: false
  1164. - in: query
  1165. name: mode
  1166. schema:
  1167. type: integer
  1168. enum:
  1169. - 0
  1170. - 1
  1171. - 2
  1172. description: |
  1173. Mode:
  1174. * `0` New users/admins are added, existing users/admins are updated. This is the default
  1175. * `1` New users/admins are added, existing users/admins are not modified
  1176. * `2` New users are added, existing users are updated and, if connected, they are disconnected and so forced to use the new configuration
  1177. get:
  1178. tags:
  1179. - maintenance
  1180. summary: Load data from path
  1181. 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'
  1182. operationId: loaddata_from_file
  1183. parameters:
  1184. - in: query
  1185. name: input-file
  1186. schema:
  1187. type: string
  1188. required: true
  1189. 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
  1190. responses:
  1191. '200':
  1192. description: successful operation
  1193. content:
  1194. application/json:
  1195. schema:
  1196. $ref: '#/components/schemas/ApiResponse'
  1197. example:
  1198. message: Data restored
  1199. '400':
  1200. $ref: '#/components/responses/BadRequest'
  1201. '401':
  1202. $ref: '#/components/responses/Unauthorized'
  1203. '403':
  1204. $ref: '#/components/responses/Forbidden'
  1205. '500':
  1206. $ref: '#/components/responses/InternalServerError'
  1207. default:
  1208. $ref: '#/components/responses/DefaultResponse'
  1209. post:
  1210. tags:
  1211. - maintenance
  1212. summary: Load data
  1213. 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'
  1214. operationId: loaddata_from_request_body
  1215. requestBody:
  1216. required: true
  1217. content:
  1218. application/json:
  1219. schema:
  1220. $ref: '#/components/schemas/BackupData'
  1221. responses:
  1222. '200':
  1223. description: successful operation
  1224. content:
  1225. application/json:
  1226. schema:
  1227. $ref: '#/components/schemas/ApiResponse'
  1228. example:
  1229. message: Data restored
  1230. '400':
  1231. $ref: '#/components/responses/BadRequest'
  1232. '401':
  1233. $ref: '#/components/responses/Unauthorized'
  1234. '403':
  1235. $ref: '#/components/responses/Forbidden'
  1236. '500':
  1237. $ref: '#/components/responses/InternalServerError'
  1238. default:
  1239. $ref: '#/components/responses/DefaultResponse'
  1240. components:
  1241. responses:
  1242. BadRequest:
  1243. description: Bad Request
  1244. content:
  1245. application/json:
  1246. schema:
  1247. $ref: '#/components/schemas/ApiResponse'
  1248. Unauthorized:
  1249. description: Unauthorized
  1250. content:
  1251. application/json:
  1252. schema:
  1253. $ref: '#/components/schemas/ApiResponse'
  1254. Forbidden:
  1255. description: Forbidden
  1256. content:
  1257. application/json:
  1258. schema:
  1259. $ref: '#/components/schemas/ApiResponse'
  1260. NotFound:
  1261. description: Not Found
  1262. content:
  1263. application/json:
  1264. schema:
  1265. $ref: '#/components/schemas/ApiResponse'
  1266. Conflict:
  1267. description: Conflict
  1268. content:
  1269. application/json:
  1270. schema:
  1271. $ref: '#/components/schemas/ApiResponse'
  1272. InternalServerError:
  1273. description: Internal Server Error
  1274. content:
  1275. application/json:
  1276. schema:
  1277. $ref: '#/components/schemas/ApiResponse'
  1278. DefaultResponse:
  1279. description: Unexpected Error
  1280. content:
  1281. application/json:
  1282. schema:
  1283. $ref: '#/components/schemas/ApiResponse'
  1284. schemas:
  1285. Permission:
  1286. type: string
  1287. enum:
  1288. - '*'
  1289. - list
  1290. - download
  1291. - upload
  1292. - overwrite
  1293. - delete
  1294. - rename
  1295. - create_dirs
  1296. - create_symlinks
  1297. - chmod
  1298. - chown
  1299. - chtimes
  1300. description: |
  1301. Permissions:
  1302. * `*` - all permissions are granted
  1303. * `list` - list items is allowed
  1304. * `download` - download files is allowed
  1305. * `upload` - upload files is allowed
  1306. * `overwrite` - overwrite an existing file, while uploading, is allowed. upload permission is required to allow file overwrite
  1307. * `delete` - delete files or directories is allowed
  1308. * `rename` - rename files or directories is allowed
  1309. * `create_dirs` - create directories is allowed
  1310. * `create_symlinks` - create links is allowed
  1311. * `chmod` changing file or directory permissions is allowed
  1312. * `chown` changing file or directory owner and group is allowed
  1313. * `chtimes` changing file or directory access and modification time is allowed
  1314. DirPermissions:
  1315. type: object
  1316. additionalProperties:
  1317. type: array
  1318. items:
  1319. $ref: '#/components/schemas/Permission'
  1320. minItems: 1
  1321. minProperties: 1
  1322. 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'
  1323. AdminPermissions:
  1324. type: string
  1325. enum:
  1326. - '*'
  1327. - add_users
  1328. - edit_users
  1329. - del_users
  1330. - view_users
  1331. - view_conns
  1332. - close_conns
  1333. - view_status
  1334. - manage_admins
  1335. - quota_scans
  1336. - manage_system
  1337. - manage_defender
  1338. - view_defender
  1339. description: |
  1340. Admin permissions:
  1341. * `*` - all permissions are granted
  1342. * `add_users` - add new users is allowed
  1343. * `edit_users` - change existing users is allowed
  1344. * `del_users` - remove users is allowed
  1345. * `view_users` - list users is allowed
  1346. * `view_conns` - list active connections is allowed
  1347. * `close_conns` - close active connections is allowed
  1348. * `view_status` - view the server status is allowed
  1349. * `manage_admins` - manage other admins is allowed
  1350. * `manage_defender` - remove ip from the dynamic blocklist is allowed
  1351. * `view_defender` - list the dynamic blocklist is allowed
  1352. LoginMethods:
  1353. type: string
  1354. enum:
  1355. - publickey
  1356. - password
  1357. - keyboard-interactive
  1358. - publickey+password
  1359. - publickey+keyboard-interactive
  1360. - TLSCertificate
  1361. - TLSCertificate+password
  1362. description: |
  1363. Available login methods. To enable multi-step authentication you have to allow only multi-step login methods
  1364. * `publickey`
  1365. * `password`
  1366. * `keyboard-interactive`
  1367. * `publickey+password` - multi-step auth: public key and password
  1368. * `publickey+keyboard-interactive` - multi-step auth: public key and keyboard interactive
  1369. * `TLSCertificate`
  1370. * `TLSCertificate+password` - multi-step auth: TLS client certificate and password
  1371. SupportedProtocols:
  1372. type: string
  1373. enum:
  1374. - SSH
  1375. - FTP
  1376. - DAV
  1377. description: |
  1378. Protocols:
  1379. * `SSH` - includes both SFTP and SSH commands
  1380. * `FTP` - plain FTP and FTPES/FTPS
  1381. * `DAV` - WebDAV over HTTP/HTTPS
  1382. PatternsFilter:
  1383. type: object
  1384. properties:
  1385. path:
  1386. type: string
  1387. 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'
  1388. allowed_patterns:
  1389. type: array
  1390. items:
  1391. type: string
  1392. description: 'list of, case insensitive, allowed shell like file patterns.'
  1393. example:
  1394. - '*.jpg'
  1395. - a*b?.png
  1396. denied_patterns:
  1397. type: array
  1398. items:
  1399. type: string
  1400. description: 'list of, case insensitive, denied shell like file patterns. Denied patterns are evaluated before the allowed ones'
  1401. example:
  1402. - '*.zip'
  1403. ExtensionsFilter:
  1404. type: object
  1405. properties:
  1406. path:
  1407. type: string
  1408. 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'
  1409. allowed_extensions:
  1410. type: array
  1411. items:
  1412. type: string
  1413. description: 'list of, case insensitive, allowed files extension. Shell like expansion is not supported so you have to specify `.jpg` and not `*.jpg`'
  1414. example:
  1415. - .jpg
  1416. - .png
  1417. denied_extensions:
  1418. type: array
  1419. items:
  1420. type: string
  1421. description: 'list of, case insensitive, denied files extension. Denied file extensions are evaluated before the allowed ones'
  1422. example:
  1423. - .zip
  1424. UserFilters:
  1425. type: object
  1426. properties:
  1427. allowed_ip:
  1428. type: array
  1429. items:
  1430. type: string
  1431. 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"'
  1432. example:
  1433. - 192.0.2.0/24
  1434. - '2001:db8::/32'
  1435. denied_ip:
  1436. type: array
  1437. items:
  1438. type: string
  1439. description: clients connecting from these IP/Mask are not allowed. Denied rules are evaluated before allowed ones
  1440. example:
  1441. - 172.16.0.0/16
  1442. denied_login_methods:
  1443. type: array
  1444. items:
  1445. $ref: '#/components/schemas/LoginMethods'
  1446. description: if null or empty any available login method is allowed
  1447. denied_protocols:
  1448. type: array
  1449. items:
  1450. $ref: '#/components/schemas/SupportedProtocols'
  1451. description: if null or empty any available protocol is allowed
  1452. file_patterns:
  1453. type: array
  1454. items:
  1455. $ref: '#/components/schemas/PatternsFilter'
  1456. 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'
  1457. file_extensions:
  1458. type: array
  1459. items:
  1460. $ref: '#/components/schemas/ExtensionsFilter'
  1461. description: 'filters based on shell like patterns. Deprecated, use 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'
  1462. max_upload_file_size:
  1463. type: integer
  1464. format: int64
  1465. 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`'
  1466. tls_username:
  1467. type: string
  1468. enum:
  1469. - None
  1470. - CommonName
  1471. 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'
  1472. description: Additional user restrictions
  1473. Secret:
  1474. type: object
  1475. properties:
  1476. status:
  1477. type: string
  1478. enum:
  1479. - Plain
  1480. - AES-256-GCM
  1481. - Secretbox
  1482. - GCP
  1483. - AWS
  1484. - VaultTransit
  1485. - Redacted
  1486. description: 'Set to "Plain" to add or update an existing secret, set to "Redacted" to preserve the existing value'
  1487. payload:
  1488. type: string
  1489. key:
  1490. type: string
  1491. additional_data:
  1492. type: string
  1493. mode:
  1494. type: integer
  1495. description: 1 means encrypted using a master key
  1496. S3Config:
  1497. type: object
  1498. properties:
  1499. bucket:
  1500. type: string
  1501. minLength: 1
  1502. region:
  1503. type: string
  1504. minLength: 1
  1505. access_key:
  1506. type: string
  1507. access_secret:
  1508. $ref: '#/components/schemas/Secret'
  1509. endpoint:
  1510. type: string
  1511. description: optional endpoint
  1512. storage_class:
  1513. type: string
  1514. upload_part_size:
  1515. type: integer
  1516. 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.'
  1517. upload_concurrency:
  1518. type: integer
  1519. description: 'the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used'
  1520. key_prefix:
  1521. type: string
  1522. 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'
  1523. example: folder/subfolder/
  1524. required:
  1525. - bucket
  1526. - region
  1527. description: S3 Compatible Object Storage configuration details
  1528. GCSConfig:
  1529. type: object
  1530. properties:
  1531. bucket:
  1532. type: string
  1533. minLength: 1
  1534. credentials:
  1535. $ref: '#/components/schemas/Secret'
  1536. automatic_credentials:
  1537. type: integer
  1538. enum:
  1539. - 0
  1540. - 1
  1541. description: |
  1542. Automatic credentials:
  1543. * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null
  1544. * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials
  1545. storage_class:
  1546. type: string
  1547. key_prefix:
  1548. type: string
  1549. 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'
  1550. example: folder/subfolder/
  1551. required:
  1552. - bucket
  1553. 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'
  1554. AzureBlobFsConfig:
  1555. type: object
  1556. properties:
  1557. container:
  1558. type: string
  1559. account_name:
  1560. type: string
  1561. description: 'Storage Account Name, leave blank to use SAS URL'
  1562. account_key:
  1563. $ref: '#/components/schemas/Secret'
  1564. sas_url:
  1565. type: string
  1566. description: 'Shared access signature URL, leave blank if using account/key'
  1567. endpoint:
  1568. type: string
  1569. 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"'
  1570. upload_part_size:
  1571. type: integer
  1572. 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.'
  1573. upload_concurrency:
  1574. type: integer
  1575. description: 'the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used'
  1576. access_tier:
  1577. type: string
  1578. enum:
  1579. - ''
  1580. - Archive
  1581. - Hot
  1582. - Cool
  1583. key_prefix:
  1584. type: string
  1585. 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'
  1586. example: folder/subfolder/
  1587. use_emulator:
  1588. type: boolean
  1589. description: Azure Blob Storage configuration details
  1590. CryptFsConfig:
  1591. type: object
  1592. properties:
  1593. passphrase:
  1594. $ref: '#/components/schemas/Secret'
  1595. description: Crypt filesystem configuration details
  1596. SFTPFsConfig:
  1597. type: object
  1598. properties:
  1599. endpoint:
  1600. type: string
  1601. description: 'remote SFTP endpoint as host:port'
  1602. username:
  1603. type: string
  1604. description: you can specify a password or private key or both. In the latter case the private key will be tried first.
  1605. password:
  1606. $ref: '#/components/schemas/Secret'
  1607. private_key:
  1608. $ref: '#/components/schemas/Secret'
  1609. fingerprints:
  1610. type: array
  1611. items:
  1612. type: string
  1613. 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'
  1614. prefix:
  1615. type: string
  1616. description: Specifying a prefix you can restrict all operations to a given path within the remote SFTP server.
  1617. disable_concurrent_reads:
  1618. type: boolean
  1619. 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.
  1620. FilesystemConfig:
  1621. type: object
  1622. properties:
  1623. provider:
  1624. type: integer
  1625. enum:
  1626. - 0
  1627. - 1
  1628. - 2
  1629. - 3
  1630. - 4
  1631. - 5
  1632. description: |
  1633. Providers:
  1634. * `0` - Local filesystem
  1635. * `1` - S3 Compatible Object Storage
  1636. * `2` - Google Cloud Storage
  1637. * `3` - Azure Blob Storage
  1638. * `4` - Local filesystem encrypted
  1639. * `5` - SFTP
  1640. s3config:
  1641. $ref: '#/components/schemas/S3Config'
  1642. gcsconfig:
  1643. $ref: '#/components/schemas/GCSConfig'
  1644. azblobconfig:
  1645. $ref: '#/components/schemas/AzureBlobFsConfig'
  1646. cryptconfig:
  1647. $ref: '#/components/schemas/CryptFsConfig'
  1648. sftpconfig:
  1649. $ref: '#/components/schemas/SFTPFsConfig'
  1650. description: Storage filesystem details
  1651. BaseVirtualFolder:
  1652. type: object
  1653. properties:
  1654. id:
  1655. type: integer
  1656. format: int32
  1657. minimum: 1
  1658. name:
  1659. type: string
  1660. description: unique name for this virtual folder
  1661. mapped_path:
  1662. type: string
  1663. description: absolute filesystem path to use as virtual folder
  1664. description:
  1665. type: string
  1666. description: optional description
  1667. used_quota_size:
  1668. type: integer
  1669. format: int64
  1670. used_quota_files:
  1671. type: integer
  1672. format: int32
  1673. last_quota_update:
  1674. type: integer
  1675. format: int64
  1676. description: Last quota update as unix timestamp in milliseconds
  1677. users:
  1678. type: array
  1679. items:
  1680. type: string
  1681. description: list of usernames associated with this virtual folder
  1682. filesystem:
  1683. $ref: '#/components/schemas/FilesystemConfig'
  1684. 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.
  1685. VirtualFolder:
  1686. allOf:
  1687. - $ref: '#/components/schemas/BaseVirtualFolder'
  1688. - type: object
  1689. properties:
  1690. virtual_path:
  1691. type: string
  1692. quota_size:
  1693. type: integer
  1694. format: int64
  1695. 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'
  1696. quota_files:
  1697. type: integer
  1698. format: int32
  1699. 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'
  1700. required:
  1701. - virtual_path
  1702. 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.'
  1703. User:
  1704. type: object
  1705. properties:
  1706. id:
  1707. type: integer
  1708. format: int32
  1709. minimum: 1
  1710. status:
  1711. type: integer
  1712. enum:
  1713. - 0
  1714. - 1
  1715. description: |
  1716. status:
  1717. * `0` user is disabled, login is not allowed
  1718. * `1` user is enabled
  1719. username:
  1720. type: string
  1721. description: username is unique
  1722. description:
  1723. type: string
  1724. description: 'optional description, for example the user full name'
  1725. expiration_date:
  1726. type: integer
  1727. format: int64
  1728. description: expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration
  1729. password:
  1730. type: string
  1731. format: password
  1732. description: password or public key/SSH user certificate are mandatory. If the password has no known hashing algo prefix it will be stored using argon2id. You can send a password hashed as bcrypt or pbkdf2 and it will be stored as is. For security reasons this field is omitted when you search/get users
  1733. public_keys:
  1734. type: array
  1735. items:
  1736. type: string
  1737. description: a password or at least one public key/SSH user certificate are mandatory.
  1738. home_dir:
  1739. type: string
  1740. 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
  1741. virtual_folders:
  1742. type: array
  1743. items:
  1744. $ref: '#/components/schemas/VirtualFolder'
  1745. 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
  1746. uid:
  1747. type: integer
  1748. format: int32
  1749. minimum: 0
  1750. maximum: 65535
  1751. 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'
  1752. gid:
  1753. type: integer
  1754. format: int32
  1755. minimum: 0
  1756. maximum: 65535
  1757. 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'
  1758. max_sessions:
  1759. type: integer
  1760. format: int32
  1761. description: Limit the sessions that a user can open. 0 means unlimited
  1762. quota_size:
  1763. type: integer
  1764. format: int64
  1765. 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
  1766. quota_files:
  1767. type: integer
  1768. format: int32
  1769. 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
  1770. permissions:
  1771. type: object
  1772. items:
  1773. $ref: '#/components/schemas/DirPermissions'
  1774. minItems: 1
  1775. example:
  1776. /:
  1777. - '*'
  1778. /somedir:
  1779. - list
  1780. - download
  1781. used_quota_size:
  1782. type: integer
  1783. format: int64
  1784. used_quota_files:
  1785. type: integer
  1786. format: int32
  1787. last_quota_update:
  1788. type: integer
  1789. format: int64
  1790. description: Last quota update as unix timestamp in milliseconds
  1791. upload_bandwidth:
  1792. type: integer
  1793. format: int32
  1794. description: 'Maximum upload bandwidth as KB/s, 0 means unlimited'
  1795. download_bandwidth:
  1796. type: integer
  1797. format: int32
  1798. description: 'Maximum download bandwidth as KB/s, 0 means unlimited'
  1799. last_login:
  1800. type: integer
  1801. format: int64
  1802. description: Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes
  1803. filters:
  1804. $ref: '#/components/schemas/UserFilters'
  1805. filesystem:
  1806. $ref: '#/components/schemas/FilesystemConfig'
  1807. additional_info:
  1808. type: string
  1809. description: Free form text field for external systems
  1810. AdminFilters:
  1811. type: object
  1812. properties:
  1813. allow_list:
  1814. type: array
  1815. items:
  1816. type: string
  1817. 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"'
  1818. example:
  1819. - 192.0.2.0/24
  1820. - '2001:db8::/32'
  1821. Admin:
  1822. type: object
  1823. properties:
  1824. id:
  1825. type: integer
  1826. format: int32
  1827. minimum: 1
  1828. status:
  1829. type: integer
  1830. enum:
  1831. - 0
  1832. - 1
  1833. description: |
  1834. status:
  1835. * `0` user is disabled, login is not allowed
  1836. * `1` user is enabled
  1837. username:
  1838. type: string
  1839. description: username is unique
  1840. description:
  1841. type: string
  1842. description: 'optional description, for example the admin full name'
  1843. password:
  1844. type: string
  1845. format: password
  1846. description: Admin password. For security reasons this field is omitted when you search/get admins
  1847. email:
  1848. type: string
  1849. format: email
  1850. permissions:
  1851. type: array
  1852. items:
  1853. $ref: '#/components/schemas/AdminPermissions'
  1854. filters:
  1855. $ref: '#/components/schemas/AdminFilters'
  1856. additional_info:
  1857. type: string
  1858. description: Free form text field
  1859. Transfer:
  1860. type: object
  1861. properties:
  1862. operation_type:
  1863. type: string
  1864. enum:
  1865. - upload
  1866. - download
  1867. description: |
  1868. Operations:
  1869. * `upload`
  1870. * `download`
  1871. path:
  1872. type: string
  1873. description: file path for the upload/download
  1874. start_time:
  1875. type: integer
  1876. format: int64
  1877. description: start time as unix timestamp in milliseconds
  1878. size:
  1879. type: integer
  1880. format: int64
  1881. description: bytes transferred
  1882. ConnectionStatus:
  1883. type: object
  1884. properties:
  1885. username:
  1886. type: string
  1887. description: connected username
  1888. connection_id:
  1889. type: string
  1890. description: unique connection identifier
  1891. client_version:
  1892. type: string
  1893. description: client version
  1894. remote_address:
  1895. type: string
  1896. description: Remote address for the connected client
  1897. connection_time:
  1898. type: integer
  1899. format: int64
  1900. description: connection time as unix timestamp in milliseconds
  1901. command:
  1902. type: string
  1903. description: Last SSH/FTP command or WebDAV method
  1904. last_activity:
  1905. type: integer
  1906. format: int64
  1907. description: last client activity as unix timestamp in milliseconds
  1908. protocol:
  1909. type: string
  1910. enum:
  1911. - SFTP
  1912. - SCP
  1913. - SSH
  1914. - FTP
  1915. - DAV
  1916. active_transfers:
  1917. type: array
  1918. items:
  1919. $ref: '#/components/schemas/Transfer'
  1920. QuotaScan:
  1921. type: object
  1922. properties:
  1923. username:
  1924. type: string
  1925. description: username with an active scan
  1926. start_time:
  1927. type: integer
  1928. format: int64
  1929. description: scan start time as unix timestamp in milliseconds
  1930. FolderQuotaScan:
  1931. type: object
  1932. properties:
  1933. name:
  1934. type: string
  1935. description: folder name with an active scan
  1936. start_time:
  1937. type: integer
  1938. format: int64
  1939. description: scan start time as unix timestamp in milliseconds
  1940. SSHHostKey:
  1941. type: object
  1942. properties:
  1943. path:
  1944. type: string
  1945. fingerprint:
  1946. type: string
  1947. SSHBinding:
  1948. type: object
  1949. properties:
  1950. address:
  1951. type: string
  1952. description: TCP address the server listen on
  1953. port:
  1954. type: integer
  1955. description: the port used for serving requests
  1956. apply_proxy_config:
  1957. type: boolean
  1958. description: 'apply the proxy configuration, if any'
  1959. WebDAVBinding:
  1960. type: object
  1961. properties:
  1962. address:
  1963. type: string
  1964. description: TCP address the server listen on
  1965. port:
  1966. type: integer
  1967. description: the port used for serving requests
  1968. enable_https:
  1969. type: boolean
  1970. client_auth_type:
  1971. type: integer
  1972. description: 1 means that client certificate authentication is required in addition to HTTP basic authentication
  1973. FTPDBinding:
  1974. type: object
  1975. properties:
  1976. address:
  1977. type: string
  1978. description: TCP address the server listen on
  1979. port:
  1980. type: integer
  1981. description: the port used for serving requests
  1982. apply_proxy_config:
  1983. type: boolean
  1984. description: 'apply the proxy configuration, if any'
  1985. tls_mode:
  1986. type: integer
  1987. enum:
  1988. - 0
  1989. - 1
  1990. - 2
  1991. description: |
  1992. * `0` - clear or explicit TLS * `1` - explicit TLS required * `2` - implicit TLS
  1993. force_passive_ip:
  1994. type: string
  1995. description: External IP address to expose for passive connections
  1996. client_auth_type:
  1997. type: integer
  1998. description: 1 means that client certificate authentication is required in addition to FTP authentication
  1999. SSHServiceStatus:
  2000. type: object
  2001. properties:
  2002. is_active:
  2003. type: boolean
  2004. bindings:
  2005. type: array
  2006. items:
  2007. $ref: '#/components/schemas/SSHBinding'
  2008. nullable: true
  2009. host_keys:
  2010. type: array
  2011. items:
  2012. $ref: '#/components/schemas/SSHHostKey'
  2013. nullable: true
  2014. ssh_commands:
  2015. type: array
  2016. items:
  2017. type: string
  2018. FTPPassivePortRange:
  2019. type: object
  2020. properties:
  2021. start:
  2022. type: integer
  2023. end:
  2024. type: integer
  2025. FTPServiceStatus:
  2026. type: object
  2027. properties:
  2028. is_active:
  2029. type: boolean
  2030. bindings:
  2031. type: array
  2032. items:
  2033. $ref: '#/components/schemas/FTPDBinding'
  2034. nullable: true
  2035. passive_port_range:
  2036. $ref: '#/components/schemas/FTPPassivePortRange'
  2037. WebDAVServiceStatus:
  2038. type: object
  2039. properties:
  2040. is_active:
  2041. type: boolean
  2042. bindings:
  2043. type: array
  2044. items:
  2045. $ref: '#/components/schemas/WebDAVBinding'
  2046. nullable: true
  2047. DataProviderStatus:
  2048. type: object
  2049. properties:
  2050. is_active:
  2051. type: boolean
  2052. driver:
  2053. type: string
  2054. error:
  2055. type: string
  2056. ServicesStatus:
  2057. type: object
  2058. properties:
  2059. ssh:
  2060. $ref: '#/components/schemas/SSHServiceStatus'
  2061. ftp:
  2062. $ref: '#/components/schemas/FTPServiceStatus'
  2063. webdav:
  2064. $ref: '#/components/schemas/WebDAVServiceStatus'
  2065. data_provider:
  2066. $ref: '#/components/schemas/DataProviderStatus'
  2067. defender:
  2068. type: object
  2069. properties:
  2070. is_active:
  2071. type: boolean
  2072. BanStatus:
  2073. type: object
  2074. properties:
  2075. date_time:
  2076. type: string
  2077. format: date-time
  2078. nullable: true
  2079. description: if null the host is not banned
  2080. ScoreStatus:
  2081. type: object
  2082. properties:
  2083. score:
  2084. type: integer
  2085. description: if 0 the host is not listed
  2086. BackupData:
  2087. type: object
  2088. properties:
  2089. users:
  2090. type: array
  2091. items:
  2092. $ref: '#/components/schemas/User'
  2093. folders:
  2094. type: array
  2095. items:
  2096. $ref: '#/components/schemas/BaseVirtualFolder'
  2097. admins:
  2098. type: array
  2099. items:
  2100. $ref: '#/components/schemas/Admin'
  2101. version:
  2102. type: integer
  2103. PwdChange:
  2104. type: object
  2105. properties:
  2106. current_password:
  2107. type: string
  2108. new_password:
  2109. type: string
  2110. ApiResponse:
  2111. type: object
  2112. properties:
  2113. message:
  2114. type: string
  2115. description: 'message, can be empty'
  2116. error:
  2117. type: string
  2118. description: error description if any
  2119. VersionInfo:
  2120. type: object
  2121. properties:
  2122. version:
  2123. type: string
  2124. build_date:
  2125. type: string
  2126. commit_hash:
  2127. type: string
  2128. features:
  2129. type: array
  2130. items:
  2131. type: string
  2132. 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'
  2133. Token:
  2134. type: object
  2135. properties:
  2136. access_token:
  2137. type: string
  2138. expires_at:
  2139. type: string
  2140. format: date-time
  2141. securitySchemes:
  2142. BasicAuth:
  2143. type: http
  2144. scheme: basic
  2145. BearerAuth:
  2146. type: http
  2147. scheme: bearer
  2148. bearerFormat: JWT