openapi.yaml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. openapi: 3.0.1
  2. info:
  3. title: SFTPGo
  4. description: 'SFTPGo REST API'
  5. version: 1.8.4
  6. servers:
  7. - url: /api/v1
  8. security:
  9. - BasicAuth: []
  10. paths:
  11. /version:
  12. get:
  13. tags:
  14. - version
  15. summary: Get version details
  16. operationId: get_version
  17. responses:
  18. 200:
  19. description: successful operation
  20. content:
  21. application/json:
  22. schema:
  23. type: array
  24. items:
  25. $ref : '#/components/schemas/VersionInfo'
  26. 401:
  27. description: Unauthorized
  28. content:
  29. application/json:
  30. schema:
  31. $ref: '#/components/schemas/ApiResponse'
  32. example:
  33. status: 401
  34. message: ""
  35. error: "Error description if any"
  36. 403:
  37. description: Forbidden
  38. content:
  39. application/json:
  40. schema:
  41. $ref: '#/components/schemas/ApiResponse'
  42. example:
  43. status: 403
  44. message: ""
  45. error: "Error description if any"
  46. 500:
  47. description: Internal Server Error
  48. content:
  49. application/json:
  50. schema:
  51. $ref: '#/components/schemas/ApiResponse'
  52. example:
  53. status: 500
  54. message: ""
  55. error: "Error description if any"
  56. /providerstatus:
  57. get:
  58. tags:
  59. - providerstatus
  60. summary: Get data provider status
  61. operationId: get_provider_status
  62. responses:
  63. 200:
  64. description: successful operation
  65. content:
  66. application/json:
  67. schema:
  68. $ref: '#/components/schemas/ApiResponse'
  69. example:
  70. status: 200
  71. message: "Alive"
  72. error: ""
  73. 401:
  74. description: Unauthorized
  75. content:
  76. application/json:
  77. schema:
  78. $ref: '#/components/schemas/ApiResponse'
  79. example:
  80. status: 401
  81. message: ""
  82. error: "Error description if any"
  83. 403:
  84. description: Forbidden
  85. content:
  86. application/json:
  87. schema:
  88. $ref: '#/components/schemas/ApiResponse'
  89. example:
  90. status: 403
  91. message: ""
  92. error: "Error description if any"
  93. 500:
  94. description: Provider Error
  95. content:
  96. application/json:
  97. schema:
  98. $ref: '#/components/schemas/ApiResponse'
  99. example:
  100. status: 500
  101. message: ""
  102. error: "Error description if any"
  103. /connection:
  104. get:
  105. tags:
  106. - connections
  107. summary: Get the active users and info about their uploads/downloads
  108. operationId: get_connections
  109. responses:
  110. 200:
  111. description: successful operation
  112. content:
  113. application/json:
  114. schema:
  115. type: array
  116. items:
  117. $ref : '#/components/schemas/ConnectionStatus'
  118. 401:
  119. description: Unauthorized
  120. content:
  121. application/json:
  122. schema:
  123. $ref: '#/components/schemas/ApiResponse'
  124. example:
  125. status: 401
  126. message: ""
  127. error: "Error description if any"
  128. 403:
  129. description: Forbidden
  130. content:
  131. application/json:
  132. schema:
  133. $ref: '#/components/schemas/ApiResponse'
  134. example:
  135. status: 403
  136. message: ""
  137. error: "Error description if any"
  138. 500:
  139. description: Internal Server Error
  140. content:
  141. application/json:
  142. schema:
  143. $ref: '#/components/schemas/ApiResponse'
  144. example:
  145. status: 500
  146. message: ""
  147. error: "Error description if any"
  148. /connection/{connectionID}:
  149. delete:
  150. tags:
  151. - connections
  152. summary: Terminate an active connection
  153. operationId: close_connection
  154. parameters:
  155. - name: connectionID
  156. in: path
  157. description: ID of the connection to close
  158. required: true
  159. schema:
  160. type: string
  161. responses:
  162. 200:
  163. description: successful operation
  164. content:
  165. application/json:
  166. schema:
  167. $ref: '#/components/schemas/ApiResponse'
  168. example:
  169. status: 200
  170. message: "Connection closed"
  171. error: ""
  172. 400:
  173. description: Bad request
  174. content:
  175. application/json:
  176. schema:
  177. $ref: '#/components/schemas/ApiResponse'
  178. example:
  179. status: 400
  180. message: ""
  181. error: "Error description if any"
  182. 401:
  183. description: Unauthorized
  184. content:
  185. application/json:
  186. schema:
  187. $ref: '#/components/schemas/ApiResponse'
  188. example:
  189. status: 401
  190. message: ""
  191. error: "Error description if any"
  192. 403:
  193. description: Forbidden
  194. content:
  195. application/json:
  196. schema:
  197. $ref: '#/components/schemas/ApiResponse'
  198. example:
  199. status: 403
  200. message: ""
  201. error: "Error description if any"
  202. 404:
  203. description: Not Found
  204. content:
  205. application/json:
  206. schema:
  207. $ref: '#/components/schemas/ApiResponse'
  208. example:
  209. status: 404
  210. message: ""
  211. error: "Error description if any"
  212. 500:
  213. description: Internal Server Error
  214. content:
  215. application/json:
  216. schema:
  217. $ref: '#/components/schemas/ApiResponse'
  218. example:
  219. status: 500
  220. message: ""
  221. error: "Error description if any"
  222. /quota_scan:
  223. get:
  224. tags:
  225. - quota
  226. summary: Get the active quota scans
  227. operationId: get_quota_scans
  228. responses:
  229. 200:
  230. description: successful operation
  231. content:
  232. application/json:
  233. schema:
  234. type: array
  235. items:
  236. $ref : '#/components/schemas/QuotaScan'
  237. 401:
  238. description: Unauthorized
  239. content:
  240. application/json:
  241. schema:
  242. $ref: '#/components/schemas/ApiResponse'
  243. example:
  244. status: 401
  245. message: ""
  246. error: "Error description if any"
  247. 403:
  248. description: Forbidden
  249. content:
  250. application/json:
  251. schema:
  252. $ref: '#/components/schemas/ApiResponse'
  253. example:
  254. status: 403
  255. message: ""
  256. error: "Error description if any"
  257. 500:
  258. description: Internal Server Error
  259. content:
  260. application/json:
  261. schema:
  262. $ref: '#/components/schemas/ApiResponse'
  263. example:
  264. status: 500
  265. message: ""
  266. error: "Error description if any"
  267. post:
  268. tags:
  269. - quota
  270. summary: start a new quota scan
  271. description: A quota scan update the number of files and their total size for the given user
  272. operationId: start_quota_scan
  273. requestBody:
  274. required: true
  275. content:
  276. application/json:
  277. schema:
  278. $ref : '#/components/schemas/User'
  279. responses:
  280. 201:
  281. description: successful operation
  282. content:
  283. application/json:
  284. schema:
  285. $ref: '#/components/schemas/ApiResponse'
  286. example:
  287. status: 201
  288. message: "Scan started"
  289. error: ""
  290. 400:
  291. description: Bad request
  292. content:
  293. application/json:
  294. schema:
  295. $ref: '#/components/schemas/ApiResponse'
  296. example:
  297. status: 400
  298. message: ""
  299. error: "Error description if any"
  300. 401:
  301. description: Unauthorized
  302. content:
  303. application/json:
  304. schema:
  305. $ref: '#/components/schemas/ApiResponse'
  306. example:
  307. status: 401
  308. message: ""
  309. error: "Error description if any"
  310. 403:
  311. description: Forbidden
  312. content:
  313. application/json:
  314. schema:
  315. $ref: '#/components/schemas/ApiResponse'
  316. example:
  317. status: 403
  318. message: ""
  319. error: "Error description if any"
  320. 404:
  321. description: Not Found
  322. content:
  323. application/json:
  324. schema:
  325. $ref: '#/components/schemas/ApiResponse'
  326. example:
  327. status: 404
  328. message: ""
  329. error: "Error description if any"
  330. 409:
  331. description: Another scan is already in progress for this user
  332. content:
  333. application/json:
  334. schema:
  335. $ref: '#/components/schemas/ApiResponse'
  336. example:
  337. status: 409
  338. message: "Another scan is already in progress"
  339. error: "Error description if any"
  340. 500:
  341. description: Internal Server Error
  342. content:
  343. application/json:
  344. schema:
  345. $ref: '#/components/schemas/ApiResponse'
  346. example:
  347. status: 500
  348. message: ""
  349. error: "Error description if any"
  350. /user:
  351. get:
  352. tags:
  353. - users
  354. summary: Returns an array with one or more users
  355. description: For security reasons hashed passwords are omitted in the response
  356. operationId: get_users
  357. parameters:
  358. - in: query
  359. name: offset
  360. schema:
  361. type: integer
  362. minimum: 0
  363. default: 0
  364. required: false
  365. - in: query
  366. name: limit
  367. schema:
  368. type: integer
  369. minimum: 1
  370. maximum: 500
  371. default: 100
  372. required: false
  373. description: The maximum number of items to return. Max value is 500, default is 100
  374. - in: query
  375. name: order
  376. required: false
  377. description: Ordering users by username
  378. schema:
  379. type: string
  380. enum:
  381. - ASC
  382. - DESC
  383. example: ASC
  384. - in: query
  385. name: username
  386. required: false
  387. description: Filter by username, extact match case sensitive
  388. schema:
  389. type: string
  390. responses:
  391. 200:
  392. description: successful operation
  393. content:
  394. application/json:
  395. schema:
  396. type: array
  397. items:
  398. $ref : '#/components/schemas/User'
  399. 400:
  400. description: Bad request
  401. content:
  402. application/json:
  403. schema:
  404. $ref: '#/components/schemas/ApiResponse'
  405. example:
  406. status: 400
  407. message: ""
  408. error: "Error description if any"
  409. 401:
  410. description: Unauthorized
  411. content:
  412. application/json:
  413. schema:
  414. $ref: '#/components/schemas/ApiResponse'
  415. example:
  416. status: 401
  417. message: ""
  418. error: "Error description if any"
  419. 403:
  420. description: Forbidden
  421. content:
  422. application/json:
  423. schema:
  424. $ref: '#/components/schemas/ApiResponse'
  425. example:
  426. status: 403
  427. message: ""
  428. error: "Error description if any"
  429. 500:
  430. description: Internal Server Error
  431. content:
  432. application/json:
  433. schema:
  434. $ref: '#/components/schemas/ApiResponse'
  435. example:
  436. status: 500
  437. message: ""
  438. error: "Error description if any"
  439. post:
  440. tags:
  441. - users
  442. summary: Adds a new user
  443. operationId: add_user
  444. requestBody:
  445. required: true
  446. content:
  447. application/json:
  448. schema:
  449. $ref : '#/components/schemas/User'
  450. responses:
  451. 200:
  452. description: successful operation
  453. content:
  454. application/json:
  455. schema:
  456. $ref : '#/components/schemas/User'
  457. 400:
  458. description: Bad request
  459. content:
  460. application/json:
  461. schema:
  462. $ref: '#/components/schemas/ApiResponse'
  463. example:
  464. status: 400
  465. message: ""
  466. error: "Error description if any"
  467. 401:
  468. description: Unauthorized
  469. content:
  470. application/json:
  471. schema:
  472. $ref: '#/components/schemas/ApiResponse'
  473. example:
  474. status: 401
  475. message: ""
  476. error: "Error description if any"
  477. 403:
  478. description: Forbidden
  479. content:
  480. application/json:
  481. schema:
  482. $ref: '#/components/schemas/ApiResponse'
  483. example:
  484. status: 403
  485. message: ""
  486. error: "Error description if any"
  487. 500:
  488. description: Internal Server Error
  489. content:
  490. application/json:
  491. schema:
  492. $ref: '#/components/schemas/ApiResponse'
  493. example:
  494. status: 500
  495. message: ""
  496. error: "Error description if any"
  497. /user/{userID}:
  498. get:
  499. tags:
  500. - users
  501. summary: Find user by ID
  502. description: For security reasons the hashed password is omitted in the response
  503. operationId: get_user_by_id
  504. parameters:
  505. - name: userID
  506. in: path
  507. description: ID of the user to retrieve
  508. required: true
  509. schema:
  510. type: integer
  511. format: int32
  512. responses:
  513. 200:
  514. description: successful operation
  515. content:
  516. application/json:
  517. schema:
  518. $ref : '#/components/schemas/User'
  519. 400:
  520. description: Bad request
  521. content:
  522. application/json:
  523. schema:
  524. $ref: '#/components/schemas/ApiResponse'
  525. example:
  526. status: 400
  527. message: ""
  528. error: "Error description if any"
  529. 401:
  530. description: Unauthorized
  531. content:
  532. application/json:
  533. schema:
  534. $ref: '#/components/schemas/ApiResponse'
  535. example:
  536. status: 401
  537. message: ""
  538. error: "Error description if any"
  539. 403:
  540. description: Forbidden
  541. content:
  542. application/json:
  543. schema:
  544. $ref: '#/components/schemas/ApiResponse'
  545. example:
  546. status: 403
  547. message: ""
  548. error: "Error description if any"
  549. 404:
  550. description: Not Found
  551. content:
  552. application/json:
  553. schema:
  554. $ref: '#/components/schemas/ApiResponse'
  555. example:
  556. status: 404
  557. message: ""
  558. error: "Error description if any"
  559. 500:
  560. description: Internal Server Error
  561. content:
  562. application/json:
  563. schema:
  564. $ref: '#/components/schemas/ApiResponse'
  565. example:
  566. status: 500
  567. message: ""
  568. error: "Error description if any"
  569. put:
  570. tags:
  571. - users
  572. summary: Update an existing user
  573. operationId: update_user
  574. parameters:
  575. - name: userID
  576. in: path
  577. description: ID of the user to update
  578. required: true
  579. schema:
  580. type: integer
  581. format: int32
  582. requestBody:
  583. required: true
  584. content:
  585. application/json:
  586. schema:
  587. $ref : '#/components/schemas/User'
  588. responses:
  589. 200:
  590. description: successful operation
  591. content:
  592. application/json:
  593. schema:
  594. $ref : '#/components/schemas/ApiResponse'
  595. example:
  596. status: 200
  597. message: "User updated"
  598. error: ""
  599. 400:
  600. description: Bad request
  601. content:
  602. application/json:
  603. schema:
  604. $ref: '#/components/schemas/ApiResponse'
  605. example:
  606. status: 400
  607. message: ""
  608. error: "Error description if any"
  609. 401:
  610. description: Unauthorized
  611. content:
  612. application/json:
  613. schema:
  614. $ref: '#/components/schemas/ApiResponse'
  615. example:
  616. status: 401
  617. message: ""
  618. error: "Error description if any"
  619. 403:
  620. description: Forbidden
  621. content:
  622. application/json:
  623. schema:
  624. $ref: '#/components/schemas/ApiResponse'
  625. example:
  626. status: 403
  627. message: ""
  628. error: "Error description if any"
  629. 404:
  630. description: Not Found
  631. content:
  632. application/json:
  633. schema:
  634. $ref: '#/components/schemas/ApiResponse'
  635. example:
  636. status: 404
  637. message: ""
  638. error: "Error description if any"
  639. 500:
  640. description: Internal Server Error
  641. content:
  642. application/json:
  643. schema:
  644. $ref: '#/components/schemas/ApiResponse'
  645. example:
  646. status: 500
  647. message: ""
  648. error: "Error description if any"
  649. delete:
  650. tags:
  651. - users
  652. summary: Delete an existing user
  653. operationId: delete_user
  654. parameters:
  655. - name: userID
  656. in: path
  657. description: ID of the user to delete
  658. required: true
  659. schema:
  660. type: integer
  661. format: int32
  662. responses:
  663. 200:
  664. description: successful operation
  665. content:
  666. application/json:
  667. schema:
  668. $ref : '#/components/schemas/ApiResponse'
  669. example:
  670. status: 200
  671. message: "User deleted"
  672. error: ""
  673. 400:
  674. description: Bad request
  675. content:
  676. application/json:
  677. schema:
  678. $ref: '#/components/schemas/ApiResponse'
  679. example:
  680. status: 400
  681. message: ""
  682. error: "Error description if any"
  683. 401:
  684. description: Unauthorized
  685. content:
  686. application/json:
  687. schema:
  688. $ref: '#/components/schemas/ApiResponse'
  689. example:
  690. status: 401
  691. message: ""
  692. error: "Error description if any"
  693. 403:
  694. description: Forbidden
  695. content:
  696. application/json:
  697. schema:
  698. $ref: '#/components/schemas/ApiResponse'
  699. example:
  700. status: 403
  701. message: ""
  702. error: "Error description if any"
  703. 404:
  704. description: Not Found
  705. content:
  706. application/json:
  707. schema:
  708. $ref: '#/components/schemas/ApiResponse'
  709. example:
  710. status: 404
  711. message: ""
  712. error: "Error description if any"
  713. 500:
  714. description: Internal Server Error
  715. content:
  716. application/json:
  717. schema:
  718. $ref: '#/components/schemas/ApiResponse'
  719. example:
  720. status: 500
  721. message: ""
  722. error: "Error description if any"
  723. /dumpdata:
  724. get:
  725. tags:
  726. - maintenance
  727. summary: Backup SFTPGo data serializing them as JSON
  728. description: The backup is saved to a local file to avoid to expose users hashed passwords over the network. The output of dumpdata can be used as input for loaddata
  729. operationId: dumpdata
  730. parameters:
  731. - in: query
  732. name: output_file
  733. schema:
  734. type: string
  735. required: true
  736. 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
  737. - in: query
  738. name: indent
  739. schema:
  740. type: integer
  741. enum:
  742. - 0
  743. - 1
  744. description: >
  745. indent:
  746. * `0` no indentation. This is the default
  747. * `1` format the output JSON
  748. responses:
  749. 200:
  750. description: successful operation
  751. content:
  752. application/json:
  753. schema:
  754. $ref : '#/components/schemas/ApiResponse'
  755. example:
  756. status: 200
  757. message: "Data saved"
  758. error: ""
  759. 400:
  760. description: Bad request
  761. content:
  762. application/json:
  763. schema:
  764. $ref: '#/components/schemas/ApiResponse'
  765. example:
  766. status: 400
  767. message: ""
  768. error: "Error description if any"
  769. 401:
  770. description: Unauthorized
  771. content:
  772. application/json:
  773. schema:
  774. $ref: '#/components/schemas/ApiResponse'
  775. example:
  776. status: 401
  777. message: ""
  778. error: "Error description if any"
  779. 403:
  780. description: Forbidden
  781. content:
  782. application/json:
  783. schema:
  784. $ref: '#/components/schemas/ApiResponse'
  785. example:
  786. status: 403
  787. message: ""
  788. error: "Error description if any"
  789. 500:
  790. description: Internal Server Error
  791. content:
  792. application/json:
  793. schema:
  794. $ref: '#/components/schemas/ApiResponse'
  795. example:
  796. status: 500
  797. message: ""
  798. error: "Error description if any"
  799. /loaddata:
  800. get:
  801. tags:
  802. - maintenance
  803. summary: Restore SFTPGo data from a JSON backup
  804. description: Users will be restored one by one and the restore is stopped if a user cannot be added or updated, so it could happen a partial restore
  805. operationId: loaddata
  806. parameters:
  807. - in: query
  808. name: input_file
  809. schema:
  810. type: string
  811. required: true
  812. 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
  813. - in: query
  814. name: scan_quota
  815. schema:
  816. type: integer
  817. enum:
  818. - 0
  819. - 1
  820. - 2
  821. description: >
  822. Quota scan:
  823. * `0` no quota scan is done, the imported user will have used_quota_size and used_quota_file = 0. This is the default
  824. * `1` scan quota
  825. * `2` scan quota if the user has quota restrictions
  826. required: false
  827. - in: query
  828. name: mode
  829. schema:
  830. type: integer
  831. enum:
  832. - 0
  833. - 1
  834. description: >
  835. Mode:
  836. * `0` New users are added, existing users are updated. This is the default
  837. * `1` New users are added, existing users are not modified
  838. responses:
  839. 200:
  840. description: successful operation
  841. content:
  842. application/json:
  843. schema:
  844. $ref : '#/components/schemas/ApiResponse'
  845. example:
  846. status: 200
  847. message: "Data restored"
  848. error: ""
  849. 400:
  850. description: Bad request
  851. content:
  852. application/json:
  853. schema:
  854. $ref: '#/components/schemas/ApiResponse'
  855. example:
  856. status: 400
  857. message: ""
  858. error: "Error description if any"
  859. 401:
  860. description: Unauthorized
  861. content:
  862. application/json:
  863. schema:
  864. $ref: '#/components/schemas/ApiResponse'
  865. example:
  866. status: 401
  867. message: ""
  868. error: "Error description if any"
  869. 403:
  870. description: Forbidden
  871. content:
  872. application/json:
  873. schema:
  874. $ref: '#/components/schemas/ApiResponse'
  875. example:
  876. status: 403
  877. message: ""
  878. error: "Error description if any"
  879. 500:
  880. description: Internal Server Error
  881. content:
  882. application/json:
  883. schema:
  884. $ref: '#/components/schemas/ApiResponse'
  885. example:
  886. status: 500
  887. message: ""
  888. error: "Error description if any"
  889. components:
  890. schemas:
  891. Permission:
  892. type: string
  893. enum:
  894. - '*'
  895. - list
  896. - download
  897. - upload
  898. - overwrite
  899. - delete
  900. - rename
  901. - create_dirs
  902. - create_symlinks
  903. - chmod
  904. - chown
  905. - chtimes
  906. description: >
  907. Permissions:
  908. * `*` - all permissions are granted
  909. * `list` - list items is allowed
  910. * `download` - download files is allowed
  911. * `upload` - upload files is allowed
  912. * `overwrite` - overwrite an existing file, while uploading, is allowed. upload permission is required to allow file overwrite
  913. * `delete` - delete files or directories is allowed
  914. * `rename` - rename files or directories is allowed
  915. * `create_dirs` - create directories is allowed
  916. * `create_symlinks` - create links is allowed
  917. * `chmod` changing file or directory permissions is allowed
  918. * `chown` changing file or directory owner and group is allowed
  919. * `chtimes` changing file or directory access and modification time is allowed
  920. DirPermissions:
  921. type: object
  922. additionalProperties:
  923. type: array
  924. items:
  925. $ref: '#/components/schemas/Permission'
  926. minItems: 1
  927. minProperties: 1
  928. 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
  929. LoginMethods:
  930. type: string
  931. enum:
  932. - 'publickey'
  933. - 'password'
  934. - 'keyboard-interactive'
  935. ExtensionsFilter:
  936. type: object
  937. properties:
  938. path:
  939. type: string
  940. description: SFTP/SCP 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
  941. allowed_extensions:
  942. type: array
  943. items:
  944. type: string
  945. nullable: true
  946. description: list of, case insensitive, allowed files extension. Shell like expansion is not supported so you have to specify `.jpg` and not `*.jpg`
  947. example: [ ".jpg", ".png" ]
  948. denied_extensions:
  949. type: array
  950. items:
  951. type: string
  952. nullable: true
  953. description: list of, case insensitive, denied files extension. Denied file extensions are evaluated before the allowed ones
  954. example: [ ".zip" ]
  955. UserFilters:
  956. type: object
  957. properties:
  958. allowed_ip:
  959. type: array
  960. items:
  961. type: string
  962. nullable: true
  963. 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"
  964. example: [ "192.0.2.0/24", "2001:db8::/32" ]
  965. denied_ip:
  966. type: array
  967. items:
  968. type: string
  969. nullable: true
  970. description: clients connecting from these IP/Mask are not allowed. Denied rules are evaluated before allowed ones
  971. example: [ "172.16.0.0/16" ]
  972. denied_login_methods:
  973. type: array
  974. items:
  975. $ref: '#/components/schemas/LoginMethods'
  976. nullable: true
  977. description: if null or empty any available login method is allowed
  978. file_extensions:
  979. type: array
  980. items:
  981. $ref: '#/components/schemas/ExtensionsFilter'
  982. nullable: true
  983. description: filters based on file extensions. 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 listed in the list of files. Please note that these restrictions can be easily bypassed
  984. description: Additional restrictions
  985. S3Config:
  986. type: object
  987. properties:
  988. bucket:
  989. type: string
  990. minLength: 1
  991. region:
  992. type: string
  993. minLength: 1
  994. access_key:
  995. type: string
  996. minLength: 1
  997. access_secret:
  998. type: string
  999. minLength: 1
  1000. description: the access secret is stored encrypted (AES-256-GCM)
  1001. endpoint:
  1002. type: string
  1003. description: optional endpoint
  1004. storage_class:
  1005. type: string
  1006. upload_part_size:
  1007. type: integer
  1008. 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.
  1009. upload_concurrency:
  1010. type: integer
  1011. description: the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used
  1012. key_prefix:
  1013. type: string
  1014. description: key_prefix is similar to a chroot directory for a local filesystem. If specified the SFTP 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
  1015. example: folder/subfolder/
  1016. required:
  1017. - bucket
  1018. - region
  1019. nullable: true
  1020. description: S3 Compatible Object Storage configuration details
  1021. GCSConfig:
  1022. type: object
  1023. properties:
  1024. bucket:
  1025. type: string
  1026. minLength: 1
  1027. credentials:
  1028. type: string
  1029. format: byte
  1030. description: Google Cloud Storage JSON credentials base64 encoded. This field must be populated only when adding/updating an user. It will be always omitted, since there are sensitive data, when you search/get users. The credentials will be stored in the configured "credentials_path"
  1031. automatic_credentials:
  1032. type: integer
  1033. nullable: true
  1034. enum:
  1035. - 0
  1036. - 1
  1037. description: >
  1038. Automatic credentials:
  1039. * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null
  1040. * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials
  1041. storage_class:
  1042. type: string
  1043. key_prefix:
  1044. type: string
  1045. description: key_prefix is similar to a chroot directory for a local filesystem. If specified the SFTP 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
  1046. example: folder/subfolder/
  1047. required:
  1048. - bucket
  1049. nullable: true
  1050. description: Google Cloud Storage configuration details
  1051. FilesystemConfig:
  1052. type: object
  1053. properties:
  1054. provider:
  1055. type: integer
  1056. enum:
  1057. - 0
  1058. - 1
  1059. - 2
  1060. description: >
  1061. Providers:
  1062. * `0` - local filesystem
  1063. * `1` - S3 Compatible Object Storage
  1064. * `2` - Google Cloud Storage
  1065. s3config:
  1066. $ref: '#/components/schemas/S3Config'
  1067. gcsconfig:
  1068. $ref: '#/components/schemas/GCSConfig'
  1069. description: Storage filesystem details
  1070. VirtualFolder:
  1071. type: object
  1072. properties:
  1073. virtual_path:
  1074. type: string
  1075. mapped_path:
  1076. type: string
  1077. required:
  1078. - virtual_path
  1079. - mapped_path
  1080. description: A virtual folder is a mapping between a SFTP/SCP 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.
  1081. User:
  1082. type: object
  1083. properties:
  1084. id:
  1085. type: integer
  1086. format: int32
  1087. minimum: 1
  1088. status:
  1089. type: integer
  1090. enum:
  1091. - 0
  1092. - 1
  1093. description: >
  1094. status:
  1095. * `0` user is disabled, login is not allowed
  1096. * `1` user is enabled
  1097. username:
  1098. type: string
  1099. expiration_date:
  1100. type: integer
  1101. format: int64
  1102. description: expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration
  1103. password:
  1104. type: string
  1105. nullable: true
  1106. description: password or public key 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
  1107. public_keys:
  1108. type: array
  1109. items:
  1110. type: string
  1111. nullable: true
  1112. description: a password or at least one public key are mandatory.
  1113. home_dir:
  1114. type: string
  1115. 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
  1116. virtual_folders:
  1117. type: array
  1118. items:
  1119. $ref: '#/components/schemas/VirtualFolder'
  1120. nullable: true
  1121. description: mapping between virtual SFTP/SCP paths and filesystem paths outside the user home directory. Supported for local filesystem only
  1122. uid:
  1123. type: integer
  1124. format: int32
  1125. minimum: 0
  1126. maximum: 65535
  1127. 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
  1128. gid:
  1129. type: integer
  1130. format: int32
  1131. minimum: 0
  1132. maximum: 65535
  1133. 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
  1134. max_sessions:
  1135. type: integer
  1136. format: int32
  1137. description: Limit the sessions that an user can open. 0 means unlimited
  1138. quota_size:
  1139. type: integer
  1140. format: int64
  1141. description: Quota as size in bytes. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTP/SCP otherwise a quota scan is needed
  1142. quota_files:
  1143. type: integer
  1144. format: int32
  1145. description: Quota as number of files. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTP/SCP otherwise a quota scan is needed
  1146. permissions:
  1147. type: object
  1148. items:
  1149. $ref: '#/components/schemas/DirPermissions'
  1150. minItems: 1
  1151. example: {"/":["*"],"/somedir":["list","download"]}
  1152. used_quota_size:
  1153. type: integer
  1154. format: int64
  1155. used_quota_file:
  1156. type: integer
  1157. format: int32
  1158. last_quota_update:
  1159. type: integer
  1160. format: int64
  1161. description: Last quota update as unix timestamp in milliseconds
  1162. upload_bandwidth:
  1163. type: integer
  1164. format: int32
  1165. description: Maximum upload bandwidth as KB/s, 0 means unlimited
  1166. download_bandwidth:
  1167. type: integer
  1168. format: int32
  1169. description: Maximum download bandwidth as KB/s, 0 means unlimited
  1170. last_login:
  1171. type: integer
  1172. format: int64
  1173. description: Last user login as unix timestamp in milliseconds
  1174. filters:
  1175. $ref: '#/components/schemas/UserFilters'
  1176. filesystem:
  1177. $ref: '#/components/schemas/FilesystemConfig'
  1178. Transfer:
  1179. type: object
  1180. properties:
  1181. operation_type:
  1182. type: string
  1183. enum:
  1184. - upload
  1185. - download
  1186. path:
  1187. type: string
  1188. description: file path for the upload/download
  1189. start_time:
  1190. type: integer
  1191. format: int64
  1192. description: start time as unix timestamp in milliseconds
  1193. size:
  1194. type: integer
  1195. format: int64
  1196. description: bytes transferred
  1197. last_activity:
  1198. type: integer
  1199. format: int64
  1200. description: last transfer activity as unix timestamp in milliseconds
  1201. ConnectionStatus:
  1202. type: object
  1203. properties:
  1204. username:
  1205. type: string
  1206. description: connected username
  1207. connection_id:
  1208. type: string
  1209. description: unique connection identifier
  1210. client_version:
  1211. type: string
  1212. description: client version
  1213. remote_address:
  1214. type: string
  1215. description: Remote address for the connected client
  1216. connection_time:
  1217. type: integer
  1218. format: int64
  1219. description: connection time as unix timestamp in milliseconds
  1220. ssh_command:
  1221. type: string
  1222. description: SSH command. This is not empty for protocol SSH
  1223. last_activity:
  1224. type: integer
  1225. format: int64
  1226. description: last client activity as unix timestamp in milliseconds
  1227. protocol:
  1228. type: string
  1229. enum:
  1230. - SFTP
  1231. - SCP
  1232. - SSH
  1233. active_transfers:
  1234. type: array
  1235. items:
  1236. $ref : '#/components/schemas/Transfer'
  1237. QuotaScan:
  1238. type: object
  1239. properties:
  1240. username:
  1241. type: string
  1242. description: username with an active scan
  1243. start_time:
  1244. type: integer
  1245. format: int64
  1246. description: scan start time as unix timestamp in milliseconds
  1247. ApiResponse:
  1248. type: object
  1249. properties:
  1250. status:
  1251. type: integer
  1252. format: int32
  1253. minimum: 200
  1254. maximum: 500
  1255. example: 200
  1256. description: HTTP Status code, for example 200 OK, 400 Bad request and so on
  1257. message:
  1258. type: string
  1259. nullable: true
  1260. description: additional message if any
  1261. error:
  1262. type: string
  1263. nullable: true
  1264. description: error description if any
  1265. VersionInfo:
  1266. type: object
  1267. properties:
  1268. version:
  1269. type: string
  1270. build_date:
  1271. type: string
  1272. commit_hash:
  1273. type: string
  1274. securitySchemes:
  1275. BasicAuth:
  1276. type: http
  1277. scheme: basic