openapi.yaml 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147
  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. 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
  1497. S3Config:
  1498. type: object
  1499. properties:
  1500. bucket:
  1501. type: string
  1502. minLength: 1
  1503. region:
  1504. type: string
  1505. minLength: 1
  1506. access_key:
  1507. type: string
  1508. access_secret:
  1509. $ref: '#/components/schemas/Secret'
  1510. endpoint:
  1511. type: string
  1512. description: optional endpoint
  1513. storage_class:
  1514. type: string
  1515. upload_part_size:
  1516. type: integer
  1517. 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.'
  1518. upload_concurrency:
  1519. type: integer
  1520. description: 'the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used'
  1521. key_prefix:
  1522. type: string
  1523. 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'
  1524. example: folder/subfolder/
  1525. description: S3 Compatible Object Storage configuration details
  1526. GCSConfig:
  1527. type: object
  1528. properties:
  1529. bucket:
  1530. type: string
  1531. minLength: 1
  1532. credentials:
  1533. $ref: '#/components/schemas/Secret'
  1534. automatic_credentials:
  1535. type: integer
  1536. enum:
  1537. - 0
  1538. - 1
  1539. description: |
  1540. Automatic credentials:
  1541. * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null
  1542. * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials
  1543. storage_class:
  1544. type: string
  1545. key_prefix:
  1546. type: string
  1547. 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'
  1548. example: folder/subfolder/
  1549. 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'
  1550. AzureBlobFsConfig:
  1551. type: object
  1552. properties:
  1553. container:
  1554. type: string
  1555. account_name:
  1556. type: string
  1557. description: 'Storage Account Name, leave blank to use SAS URL'
  1558. account_key:
  1559. $ref: '#/components/schemas/Secret'
  1560. sas_url:
  1561. type: string
  1562. description: 'Shared access signature URL, leave blank if using account/key'
  1563. endpoint:
  1564. type: string
  1565. 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"'
  1566. upload_part_size:
  1567. type: integer
  1568. 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.'
  1569. upload_concurrency:
  1570. type: integer
  1571. description: 'the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used'
  1572. access_tier:
  1573. type: string
  1574. enum:
  1575. - ''
  1576. - Archive
  1577. - Hot
  1578. - Cool
  1579. key_prefix:
  1580. type: string
  1581. 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'
  1582. example: folder/subfolder/
  1583. use_emulator:
  1584. type: boolean
  1585. description: Azure Blob Storage configuration details
  1586. CryptFsConfig:
  1587. type: object
  1588. properties:
  1589. passphrase:
  1590. $ref: '#/components/schemas/Secret'
  1591. description: Crypt filesystem configuration details
  1592. SFTPFsConfig:
  1593. type: object
  1594. properties:
  1595. endpoint:
  1596. type: string
  1597. description: 'remote SFTP endpoint as host:port'
  1598. username:
  1599. type: string
  1600. description: you can specify a password or private key or both. In the latter case the private key will be tried first.
  1601. password:
  1602. $ref: '#/components/schemas/Secret'
  1603. private_key:
  1604. $ref: '#/components/schemas/Secret'
  1605. fingerprints:
  1606. type: array
  1607. items:
  1608. type: string
  1609. 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'
  1610. prefix:
  1611. type: string
  1612. description: Specifying a prefix you can restrict all operations to a given path within the remote SFTP server.
  1613. disable_concurrent_reads:
  1614. type: boolean
  1615. 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.
  1616. buffer_size:
  1617. type: intger
  1618. 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.
  1619. FilesystemConfig:
  1620. type: object
  1621. properties:
  1622. provider:
  1623. type: integer
  1624. enum:
  1625. - 0
  1626. - 1
  1627. - 2
  1628. - 3
  1629. - 4
  1630. - 5
  1631. description: |
  1632. Providers:
  1633. * `0` - Local filesystem
  1634. * `1` - S3 Compatible Object Storage
  1635. * `2` - Google Cloud Storage
  1636. * `3` - Azure Blob Storage
  1637. * `4` - Local filesystem encrypted
  1638. * `5` - SFTP
  1639. s3config:
  1640. $ref: '#/components/schemas/S3Config'
  1641. gcsconfig:
  1642. $ref: '#/components/schemas/GCSConfig'
  1643. azblobconfig:
  1644. $ref: '#/components/schemas/AzureBlobFsConfig'
  1645. cryptconfig:
  1646. $ref: '#/components/schemas/CryptFsConfig'
  1647. sftpconfig:
  1648. $ref: '#/components/schemas/SFTPFsConfig'
  1649. description: Storage filesystem details
  1650. BaseVirtualFolder:
  1651. type: object
  1652. properties:
  1653. id:
  1654. type: integer
  1655. format: int32
  1656. minimum: 1
  1657. name:
  1658. type: string
  1659. description: unique name for this virtual folder
  1660. mapped_path:
  1661. type: string
  1662. description: absolute filesystem path to use as virtual folder
  1663. description:
  1664. type: string
  1665. description: optional description
  1666. used_quota_size:
  1667. type: integer
  1668. format: int64
  1669. used_quota_files:
  1670. type: integer
  1671. format: int32
  1672. last_quota_update:
  1673. type: integer
  1674. format: int64
  1675. description: Last quota update as unix timestamp in milliseconds
  1676. users:
  1677. type: array
  1678. items:
  1679. type: string
  1680. description: list of usernames associated with this virtual folder
  1681. filesystem:
  1682. $ref: '#/components/schemas/FilesystemConfig'
  1683. 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.
  1684. VirtualFolder:
  1685. allOf:
  1686. - $ref: '#/components/schemas/BaseVirtualFolder'
  1687. - type: object
  1688. properties:
  1689. virtual_path:
  1690. type: string
  1691. quota_size:
  1692. type: integer
  1693. format: int64
  1694. 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'
  1695. quota_files:
  1696. type: integer
  1697. format: int32
  1698. 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'
  1699. required:
  1700. - virtual_path
  1701. 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.'
  1702. User:
  1703. type: object
  1704. properties:
  1705. id:
  1706. type: integer
  1707. format: int32
  1708. minimum: 1
  1709. status:
  1710. type: integer
  1711. enum:
  1712. - 0
  1713. - 1
  1714. description: |
  1715. status:
  1716. * `0` user is disabled, login is not allowed
  1717. * `1` user is enabled
  1718. username:
  1719. type: string
  1720. description: username is unique
  1721. description:
  1722. type: string
  1723. description: 'optional description, for example the user full name'
  1724. expiration_date:
  1725. type: integer
  1726. format: int64
  1727. description: expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration
  1728. password:
  1729. type: string
  1730. format: password
  1731. 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
  1732. public_keys:
  1733. type: array
  1734. items:
  1735. type: string
  1736. description: a password or at least one public key/SSH user certificate are mandatory.
  1737. home_dir:
  1738. type: string
  1739. 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
  1740. virtual_folders:
  1741. type: array
  1742. items:
  1743. $ref: '#/components/schemas/VirtualFolder'
  1744. 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
  1745. uid:
  1746. type: integer
  1747. format: int32
  1748. minimum: 0
  1749. maximum: 2147483647
  1750. 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'
  1751. gid:
  1752. type: integer
  1753. format: int32
  1754. minimum: 0
  1755. maximum: 2147483647
  1756. 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'
  1757. max_sessions:
  1758. type: integer
  1759. format: int32
  1760. description: Limit the sessions that a user can open. 0 means unlimited
  1761. quota_size:
  1762. type: integer
  1763. format: int64
  1764. 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
  1765. quota_files:
  1766. type: integer
  1767. format: int32
  1768. 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
  1769. permissions:
  1770. type: object
  1771. items:
  1772. $ref: '#/components/schemas/DirPermissions'
  1773. minItems: 1
  1774. example:
  1775. /:
  1776. - '*'
  1777. /somedir:
  1778. - list
  1779. - download
  1780. used_quota_size:
  1781. type: integer
  1782. format: int64
  1783. used_quota_files:
  1784. type: integer
  1785. format: int32
  1786. last_quota_update:
  1787. type: integer
  1788. format: int64
  1789. description: Last quota update as unix timestamp in milliseconds
  1790. upload_bandwidth:
  1791. type: integer
  1792. format: int32
  1793. description: 'Maximum upload bandwidth as KB/s, 0 means unlimited'
  1794. download_bandwidth:
  1795. type: integer
  1796. format: int32
  1797. description: 'Maximum download bandwidth as KB/s, 0 means unlimited'
  1798. last_login:
  1799. type: integer
  1800. format: int64
  1801. description: Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes
  1802. filters:
  1803. $ref: '#/components/schemas/UserFilters'
  1804. filesystem:
  1805. $ref: '#/components/schemas/FilesystemConfig'
  1806. additional_info:
  1807. type: string
  1808. description: Free form text field for external systems
  1809. AdminFilters:
  1810. type: object
  1811. properties:
  1812. allow_list:
  1813. type: array
  1814. items:
  1815. type: string
  1816. 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"'
  1817. example:
  1818. - 192.0.2.0/24
  1819. - '2001:db8::/32'
  1820. Admin:
  1821. type: object
  1822. properties:
  1823. id:
  1824. type: integer
  1825. format: int32
  1826. minimum: 1
  1827. status:
  1828. type: integer
  1829. enum:
  1830. - 0
  1831. - 1
  1832. description: |
  1833. status:
  1834. * `0` user is disabled, login is not allowed
  1835. * `1` user is enabled
  1836. username:
  1837. type: string
  1838. description: username is unique
  1839. description:
  1840. type: string
  1841. description: 'optional description, for example the admin full name'
  1842. password:
  1843. type: string
  1844. format: password
  1845. description: Admin password. For security reasons this field is omitted when you search/get admins
  1846. email:
  1847. type: string
  1848. format: email
  1849. permissions:
  1850. type: array
  1851. items:
  1852. $ref: '#/components/schemas/AdminPermissions'
  1853. filters:
  1854. $ref: '#/components/schemas/AdminFilters'
  1855. additional_info:
  1856. type: string
  1857. description: Free form text field
  1858. Transfer:
  1859. type: object
  1860. properties:
  1861. operation_type:
  1862. type: string
  1863. enum:
  1864. - upload
  1865. - download
  1866. description: |
  1867. Operations:
  1868. * `upload`
  1869. * `download`
  1870. path:
  1871. type: string
  1872. description: file path for the upload/download
  1873. start_time:
  1874. type: integer
  1875. format: int64
  1876. description: start time as unix timestamp in milliseconds
  1877. size:
  1878. type: integer
  1879. format: int64
  1880. description: bytes transferred
  1881. ConnectionStatus:
  1882. type: object
  1883. properties:
  1884. username:
  1885. type: string
  1886. description: connected username
  1887. connection_id:
  1888. type: string
  1889. description: unique connection identifier
  1890. client_version:
  1891. type: string
  1892. description: client version
  1893. remote_address:
  1894. type: string
  1895. description: Remote address for the connected client
  1896. connection_time:
  1897. type: integer
  1898. format: int64
  1899. description: connection time as unix timestamp in milliseconds
  1900. command:
  1901. type: string
  1902. description: Last SSH/FTP command or WebDAV method
  1903. last_activity:
  1904. type: integer
  1905. format: int64
  1906. description: last client activity as unix timestamp in milliseconds
  1907. protocol:
  1908. type: string
  1909. enum:
  1910. - SFTP
  1911. - SCP
  1912. - SSH
  1913. - FTP
  1914. - DAV
  1915. active_transfers:
  1916. type: array
  1917. items:
  1918. $ref: '#/components/schemas/Transfer'
  1919. QuotaScan:
  1920. type: object
  1921. properties:
  1922. username:
  1923. type: string
  1924. description: username with an active scan
  1925. start_time:
  1926. type: integer
  1927. format: int64
  1928. description: scan start time as unix timestamp in milliseconds
  1929. FolderQuotaScan:
  1930. type: object
  1931. properties:
  1932. name:
  1933. type: string
  1934. description: folder name with an active scan
  1935. start_time:
  1936. type: integer
  1937. format: int64
  1938. description: scan start time as unix timestamp in milliseconds
  1939. SSHHostKey:
  1940. type: object
  1941. properties:
  1942. path:
  1943. type: string
  1944. fingerprint:
  1945. type: string
  1946. SSHBinding:
  1947. type: object
  1948. properties:
  1949. address:
  1950. type: string
  1951. description: TCP address the server listen on
  1952. port:
  1953. type: integer
  1954. description: the port used for serving requests
  1955. apply_proxy_config:
  1956. type: boolean
  1957. description: 'apply the proxy configuration, if any'
  1958. WebDAVBinding:
  1959. type: object
  1960. properties:
  1961. address:
  1962. type: string
  1963. description: TCP address the server listen on
  1964. port:
  1965. type: integer
  1966. description: the port used for serving requests
  1967. enable_https:
  1968. type: boolean
  1969. client_auth_type:
  1970. type: integer
  1971. description: 1 means that client certificate authentication is required in addition to HTTP basic authentication
  1972. FTPDBinding:
  1973. type: object
  1974. properties:
  1975. address:
  1976. type: string
  1977. description: TCP address the server listen on
  1978. port:
  1979. type: integer
  1980. description: the port used for serving requests
  1981. apply_proxy_config:
  1982. type: boolean
  1983. description: 'apply the proxy configuration, if any'
  1984. tls_mode:
  1985. type: integer
  1986. enum:
  1987. - 0
  1988. - 1
  1989. - 2
  1990. description: |
  1991. * `0` - clear or explicit TLS * `1` - explicit TLS required * `2` - implicit TLS
  1992. force_passive_ip:
  1993. type: string
  1994. description: External IP address to expose for passive connections
  1995. client_auth_type:
  1996. type: integer
  1997. description: 1 means that client certificate authentication is required in addition to FTP authentication
  1998. SSHServiceStatus:
  1999. type: object
  2000. properties:
  2001. is_active:
  2002. type: boolean
  2003. bindings:
  2004. type: array
  2005. items:
  2006. $ref: '#/components/schemas/SSHBinding'
  2007. nullable: true
  2008. host_keys:
  2009. type: array
  2010. items:
  2011. $ref: '#/components/schemas/SSHHostKey'
  2012. nullable: true
  2013. ssh_commands:
  2014. type: array
  2015. items:
  2016. type: string
  2017. FTPPassivePortRange:
  2018. type: object
  2019. properties:
  2020. start:
  2021. type: integer
  2022. end:
  2023. type: integer
  2024. FTPServiceStatus:
  2025. type: object
  2026. properties:
  2027. is_active:
  2028. type: boolean
  2029. bindings:
  2030. type: array
  2031. items:
  2032. $ref: '#/components/schemas/FTPDBinding'
  2033. nullable: true
  2034. passive_port_range:
  2035. $ref: '#/components/schemas/FTPPassivePortRange'
  2036. WebDAVServiceStatus:
  2037. type: object
  2038. properties:
  2039. is_active:
  2040. type: boolean
  2041. bindings:
  2042. type: array
  2043. items:
  2044. $ref: '#/components/schemas/WebDAVBinding'
  2045. nullable: true
  2046. DataProviderStatus:
  2047. type: object
  2048. properties:
  2049. is_active:
  2050. type: boolean
  2051. driver:
  2052. type: string
  2053. error:
  2054. type: string
  2055. ServicesStatus:
  2056. type: object
  2057. properties:
  2058. ssh:
  2059. $ref: '#/components/schemas/SSHServiceStatus'
  2060. ftp:
  2061. $ref: '#/components/schemas/FTPServiceStatus'
  2062. webdav:
  2063. $ref: '#/components/schemas/WebDAVServiceStatus'
  2064. data_provider:
  2065. $ref: '#/components/schemas/DataProviderStatus'
  2066. defender:
  2067. type: object
  2068. properties:
  2069. is_active:
  2070. type: boolean
  2071. BanStatus:
  2072. type: object
  2073. properties:
  2074. date_time:
  2075. type: string
  2076. format: date-time
  2077. nullable: true
  2078. description: if null the host is not banned
  2079. ScoreStatus:
  2080. type: object
  2081. properties:
  2082. score:
  2083. type: integer
  2084. description: if 0 the host is not listed
  2085. BackupData:
  2086. type: object
  2087. properties:
  2088. users:
  2089. type: array
  2090. items:
  2091. $ref: '#/components/schemas/User'
  2092. folders:
  2093. type: array
  2094. items:
  2095. $ref: '#/components/schemas/BaseVirtualFolder'
  2096. admins:
  2097. type: array
  2098. items:
  2099. $ref: '#/components/schemas/Admin'
  2100. version:
  2101. type: integer
  2102. PwdChange:
  2103. type: object
  2104. properties:
  2105. current_password:
  2106. type: string
  2107. new_password:
  2108. type: string
  2109. ApiResponse:
  2110. type: object
  2111. properties:
  2112. message:
  2113. type: string
  2114. description: 'message, can be empty'
  2115. error:
  2116. type: string
  2117. description: error description if any
  2118. VersionInfo:
  2119. type: object
  2120. properties:
  2121. version:
  2122. type: string
  2123. build_date:
  2124. type: string
  2125. commit_hash:
  2126. type: string
  2127. features:
  2128. type: array
  2129. items:
  2130. type: string
  2131. 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'
  2132. Token:
  2133. type: object
  2134. properties:
  2135. access_token:
  2136. type: string
  2137. expires_at:
  2138. type: string
  2139. format: date-time
  2140. securitySchemes:
  2141. BasicAuth:
  2142. type: http
  2143. scheme: basic
  2144. BearerAuth:
  2145. type: http
  2146. scheme: bearer
  2147. bearerFormat: JWT