REST API

The web GUI is a client of a JSON REST API served by the web GUI server (default http://localhost:3000, or https:// when HTTPS is enabled). Everything the GUI can do, scripts can do too. Start the server from the desktop app (Listeners → Web GUI Server → Start) or headless with WEB_PORT=3000 WEB_HTTPS=true node dist/web-only.js.

# sign in and keep the session cookie
curl -k -c jar -H 'Content-Type: application/json' \
     -d '{"username":"admin","password":"<your password>"}' https://localhost:3000/api/login

# list connected clients
curl -k -b jar https://localhost:3000/api/sessions

# create an SFTP listener on port 2222
curl -k -b jar -H 'Content-Type: application/json' \
     -d '{"name":"Partners","protocol":"SFTP","bindingIp":"0.0.0.0","port":2222,"enabled":true}' \
     https://localhost:3000/api/listeners

For scripts, create a personal access token under Security → API Tokens and send it instead of a session cookie: curl -k -H "Authorization: Bearer sst_…" https://localhost:3000/api/sessions. Tokens act as the user who created them, can expire and can be revoked; they bypass two-factor sign-in, so keep them secret.

Live events: open a WebSocket to the same host and port (ws:// or wss://) to receive { "type": "activity", "data": { listenerId, username, action, path, success, timestamp } } messages for every login, transfer and admin action.

Authentication

Sign in to receive an HttpOnly sessionId cookie (also Secure when the GUI is served over HTTPS). Every other /api endpoint requires it and answers 401 without it. While a password change is pending, only the change-password, user and logout endpoints are available (others answer 403 with requirePasswordChange: true).

POST /api/login

Body { username, password, totp? }. Returns { success, username }, plus requirePasswordChange: true when a new password must be chosen. Only users with GUI access may sign in. Banned addresses get 429.

POST /api/change-password

Body { newPassword, currentPassword }. currentPassword is not needed while a change is being forced. New passwords need at least 8 characters and must differ from the default and the current one. Every other sign-in of that user (admin GUI and file portal) is ended; the current one stays.

POST /api/logout

Ends the session.

GET /api/user

The signed-in user: { username }.

GET /api/server-identity

{ sshHostKeyFingerprint } — give this to users so their SFTP client can verify the server.

Listeners

FTP and SFTP servers. tlsMode (FTP only) is none, optional or required.

GET /api/listeners

All listeners.

GET /api/listeners/:id

One listener, or 404.

POST /api/listeners

Body { name, protocol: 'FTP'|'SFTP', bindingIp, port, enabled, tlsMode? }. Enabled listeners start immediately.

PUT /api/listeners/:id

Body { name, bindingIp, port, enabled, tlsMode? }. A running listener is restarted with the new settings.

DELETE /api/listeners/:id

Stops (if running) and deletes the listener.

POST /api/listeners/:id/start

Start; 400 if already running or disabled.

POST /api/listeners/:id/stop

Stop.

POST /api/listeners/:id/restart

Restart.

GET /api/listener-statuses

[{ listener, running }] including the web GUI itself (id: -1, protocol HTTP/HTTPS).

Users

Password hashes are never returned.

GET /api/users

All users.

GET /api/users/:username

One user, or 404.

POST /api/users

Body { username, password, passwordEnabled, publicKey?, guiEnabled, guiRole?, mustChangePassword?, portalEnabled?, allowedIps? }. publicKey holds OpenSSH public key lines (one per line); allowedIps a list of addresses / CIDR ranges. guiRole is admin (default) or viewer: read-only users (and their API tokens) can use every GET endpoint except /api/backup and /api/files/download, see share links without their tokens and webhooks without their URLs, and may only change their own password, two-factor sign-in and API tokens; anything else returns 403. The last administrator cannot be deleted, demoted or have GUI access removed (400).

PUT /api/users/:username

Body { password?, passwordEnabled, publicKey?, guiEnabled, mustChangePassword?, portalEnabled?, allowedIps? }. Optionally also listeners (ids), virtualPaths and permissions arrays to replace the user's access in one call. Setting a password ends all of the user's GUI and portal sign-ins; removing GUI access ends their GUI sign-ins.

GET /api/users/:username/usage

Storage used by the user: { usedBytes, quotaBytes } (quotaBytes is 0 or absent when unlimited).

DELETE /api/users/:username

Delete the user and end their sessions and sign-ins.

GET /api/users/:username/subscriptions

Listener ids the user may connect to.

POST /api/users/:username/subscriptions

Body { listenerId }.

DELETE /api/users/:username/subscriptions/:listenerId

Revoke access to a listener.

GET /api/users/:username/virtual-paths

The user's virtual path mappings.

POST /api/users/:username/virtual-paths

Body { virtualPath, localPath, canRead, canWrite, canAppend, canDelete, canList, canCreateDir, canRename, applyToSubdirs }.

DELETE /api/users/:username/virtual-paths/:id

Remove a mapping.

GET /api/users/id/:userId/listeners

Listener ids by user id.

GET /api/users/id/:userId/virtual-paths

Virtual paths by user id.

GET /api/users/id/:userId/permissions/:listenerId

Listener-level permissions, or null.

Sessions

GET /api/sessions

Connected FTP/SFTP clients: { sessionId, username, ipAddress, connectedAt, listenerId, listenerName, protocol }.

DELETE /api/sessions/:sessionId

Disconnect a client; 404 if it already left.

Files

Paths are virtual paths of the given user; .. and anything outside the user's mappings is refused with 403.

GET /api/files/browse?username=&path=

{ files: [{ name, type, size, modified }], currentPath }.

GET /api/files/download?username=&path=

Downloads a file (Content-Disposition: attachment).

Activity log & settings

GET /api/activity?limit=

Most recent entries (default 100).

GET /api/activity/count

{ count }.

DELETE /api/activity

Body { beforeDate? } (ISO 8601). Without a date the whole log is cleared. Returns { success, count }.

GET /api/activity/old-stats?retentionDays=

Entries older than the retention period: { count }.

POST /api/activity/cleanup

Apply the retention period now: { success, count }.

GET /api/settings

All settings, e.g. logRetentionDays, webHttps, tlsCertPath, tlsKeyPath. Secrets such as the LDAP bind password are never returned.

GET /api/settings/:key

{ key, value }.

PUT /api/settings/:key

Body { value }. Only logRetentionDays, webHttps, tlsCertPath, tlsKeyPath, setupComplete, trustProxy (trusted reverse proxies: addresses, CIDR ranges, loopback, linklocal, uniquelocal), maxConnectionsPerListener, sshAlgorithms (modern or compatible), tlsMinVersion (TLSv1.2 or TLSv1.3) and webdavEnabled (true or false) can be changed here; security, directory, audit and recycle-bin settings use their own endpoints. Other keys get 400.

Two-factor sign-in

For the signed-in admin. POST /api/login answers 401 with requireTotp: true when a code is needed; send it as totp.

POST /api/2fa/setup

Start setup: { secret, otpauthUrl, qrSvg }.

POST /api/2fa/enable

Body { code } — confirm with a code from the authenticator app.

POST /api/2fa/disable

Body { code } — a current code is required.

Security

Brute-force protection: repeated failed logins from one IP address ban it for a while (all protocols).

GET /api/security/settings

{ enabled, maxFailures, windowMinutes, banMinutes, allowlist }.

PUT /api/security/settings

Update any of those fields; allowlist is a list of addresses / CIDR ranges that are never banned.

GET /api/security/bans

Active bans: [{ ip, reason, bannedAt, expiresAt }].

DELETE /api/security/bans/:ip

Lift a ban.

Single sign-on (OpenID Connect)

GET /api/oidc

{ enabled, issuer, clientId, scopes, usernameClaim, stripDomain, gui, portal, buttonLabel, publicUrl, hasClientSecret, redirectUri }. The client secret is never returned.

PUT /api/oidc

Change the settings. clientSecret replaces the saved secret: "" removes it, and leaving it out keeps it.

GET /auth/oidc/start?target=gui|portal, GET /auth/oidc/callback

The browser sign-in flow. These are not API calls. GET /auth/oidc/config tells the sign-in pages whether to show the button.

Email notifications

GET /api/email

{ enabled, host, port, security: 'starttls'|'tls'|'none', verifyTls, username, from, to, events, usernameFilter, pathPrefix, batchSeconds, hasPassword, lastResult }. Events: alert, upload, download, delete, login, login_failed, share. The password is never returned.

PUT /api/email

Change settings; password replaces the saved one ("" removes it, omitted keeps it).

POST /api/email/test

Send a test email with the given (unsaved) settings over the saved ones: { ok: true }, or 502 with the SMTP server's answer.

Certificates (Let's Encrypt)

GET /api/acme

{ settings: { enabled, domains, email, directory, httpPort, agreeTos }, status: { state: 'off'|'pending'|'valid'|'error', domains?, notAfter?, lastAttemptAt?, lastError? }, directories }.

PUT /api/acme

Change settings. directory is production, staging or the https:// directory URL of another ACME CA; httpPort 0 answers challenges only through the web server. Turning it on needs domains and agreeTos: true, and requests a certificate if one is due.

POST /api/acme/issue

Get a certificate now; answers when it is done (502 with the CA's explanation on failure).

WebDAV

Not a JSON API: users' files over WebDAV (RFC 4918 class 1, plus advisory locks) at /webdav/, with HTTP Basic authentication as the user. On when the webdavEnabled setting is "true" (PUT /api/settings/webdavEnabled with { "value": "true" }).

Groups

Members of a group get its listeners, listener permissions and folders in addition to their own.

GET /api/groups

All groups: [{ id, name, description, memberCount }].

GET /api/groups/memberships

Group names of every user: { "alice": ["Accounting"], ... }.

GET /api/groups/:id

One group with members (usernames), listeners ([{ listenerId, permissions: { canRead, canCreate, canEdit, canAppend, canDelete, canList, canCreateDir, canRename } }]) and folders ([{ id, virtualPath, localPath, canRead, canWrite, canAppend, canDelete, canList, canCreateDir, canRename, applyToSubdirs }]).

POST /api/groups

Body { name, description?, members?, listeners?, folders? } in the shape above; omitted permissions are granted. Returns the group (201).

PUT /api/groups/:id

Change any of the fields. members, listeners and folders replace the current lists when given (keep a folder's id to update it in place).

DELETE /api/groups/:id

Delete the group; its members keep their own access.

Webhooks

Events: upload, download, delete, login, login_failed, share. Deliveries are signed with X-SLightSFTP-Signature: sha256=<HMAC> when a secret is set.

GET /api/webhooks

All webhooks (secrets are never returned; hasSecret instead).

POST /api/webhooks

Body { name, url, events, format: 'json'|'slack', usernameFilter?, pathPrefix?, secret? }.

PUT /api/webhooks/:id

Update fields, e.g. { enabled: false }.

DELETE /api/webhooks/:id

Delete.

POST /api/webhooks/:id/test

Send a test event: { ok, status, error?, attempts }.

Cloud storage

Connections to Amazon S3 (or S3-compatible services such as MinIO, Wasabi, Cloudflare R2, Backblaze B2) and Azure Blob containers. A virtual path whose local path is cloud://<id>/<folder> lives in that bucket. Secrets are never returned; hasSecretAccessKey, hasConnectionString and hasAccountKey say whether one is saved.

GET /api/storage

All connections, each with url (cloud://<id>) and usedBy (the virtual paths that use it).

POST /api/storage

S3: { name, type: 's3', config: { bucket, region?, endpoint?, accessKeyId, secretAccessKey, forcePathStyle? } }. Azure: { name, type: 'azure', config: { container, connectionString } } or config: { container, accountName, accountKey, endpoint? }.

PUT /api/storage/:id

Update; fields you leave out, and secrets you send empty, keep their saved values.

DELETE /api/storage/:id

Delete the connection (not the files). Answers 409 while a virtual path still uses it.

POST /api/storage/test

Body: a connection as for POST, or { id } for a saved one. Lists, uploads, reads back and deletes a probe object: { ok, message }.

Directory sign-in (LDAP)

GET /api/ldap

{ enabled, url, bindDn, baseDn, userFilter, tlsVerify, startTls, hasBindPassword }. With startTls, ldap:// connections are upgraded before any password is sent; a server that refuses StartTLS fails the sign-in.

PUT /api/ldap

Same fields plus bindPassword (empty keeps the saved one). userFilter must contain {username}.

POST /api/ldap/test

Body { username? }: bind with the service account and optionally look a user up.

API tokens

GET /api/tokens

Your tokens (never the token itself): { id, name, hint, createdAt, lastUsedAt, expiresAt }.

POST /api/tokens

Body { name, expiresInDays? }. The response includes token once; only its hash is stored.

DELETE /api/tokens/:id

Revoke one of your tokens.

Recycle bin

GET /api/trash

{ settings: { enabled, retentionDays }, items }.

PUT /api/trash/settings

Body { enabled?, retentionDays? } (1–3650 days).

POST /api/trash/:id/restore

Put a deleted file back where it was.

DELETE /api/trash/:id · DELETE /api/trash

Delete one item, or empty the recycle bin, permanently.

Monitoring

GET /healthz and GET /readyz

No sign-in. /healthz returns 200 {"status":"ok"} while the process and its database answer (liveness). /readyz also requires every enabled listener to be accepting connections, and returns 503 with checks.listeners.enabled / running counts otherwise (readiness; the Docker image's HEALTHCHECK uses it).

GET /metrics

Prometheus metrics; authenticate with an API token (a read-only user's is enough), e.g. authorization: { credentials: sst_… } in prometheus.yml. Includes slightsftp_sessions{protocol}, slightsftp_listener_up{listener,protocol,port}, slightsftp_logins_total{protocol,result}, slightsftp_transfers_total / slightsftp_transfer_bytes_total{protocol,direction}, slightsftp_deletes_total, slightsftp_transfers_in_progress, slightsftp_ip_bans, slightsftp_info{version} and the standard process / Node.js runtime metrics (prefixed slightsftp_). protocol is SFTP, FTP or web (web GUI, portal and share links).

Audit export, backup and updates

GET /api/audit/settings · PUT /api/audit/settings

{ syslog: { enabled, host, port, protocol: 'udp'|'tcp', facility }, checksumUploads }.

POST /api/audit/test-syslog

Send a test message to the syslog server: { ok, error? }.

GET /api/backup

Download the whole configuration (database, SFTP host key, TLS certificate and the master key for stored secrets) as an unencrypted JSON bundle. It contains password hashes and keys: prefer POST /api/backup.

POST /api/backup

Body { passphrase } (at least 8 characters): the same bundle encrypted with AES-256-GCM under a key derived from the passphrase with scrypt (format: "slightsftp-backup-encrypted"). An empty passphrase returns the unencrypted bundle.

GET /api/backup/schedule, PUT /api/backup/schedule, POST /api/backup/schedule/run

Scheduled backups. Body for PUT: { enabled?, intervalHours? (1–720), keep? (1–365), directory? (absolute path, "" = default), passphrase? (string to set, null to remove) }. Responses include hasPassphrase, lastRunAt and lastResult, never the passphrase. run writes one backup now and returns its file.

POST /api/backup/restore

Body: a bundle from GET /api/backup, or { bundle, passphrase } for an encrypted one. Replaces the configuration and restarts the listeners. A missing or wrong passphrase returns 400 with passphraseRequired: true.

GET /api/update

{ currentVersion, latestVersion, updateAvailable, url } from GitHub Releases (?force=1 skips the cache).

Share links

Created by users in the file portal; admins can list and revoke all of them.

GET /api/shares

All links: { id, owner, type, virtualPath, status, downloadCount, maxDownloads, expiresAt, hasPassword, url }.

DELETE /api/shares/:id

Revoke a link.

File portal API

Used by /files; separate portalSession cookie, never valid for the admin API.

POST /portal/api/login

Body { username, password, totp? }.

GET /portal/api/list?path=

Folder listing with the permissions that apply there. For a user without a / mapping, / (and any folder leading to a mapping) lists those folders read-only.

GET /portal/api/download?path=

Download a file.

PUT /portal/api/upload?path=

Upload the request body as a file.

POST /portal/api/mkdir · /portal/api/rename

Body { path } / { from, to }. A mapped root folder cannot be renamed (403); renaming onto an existing name answers 409.

DELETE /portal/api/file?path=

Delete a file or empty folder.

POST /portal/api/shares

Body { path, type: 'download'|'upload', password?, expiresInDays?, maxDownloads? }. A file link needs Read, a folder link List and Read, an upload link Write. Access is re-checked on every visit, and downloads are counted atomically, so maxDownloads holds under concurrent downloads (410 once reached).

GET /portal/api/shares · DELETE /portal/api/shares/:id · GET /portal/api/shares/:id/qr.svg

The user's own links, revoking one, and a QR code for it.

GET /portal/api/trash · POST /portal/api/trash/:id/restore · DELETE /portal/api/trash/:id

The user's recycle bin: list deleted files, restore one, or delete it for good.

POST /portal/api/change-password · /portal/api/2fa/setup · /portal/api/2fa/enable · /portal/api/2fa/disable · /portal/api/logout · GET /portal/api/me

Account self-service for the signed-in portal user. Changing the password ends the user's other sign-ins. The account's IP restriction is re-checked on every request.

Command line

npm start            # build and run the desktop app
npm run start:web    # build and run headless with the web GUI (WEB_PORT, WEB_HTTPS)
npm test             # unit, integration and end-to-end tests
npm run test:e2e     # browser and desktop GUI tests (Playwright)
npm run dist:linux   # build AppImage + .deb
npm run dist:win     # build the Windows MSI