| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899 |
- openapi: 3.0.1
- info:
- title: SFTPGo
- description: 'SFTPGo REST API'
- version: 1.5.0
- servers:
- - url: /api/v1
- paths:
- /version:
- get:
- tags:
- - version
- summary: Get version details
- operationId: get_version
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: array
- items:
- $ref : '#/components/schemas/VersionInfo'
- /providerstatus:
- get:
- tags:
- - providerstatus
- summary: Get data provider status
- operationId: get_provider_status
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 200
- message: "Alive"
- error: ""
- 500:
- description: Provider Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- /connection:
- get:
- tags:
- - connections
- summary: Get the active users and info about their uploads/downloads
- operationId: get_connections
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: array
- items:
- $ref : '#/components/schemas/ConnectionStatus'
- /connection/{connectionID}:
- delete:
- tags:
- - connections
- summary: Terminate an active connection
- operationId: close_connection
- parameters:
- - name: connectionID
- in: path
- description: ID of the connection to close
- required: true
- schema:
- type: string
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 200
- message: "Connection closed"
- error: ""
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 404:
- description: Not Found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 404
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- /quota_scan:
- get:
- tags:
- - quota
- summary: Get the active quota scans
- operationId: get_quota_scans
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: array
- items:
- $ref : '#/components/schemas/QuotaScan'
- post:
- tags:
- - quota
- summary: start a new quota scan
- description: A quota scan update the number of files and their total size for the given user
- operationId: start_quota_scan
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/User'
- responses:
- 201:
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 201
- message: "Scan started"
- error: ""
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 404:
- description: Not Found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 404
- message: ""
- error: "Error description if any"
- 409:
- description: Another scan is already in progress for this user
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 409
- message: "Another scan is already in progress"
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- /user:
- get:
- tags:
- - users
- summary: Returns an array with one or more users
- description: For security reasons hashed passwords are omitted in the response
- operationId: get_users
- parameters:
- - in: query
- name: offset
- schema:
- type: integer
- minimum: 0
- default: 0
- required: false
- - in: query
- name: limit
- schema:
- type: integer
- minimum: 1
- maximum: 500
- default: 100
- required: false
- description: The maximum number of items to return. Max value is 500, default is 100
- - in: query
- name: order
- required: false
- description: Ordering users by username
- schema:
- type: string
- enum:
- - ASC
- - DESC
- example: ASC
- - in: query
- name: username
- required: false
- description: Filter by username, extact match case sensitive
- schema:
- type: string
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: array
- items:
- $ref : '#/components/schemas/User'
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- post:
- tags:
- - users
- summary: Adds a new user
- operationId: add_user
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/User'
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/User'
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- /user/{userID}:
- get:
- tags:
- - users
- summary: Find user by ID
- description: For security reasons the hashed password is omitted in the response
- operationId: get_user_by_id
- parameters:
- - name: userID
- in: path
- description: ID of the user to retrieve
- required: true
- schema:
- type: integer
- format: int32
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/User'
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 404:
- description: Not Found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 404
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- put:
- tags:
- - users
- summary: Update an existing user
- operationId: update_user
- parameters:
- - name: userID
- in: path
- description: ID of the user to update
- required: true
- schema:
- type: integer
- format: int32
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/User'
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/ApiResponse'
- example:
- status: 200
- message: "User updated"
- error: ""
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 404:
- description: Not Found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 404
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- delete:
- tags:
- - users
- summary: Delete an existing user
- operationId: delete_user
- parameters:
- - name: userID
- in: path
- description: ID of the user to delete
- required: true
- schema:
- type: integer
- format: int32
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/ApiResponse'
- example:
- status: 200
- message: "User deleted"
- error: ""
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 404:
- description: Not Found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 404
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- /dumpdata:
- get:
- tags:
- - maintenance
- summary: Backup SFTPGo data serializing them as JSON
- 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
- operationId: dumpdata
- parameters:
- - in: query
- name: output_file
- schema:
- type: string
- required: true
- 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
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/ApiResponse'
- example:
- status: 200
- message: "Data saved"
- error: ""
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- /loaddata:
- get:
- tags:
- - maintenance
- summary: Restore SFTPGo data from a JSON backup
- description: New users are added, existing users are updated. Users will be restored one by one and the restore is stopped if a user cannot be added/updated, so it could happen a partial restore
- operationId: loaddata
- parameters:
- - in: query
- name: input_file
- schema:
- type: string
- required: true
- 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
- - in: query
- name: scan_quota
- schema:
- type: integer
- enum:
- - 0
- - 1
- - 2
- description: >
- Quota scan:
- * `0` no quota scan is done, the imported user will have used_quota_size and used_quota_file = 0
- * `1` scan quota
- * `2` scan quota if the user has quota restrictions
- required: false
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref : '#/components/schemas/ApiResponse'
- example:
- status: 200
- message: "Data restored"
- error: ""
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 400
- message: ""
- error: "Error description if any"
- 403:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 403
- message: ""
- error: "Error description if any"
- 500:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- example:
- status: 500
- message: ""
- error: "Error description if any"
- components:
- schemas:
- Permission:
- type: string
- enum:
- - '*'
- - list
- - download
- - upload
- - overwrite
- - delete
- - rename
- - create_dirs
- - create_symlinks
- - chmod
- - chown
- - chtimes
- description: >
- Permissions:
- * `*` - all permissions are granted
- * `list` - list items is allowed
- * `download` - download files is allowed
- * `upload` - upload files is allowed
- * `overwrite` - overwrite an existing file, while uploading, is allowed. upload permission is required to allow file overwrite
- * `delete` - delete files or directories is allowed
- * `rename` - rename files or directories is allowed
- * `create_dirs` - create directories is allowed
- * `create_symlinks` - create links is allowed
- * `chmod` changing file or directory permissions is allowed
- * `chown` changing file or directory owner and group is allowed
- * `chtimes` changing file or directory access and modification time is allowed
- DirPermissions:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Permission'
- minItems: 1
- minProperties: 1
- 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
- UserFilters:
- type: object
- properties:
- allowed_ip:
- type: array
- items:
- type: string
- nullable: true
- 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"
- example: [ "192.0.2.0/24", "2001:db8::/32" ]
- denied_ip:
- type: array
- items:
- type: string
- nullable: true
- description: clients connecting from these IP/Mask are not allowed. Denied rules are evaluated before allowed ones
- example: [ "172.16.0.0/16" ]
- User:
- type: object
- properties:
- id:
- type: integer
- format: int32
- minimum: 1
- status:
- type: integer
- enum:
- - 0
- - 1
- description: >
- status:
- * `0` user is disabled, login is not allowed
- * `1` user is enabled
- username:
- type: string
- expiration_date:
- type: integer
- format: int64
- description: expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration
- password:
- type: string
- nullable: true
- 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
- public_keys:
- type: array
- items:
- type: string
- nullable: true
- description: a password or at least one public key are mandatory.
- home_dir:
- type: string
- 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
- uid:
- type: integer
- format: int32
- minimum: 0
- maximum: 65535
- 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
- gid:
- type: integer
- format: int32
- minimum: 0
- maximum: 65535
- 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
- max_sessions:
- type: integer
- format: int32
- description: Limit the sessions that an user can open. 0 means unlimited
- quota_size:
- type: integer
- format: int64
- 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
- quota_files:
- type: integer
- format: int32
- 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
- permissions:
- type: object
- items:
- $ref: '#/components/schemas/DirPermissions'
- minItems: 1
- example: {"/":["*"],"/somedir":["list","download"]}
- used_quota_size:
- type: integer
- format: int64
- used_quota_file:
- type: integer
- format: int32
- last_quota_update:
- type: integer
- format: int64
- description: Last quota update as unix timestamp in milliseconds
- upload_bandwidth:
- type: integer
- format: int32
- description: Maximum upload bandwidth as KB/s, 0 means unlimited
- download_bandwidth:
- type: integer
- format: int32
- description: Maximum download bandwidth as KB/s, 0 means unlimited
- last_login:
- type: integer
- format: int64
- description: Last user login as unix timestamp in milliseconds
- filters:
- $ref: '#/components/schemas/UserFilters'
- nullable: true
- description: Additional restrictions
- Transfer:
- type: object
- properties:
- operation_type:
- type: string
- enum:
- - upload
- - download
- path:
- type: string
- description: file path for the upload/download
- start_time:
- type: integer
- format: int64
- description: start time as unix timestamp in milliseconds
- size:
- type: integer
- format: int64
- description: bytes transferred
- last_activity:
- type: integer
- format: int64
- description: last transfer activity as unix timestamp in milliseconds
- ConnectionStatus:
- type: object
- properties:
- username:
- type: string
- description: connected username
- connection_id:
- type: string
- description: unique connection identifier
- client_version:
- type: string
- description: client version
- remote_address:
- type: string
- description: Remote address for the connected client
- connection_time:
- type: integer
- format: int64
- description: connection time as unix timestamp in milliseconds
- ssh_command:
- type: string
- description: SSH command. This is not empty for protocol SSH
- last_activity:
- type: integer
- format: int64
- description: last client activity as unix timestamp in milliseconds
- protocol:
- type: string
- enum:
- - SFTP
- - SCP
- - SSH
- active_transfers:
- type: array
- items:
- $ref : '#/components/schemas/Transfer'
- QuotaScan:
- type: object
- properties:
- username:
- type: string
- description: username with an active scan
- start_time:
- type: integer
- format: int64
- description: scan start time as unix timestamp in milliseconds
- ApiResponse:
- type: object
- properties:
- status:
- type: integer
- format: int32
- minimum: 200
- maximum: 500
- example: 200
- description: HTTP Status code, for example 200 OK, 400 Bad request and so on
- message:
- type: string
- nullable: true
- description: additional message if any
- error:
- type: string
- nullable: true
- description: error description if any
- VersionInfo:
- type: object
- properties:
- version:
- type: string
- build_date:
- type: string
- commit_hash:
- type: string
|