Automate SLightSFTP through the same REST API the web GUI uses
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.
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/loginBody { 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-passwordBody { 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/logoutEnds the session.
GET /api/userThe signed-in user: { username }.
GET /api/server-identity{ sshHostKeyFingerprint } — give this to users so their SFTP client can verify the server.
FTP and SFTP servers. tlsMode (FTP only) is none, optional or required.
GET /api/listenersAll listeners.
GET /api/listeners/:idOne listener, or 404.
POST /api/listenersBody { name, protocol: 'FTP'|'SFTP', bindingIp, port, enabled, tlsMode? }. Enabled listeners start immediately.
PUT /api/listeners/:idBody { name, bindingIp, port, enabled, tlsMode? }. A running listener is restarted with the new settings.
DELETE /api/listeners/:idStops (if running) and deletes the listener.
POST /api/listeners/:id/startStart; 400 if already running or disabled.
POST /api/listeners/:id/stopStop.
POST /api/listeners/:id/restartRestart.
GET /api/listener-statuses[{ listener, running }] including the web GUI itself (id: -1, protocol HTTP/HTTPS).
Password hashes are never returned.
GET /api/usersAll users.
GET /api/users/:usernameOne user, or 404.
POST /api/usersBody { 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/:usernameBody { 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/usageStorage used by the user: { usedBytes, quotaBytes } (quotaBytes is 0 or absent when unlimited).
DELETE /api/users/:usernameDelete the user and end their sessions and sign-ins.
GET /api/users/:username/subscriptionsListener ids the user may connect to.
POST /api/users/:username/subscriptionsBody { listenerId }.
DELETE /api/users/:username/subscriptions/:listenerIdRevoke access to a listener.
GET /api/users/:username/virtual-pathsThe user's virtual path mappings.
POST /api/users/:username/virtual-pathsBody { virtualPath, localPath, canRead, canWrite, canAppend, canDelete, canList, canCreateDir, canRename, applyToSubdirs }.
DELETE /api/users/:username/virtual-paths/:idRemove a mapping.
GET /api/users/id/:userId/listenersListener ids by user id.
GET /api/users/id/:userId/virtual-pathsVirtual paths by user id.
GET /api/users/id/:userId/permissions/:listenerIdListener-level permissions, or null.
GET /api/sessionsConnected FTP/SFTP clients: { sessionId, username, ipAddress, connectedAt, listenerId, listenerName, protocol }.
DELETE /api/sessions/:sessionIdDisconnect a client; 404 if it already left.
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).
GET /api/activity?limit=Most recent entries (default 100).
GET /api/activity/count{ count }.
DELETE /api/activityBody { 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/cleanupApply the retention period now: { success, count }.
GET /api/settingsAll 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/:keyBody { 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.
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/setupStart setup: { secret, otpauthUrl, qrSvg }.
POST /api/2fa/enableBody { code } — confirm with a code from the authenticator app.
POST /api/2fa/disableBody { code } — a current code is required.
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/settingsUpdate any of those fields; allowlist is a list of addresses / CIDR ranges that are never banned.
GET /api/security/bansActive bans: [{ ip, reason, bannedAt, expiresAt }].
DELETE /api/security/bans/:ipLift a ban.
GET /api/oidc{ enabled, issuer, clientId, scopes, usernameClaim, stripDomain, gui, portal, buttonLabel, publicUrl, hasClientSecret, redirectUri }. The client secret is never returned.
PUT /api/oidcChange 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/callbackThe browser sign-in flow. These are not API calls. GET /auth/oidc/config tells the sign-in pages whether to show the button.
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/emailChange settings; password replaces the saved one ("" removes it, omitted keeps it).
POST /api/email/testSend a test email with the given (unsaved) settings over the saved ones: { ok: true }, or 502 with the SMTP server's answer.
GET /api/acme{ settings: { enabled, domains, email, directory, httpPort, agreeTos }, status: { state: 'off'|'pending'|'valid'|'error', domains?, notAfter?, lastAttemptAt?, lastError? }, directories }.
PUT /api/acmeChange 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/issueGet a certificate now; answers when it is done (502 with the CA's explanation on failure).
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" }).
Members of a group get its listeners, listener permissions and folders in addition to their own.
GET /api/groupsAll groups: [{ id, name, description, memberCount }].
GET /api/groups/membershipsGroup names of every user: { "alice": ["Accounting"], ... }.
GET /api/groups/:idOne 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/groupsBody { name, description?, members?, listeners?, folders? } in the shape above; omitted permissions are granted. Returns the group (201).
PUT /api/groups/:idChange 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/:idDelete the group; its members keep their own access.
Events: upload, download, delete, login, login_failed, share. Deliveries are signed with X-SLightSFTP-Signature: sha256=<HMAC> when a secret is set.
GET /api/webhooksAll webhooks (secrets are never returned; hasSecret instead).
POST /api/webhooksBody { name, url, events, format: 'json'|'slack', usernameFilter?, pathPrefix?, secret? }.
PUT /api/webhooks/:idUpdate fields, e.g. { enabled: false }.
DELETE /api/webhooks/:idDelete.
POST /api/webhooks/:id/testSend a test event: { ok, status, error?, attempts }.
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/storageAll connections, each with url (cloud://<id>) and usedBy (the virtual paths that use it).
POST /api/storageS3: { 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/:idUpdate; fields you leave out, and secrets you send empty, keep their saved values.
DELETE /api/storage/:idDelete the connection (not the files). Answers 409 while a virtual path still uses it.
POST /api/storage/testBody: a connection as for POST, or { id } for a saved one. Lists, uploads, reads back and deletes a probe object: { ok, message }.
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/ldapSame fields plus bindPassword (empty keeps the saved one). userFilter must contain {username}.
POST /api/ldap/testBody { username? }: bind with the service account and optionally look a user up.
GET /api/tokensYour tokens (never the token itself): { id, name, hint, createdAt, lastUsedAt, expiresAt }.
POST /api/tokensBody { name, expiresInDays? }. The response includes token once; only its hash is stored.
DELETE /api/tokens/:idRevoke one of your tokens.
GET /api/trash{ settings: { enabled, retentionDays }, items }.
PUT /api/trash/settingsBody { enabled?, retentionDays? } (1–3650 days).
POST /api/trash/:id/restorePut a deleted file back where it was.
DELETE /api/trash/:id · DELETE /api/trashDelete one item, or empty the recycle bin, permanently.
GET /healthz and GET /readyzNo 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 /metricsPrometheus 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).
GET /api/audit/settings · PUT /api/audit/settings{ syslog: { enabled, host, port, protocol: 'udp'|'tcp', facility }, checksumUploads }.
POST /api/audit/test-syslogSend a test message to the syslog server: { ok, error? }.
GET /api/backupDownload 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/backupBody { 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/runScheduled 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/restoreBody: 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).
Created by users in the file portal; admins can list and revoke all of them.
GET /api/sharesAll links: { id, owner, type, virtualPath, status, downloadCount, maxDownloads, expiresAt, hasPassword, url }.
DELETE /api/shares/:idRevoke a link.
Used by /files; separate portalSession cookie, never valid for the admin API.
POST /portal/api/loginBody { 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/renameBody { 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/sharesBody { 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.svgThe 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/:idThe 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/meAccount 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.
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