API Documentation

Complete reference for the REST API and WebSocket interfaces of Open Relay Portal, a privacy-first, self-hosted streaming and community platform.

Introduction

Open Relay Portal provides one API for streams, chat, notifications, connections and administration. All API endpoints return JSON responses and require authentication unless otherwise noted.

Base URL: All API endpoints are relative to your Open Relay Portal installation (e.g., https://portal.example.com)

Response Format

All successful responses return JSON. Error responses include an error field:

{
  "error": "Unauthorized",
  "status": 401
}

Request IDs and upstream errors

Every response carries an X-Request-ID header (8 random characters made by the portal; a request ID sent by the client is never used, logged or passed on to a proxied service, and WebSocket handshakes carry none). The same ID is on every server log line written for that request.

When a proxied service cannot be reached the portal answers 502, 503 or 504 with Retry-After. A request under /api, an XHR, or one that asks for JSON gets {"error": "...", "request_id": "abcd2345", "retry_after": 15}; a browser gets a page with the service name, the ID and a retry countdown. The upstream's host, address and port are never shown.

Authentication

Open Relay Portal supports the following authentication methods:

  • JWT Tokens - Session-based authentication via cookies (used by the web UI)
  • API Keys - Long-lived keys for programmatic access (prefixed portal_)
  • RTMP Tokens - Temporary, single-use publish tokens for plain RTMP streaming (prefixed rtmp_). Generated via API or the My Streams UI. Expire after 15 minutes with a 30-second grace period for reconnects.

Using API Keys

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Or pass it as a query parameter (not recommended for sensitive operations):

GET /api/services?token=YOUR_API_KEY
POST /api/token Create session token (login)

Authenticate with username and password to receive a JWT token.

Request Body

ParameterTypeDescription
username string Your username required
password string Your password required
totp_code string Authenticator code or one-time backup code. required if the account has 2FA enabled

Two-factor accounts

For an account with 2FA enabled, a correct password alone does not issue a token. Without totp_code the endpoint returns 401 with "totp_required": true (only after the password has been verified); repeat the request with the code added. A wrong code returns 401. After 5 wrong codes within 5 minutes from one address, further attempts for that account from that address return 429 with a Retry-After header for 5 minutes; a higher per-account limit across all addresses applies as well (20 wrong codes in 15 minutes refuse further codes, from any address, until the oldest of them is 15 minutes old; Retry-After states the exact wait; when that happens an entry is added to the account's activity feed). Correct codes are also refused during a cooldown. A backup code works once. Scripts that cannot supply a code should use an API key instead.

Example

curl -X POST https://portal.example.com/api/token \
  -H "Content-Type: application/json" \
  -d '{"username": "user", "password": "pass", "totp_code": "123456"}'

Response

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "expires_at": "2024-01-15T12:00:00Z",
  "user": {
    "id": 1,
    "username": "user",
    "is_admin": false
  }
}

API Keys

API keys provide long-lived authentication for scripts and integrations. Keys can be scoped to limit access. Send a key as Authorization: Api-Key portal_... or X-API-Key: portal_...; Bearer accepts JWTs only. Keys are stored as an Argon2id hash plus a 10-character prefix, so a lost key cannot be recovered. Each successful use updates last_used_at and last_used_ip (at most once a minute per key). A key can be bound to networks with allowed_cidrs; used from any other address it answers the same 401 as a wrong key.

Before binding keys: the portal judges the address it sees through its trusted-proxy setting (TRUSTED_PROXIES). If that is wrong, every request looks like one address and a bound key fails for everybody. Check that GET /api/admin/proxy-trust reports suspect: false (no Proxy Trust note in Admin > Overview) first, then bind one key and test it.

Checking a key that has not been used since the server started is rate limited: when too many such checks are pending for one key, the request is answered with 503 and a Retry-After header instead of 401. Retry after the given delay; the key itself is not affected.

POST /api/api-keys Create new API key (a browser session or bearer token; a request authenticated with an API key gets 403)

Request Body

ParameterTypeDescription
name string Descriptive name for the key required
scopes string Comma-separated scopes or a list (default "*" when the field is left out or null; an empty list or empty text is a 400). An unknown scope is a 400; see GET /api/api-keys/scopes. A scope is stored exactly as written, case included. Admin only; non-admin keys always get services:read,access:*
expires_days integer or "never" Days until expiration, 1 to 3650. Omitted: 90 days. "never" (or 0) for no expiry; a "*" key with no expiry gets an expiry_warning in the response. Anything unreadable is a 400.
allowed_cidrs list or string Up to 10 IPv4 or IPv6 addresses or networks the key may be used from. A /0 is refused; "any" (alone) or omitted means anywhere.
Important: The full API key is only shown once upon creation. Store it securely.

Response

{
  "id": 1,
  "name": "My Integration",
  "key": "portal_abc123...",
  "prefix": "portal_abc",
  "scopes": "services:read",
  "expires_at": "2027-02-18T00:00:00+00:00",
  "allowed_cidrs": ["203.0.113.0/24"],
  "created_ip": "198.51.100.7"
}
GET /api/api-keys List your API keys

Returns all API keys for the authenticated user. Keys are shown with prefix only (not full key), with their bound networks, the address each was created from and last used from (created_ip, last_used_ip). For an administrator each key also has stale: not used for 90 days. Since 1.24.2 a member can hold at most 50 live keys: creating another answers 400 You already have 50 active API keys; revoke one before creating another. Revoked and expired keys do not count.

GET /api/api-keys/scopes Scopes a key can carry

The scope registry (every scope the portal checks, with a description), plus the scopes services require (administrators only), can_choose, the limited_scopes a non-admin key always gets, and default_expiry_days. A scope an administrator made up for a service (up to 128 characters, no control characters or commas) is accepted as the service lists it, but only an administrator can name one; for anybody else it is as unknown as a made-up one. An allowed_cidrs entry with an IPv6 zone id (fe80::1%eth0) is a 400. Two live keys can share the 10-character prefix; every live key with the prefix is checked (at most 4). A refusal for the address is the security event api_key_ip_denied, aggregated per source, minute and key.

POST /api/api-keys/{id}/revoke Revoke an API key

Revokes the API key. The key will no longer work for authentication but remains in your key list. WebSockets, voice calls and in-flight proxied downloads opened with the key end at once.

DELETE /api/api-keys/{id} Delete an API key

Permanently delete an API key from your account.

Token Management

GET /api/tokens List active tokens

Returns all active JWT tokens for the authenticated user. Since 1.24.2 every row has a session_id; the older truncated token_id is unchanged, and POST /api/token/revoke accepts the session_id.

POST /api/token/revoke Revoke a token

Users can revoke only their own tokens. Admins can revoke tokens of users they are allowed to manage (the same hierarchy as password resets), and the credential used must carry the admin scope. A token that does not exist or that the caller may not revoke returns 404. Since 1.24.2 token_id may also be the session_id that GET /api/tokens shows, for the caller's own tokens only; the full token id still works. An admin cannot reach another user's token by session_id (that answers 404); the admin's full-id path is unchanged. What was opened with the revoked token (chat sockets, voice call, in-flight proxied downloads) ends with it; the owner's other sessions are not affected.

Request Body

ParameterTypeDescription
token_id string Full token ID to revoke, or (1.24.2) the session_id from GET /api/tokens for your own tokens required

Sessions

GET /api/me/sessions List your signed-in sessions

Browser logins and tokens made through POST /api/token of the current account. API keys are not sessions; they are listed under API Keys. Needs a browser session or an all-scope (*) credential; a stream key or a narrowly scoped key or token gets 403. Each row has an opaque public id (never the token), kind (browser or token), device, browser and os read locally from the User-Agent, created_at, last_used_at, expires_at (ISO-8601 UTC), ip (login), last_ip (last use, written at most once a minute) and current.

DELETE /api/me/sessions/{id} Sign out one session

Signs out the session with that public id. The session making the request cannot be signed out here (400, use logout); an unknown id or another member's session returns 404. Sockets, voice call and in-flight proxied downloads opened with it end at once (close code 4001); other sessions are not affected. Same credential rules as the list. Since 1.24.2 this route, POST /api/me/sessions/revoke-others and POST /api/users/{id}/sessions/revoke share one limit of 30 calls per minute for one signed-in account (the admin route counts against the acting administrator, not the target); beyond it they answer 429 with a ref and Retry-After: 10.

POST /api/me/sessions/revoke-others Sign out other devices

Signs out every session of the account except the one making the request. API keys and stream keys are not revoked. Returns {"status": "ok", "revoked": n, "websockets_closed": n}. Same credential rules as the list.

GET /api/push/config Web push: is it on, and the public VAPID key (1.19.0)

Needs a browser session or a bearer token with the full scope; API keys, stream keys, a token in the URL and narrow tokens get 403. Answers {"enabled": true, "public_key": "...", "max_devices": 10, "worker_url": "/sw.js", "worker_scope": "/push-sw/"}. A push is sent for a direct message, an @mention or @everyone and a followed stream going live, only to a member with a device and no open chat socket, with no message text and no sender name.

GET /api/push/subscriptions List your push devices (POST registers one)

GET returns {"devices": [{"id", "label", "service", "created_at", "last_success_at", "failure_count", "this_session"}]}, never an endpoint or a key. POST takes a PushSubscription as JSON ({"endpoint", "keys": {"p256dh", "auth"}}): 201 created, 200 updated, 400 for an endpoint that is not https on port 443 to an allowed push service (fcm.googleapis.com, updates.push.services.mozilla.com, *.push.apple.com, *.notify.windows.com and hosts a superadmin adds), a name that resolves to a private, loopback, link-local or metadata address, or bad keys; 403 while push is switched off; 409 at 10 devices or when another account holds the endpoint; 429 after 10 lookups a minute. With "rebind": true in the body it only ties a device this member already holds (same endpoint and keys) to the calling session and answers 200, or 404 when the member does not hold it; it never registers or moves a device, needs no name lookup and is not counted against the subscribe limit. When the endpoint and both keys belong to a different member (this browser, signed in as someone else now), that member's device is deleted and the answer is still 404. A device records when a signed-in session last announced it (a subscribe or a rebind); when its registering session has expired, is gone, has no expiry date (a token that never expires; since 1.24.1 it is stale like any other) or was never recorded and nothing announced it for 30 days, nothing is sent to it and the periodic cleanup deletes it. A device whose session is live is not affected.

DELETE /api/push/subscriptions/{id} Remove one of your push devices

404 for a device that is not yours. POST /api/push/unsubscribe with {"endpoint": "..."} removes your device with that endpoint and always answers {"status": "ok"}; DELETE /api/push/subscriptions removes all of your devices. A device is also removed when the session that registered it ends, and when the account is deleted.

GET /api/admin/push Push settings and test push (superadmin)

GET returns {"enabled", "default_hosts", "allowed_hosts", "subject", "effective_subject", "device_count", "key_state", "key_problem"} (key_state: ok, none, unreadable or plain; key_problem says why push stays off when the stored key cannot be decrypted). PUT takes any of enabled, allowed_hosts (host names or *.suffix; no IP addresses, localhost or internal names) and subject (an https address or null). Changing allowed_hosts needs a superadmin's browser login session (a bearer token gets 403) and is audited with the new list. Since 1.24.2 a bearer client may send the list it just read back unchanged (and change only enabled or subject) and gets 200; only a changed list gets the 403, and an invalid host name answers 400 to a bearer client too. POST /api/admin/push/reset-key with {"confirm": true} replaces the VAPID key pair and deletes every device of every member; it needs a superadmin's browser login session (a token or key gets 403) and is audited as push_key_reset. POST /api/admin/push/test sends a test push to your own devices and returns one result per device. The same credential rule as the device routes applies, and the account must be a superadmin.

GET /api/push/prefs Which kinds of push you want (PUT changes them)

GET returns {"prefs": {"dm": true, "mention": true, "golive": true}, "kinds": [...]}, your own switches (all on until switched off). PUT takes one or more of those keys with true or false and returns the full set; an unknown key, a non-boolean value or an empty body is 400. Same credential rule as the device routes.

POST /logout Sign out and remove this browser's push device

Ends the current session (since 1.24.1 only a POST does: GET /logout shows a page with a Sign out button and changes nothing, or redirects to /login when there is no session). Ends the session of the cookie it carries (a call authenticated only by a bearer token or an API key answers 200 and ends nothing). Answers 200 {"success": true} and clears the session cookie; a browser form post is answered with 303 to /login. A cookie-authenticated POST marked cross-site by the browser, or sent from a proxied or sandboxed page, is refused with 403. With {"endpoint": "..."} in the JSON body (never in the URL) it also removes your push device with that endpoint, even one an earlier session registered; another member's endpoint removes nothing. Since 1.24.2, when a session cookie is sent together with a bearer token, an API key or ?token=, it is the session of the cookie that ends, not the other credential's.

GET /sw.js Push service worker (and /manifest.webmanifest)

No session needed; identical for everyone. push and notificationclick handlers only, no fetch handler, Cache-Control: no-cache, Service-Worker-Allowed: /push-sw/. /manifest.webmanifest is the web app manifest with generated icons.

POST /api/users/{id}/sessions/revoke Admin: sign a user out everywhere

Revokes every browser session and token of the user and closes what was opened with them. Needs the admin role (read from the database, so someone just promoted can use the session they already hold) and a full-scope credential (a browser session, or a token or key made with *; a stream key or scoped key gets 403), and follows the same role hierarchy as password resets (403 otherwise). API keys and stream keys are not revoked. On your own account the session you are using is kept. Written to the audit log as sessions_revoke.

Registration

POST /api/register Register a new account

Register a new account using an invite code. Rate limited to 1 account per IP per 24 hours.

Request Body

ParameterTypeDescription
username string Desired username required
password string Password (min 8 chars) required
invite_code string Daily invite code required

Response

{
  "id": 5,
  "username": "newuser",
  "message": "Registration successful"
}

Public Stats

Public statistics available to all authenticated users.

GET /api/stats/public Get public statistics

Returns public metrics visible to all authenticated users, including live stream counts and online user counts.

Response

{
  "live_streams": 3,
  "online_users": 12
}

Fields

  • live_streams - Number of currently live public streams
  • online_users - Number of unique users currently in chat

Services

Services are shared infrastructure endpoints configured by administrators. Users can list and connect to services they have access to.

GET /api/services List available services

Returns all services the authenticated user has access to based on their scopes.

Response

{
  "services": [
    {
      "id": 1,
      "name": "Home Server",
      "plugin": "ssh",
      "path": "/homeserver",
      "icon": "terminal",
      "category": "Servers",
      "enabled": true
    }
  ]
}

Try It

GET /api/services/{id} Get service details

Returns detailed information about a specific service.

GET /api/services/{id}/health Check service health

Checks if the backend service is reachable and responding.

Response

{
  "healthy": true,
  "latency_ms": 45
}

User Connections

User Connections are personal remote access points that you configure for your own use. Unlike Services (admin-configured), connections are private to each user.

Credentials (1.24.1): every write, connect and share route (create, update, delete, pin, prefs, /connect, share and unshare), every /api/sftp/{conn_id}/... route, the /ws/user-connection/{uuid} socket (also reached as /ws/terminal/{uuid} and the like; closed with 4003) and the reverse proxy /proxy/{conn_id} and /proxy/{conn_id}/... (403, also for a WebSocket upgrade; it sends an HTTP connection's stored auth_header and extra_headers upstream) need a credential that carries its user's whole authority: a browser session, an all-scope (*) token or key, or a member's default key (services:read and access:*, equal to that member's session). A key limited to one service, to read access or to admin alone gets 403 there, because a connection can hold stored credentials. The read routes are unchanged.
Connection IDs: Connection IDs are opaque URL-safe tokens (e.g., aB3x_kLm9pQ2rStU), not sequential integers. Use the id field returned by the API for all operations.
Security: User connections cannot target localhost or local network addresses (127.x.x.x, ::1, etc.) for security reasons.
GET /api/connections/types List connection types

Returns available connection types with their plugin schemas for form generation.

Response

{
  "types": {
    "ssh": {
      "name": "SSH Terminal",
      "icon": "terminal",
      "default_port": 22,
      "plugin": "ssh",
      "config_schema": {...}
    },
    "vnc": {...},
    "rdp": {...}
  }
}
GET /api/connections List your connections

Returns all connections for the authenticated user.

A connection shared with you carries no target (1.22.0, breaking). For a connection you do not own, unless your role is admin or superadmin, host and port are null and config is {} (the keys stay; the two values that are kept are has_stored_password: true and credential_mode on an SSH or SFTP connection with a stored password), in this list (with or without ?type=), in GET /api/connections/{id} and in the connection object of GET /api/connections/{id}/connect. The server connects by id, so using the connection does not need them. The owner and every administrator get the full answer.

Try It

POST /api/connections Create connection

config.recording (SSH connections) is an administrator's setting: only a user with the role admin or superadmin can set or clear it. From anyone else the key is ignored, not refused: a create stores no flag and an update keeps the stored value, so existing clients that send it keep working and get no error. A session records only when the connection's owner is an administrator when it opens: a flag a member's connection already holds is ignored. The stored flag counts as on for exactly true, 1, "1" and "true" (any case). Output is recorded, keystrokes are not, and only administrators can play recordings back.

Request Body

ParameterTypeDescription
name string Display name required
type string Connection type (ssh, vnc, rdp, etc.) required
host string Remote host address required
port integer Port number (uses default if omitted)
config object Type-specific configuration (username, auth_method, etc.)

Example

curl -X POST https://portal.example.com/api/connections \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Home Server",
    "type": "ssh",
    "host": "192.168.1.100",
    "port": 22,
    "config": {
      "username": "admin",
      "auth_method": "password"
    }
  }'
GET /api/connections/{id} Get connection details

Returns details for a specific connection. Sensitive config fields (passwords, private keys and, since 1.24.1, every other stored secret: api_token, extra_headers, personal_token, client_secret, webhook_secret, pre_shared_key, auth_header, psk) are redacted for every credential, whatever its scope, and replaced with has_<field> boolean flags. For a connection shared with you, and you are not an administrator, host and port are null and config holds no value but has_stored_password and credential_mode (see the list above).

PUT /api/connections/{id} Update connection

config.recording (SSH connections) is an administrator's setting: only a user with the role admin or superadmin can set or clear it. From anyone else the key is ignored, not refused: a create stores no flag and an update keeps the stored value, so existing clients that send it keep working and get no error. A session records only when the connection's owner is an administrator when it opens: a flag a member's connection already holds is ignored. The stored flag counts as on for exactly true, 1, "1" and "true" (any case). Output is recorded, keystrokes are not, and only administrators can play recordings back.

Update a connection. Config fields are merged server-side with the existing config — sensitive fields not included in the request are preserved from the encrypted database record.

Stored SSH password

For ssh and sftp connections, config.credential_mode is "prompt" (default: the terminal asks every time) or "stored" (the terminal opens without asking and the SFTP browser uses the same password, also for users the connection is shared with). config.password is write-only: responses carry only has_stored_password, never the value, for the owner and for a user the connection is shared with. Only the owner's POST and PUT can set it. An absent password keeps the stored one, a new one replaces it, an empty one or credential_mode: "prompt" clears it. A password without credential_mode never switches a connection to "stored": on a row whose mode is "prompt" it is a 400; on create, or on a row that has no mode, it is kept and the row stays without a mode (the terminal still asks, the file browser uses the password); on a "stored" row it replaces the password. Changing host, port, config.username or type clears it (a row moved to a type other than ssh or sftp keeps no stored password and no mode) unless the same request carries a new one; the response then has "stored_password_cleared": true. 400 for an unknown mode, a password that is not a string (at most 1024 characters), "stored" without a password, "stored" together with host_key_ignore: true, or a password with key authentication. The password is only sent to a host whose key is pinned and verified. Revoking or expiring a share closes the grantee's open terminal and SFTP connections (close code 4010). Every stored secret of every connection type (auth_header, extra_headers, api_token, personal_token, client_secret, webhook_secret, pre_shared_key, private_key, psk) follows the same rule since 1.24.1: it is removed when the host, port, the scheme, host or port of target_url, api_url, webrtc_url or hls_url, tls_port, tls or the plugin of the type changes and the request carries no new one, and the response lists the removed keys as stored_secrets_cleared. Since 1.24.1 the password of a spice or proxmox connection is removed in the same way when the host, port or type changes and the request carries no new one (the answer then also says stored_password_cleared); a proxmox connection's api_token is removed in the same cases unless the request carries a new one. Since 1.24.2 a change of the connection's type to any other type (also one of the same plugin, such as http to grafana) removes the stored secrets the request does not send again, and so does a change of config.verify_ssl from on to off (or its removal; a missing value counts as off). PUT /api/connections/{id} ignores body keys that are not connection fields (user_id, conn_id, ...) and saves the real ones with 200; it answered 500.

Request Body

ParameterTypeDescription
name string Updated display name
host string Updated host address
port integer Updated port number
config object Updated type-specific configuration
DELETE /api/connections/{id} Delete connection

Permanently delete a connection.

GET /api/connections/status Health of your connections

Health of the connections you can reach (1.22.0), one entry for each connection you own or hold a live share of, keyed by connection id; {} while the feature is off (the default; a superadmin switches it on with PUT /api/admin/connection-health). The same shape for the owner and for a member the connection is shared with, and never an error text, a host, an address or a port. Registered before /api/connections/{id}; the answer is no-store. Since 1.24.2, while the global maintenance flag is on, the status of an HTTP-proxy connection (the types /proxy and /browser serve) reads maintenance and its down and up transitions send no alert; an alert owed then is sent after maintenance ends if the state still holds.

Response

{
  "<connection id>": {"status": "up", "latency_ms": 12, "since": "2030-01-01T10:00:00Z"}
}

status is up, down, maintenance (the connection is in maintenance; nothing else is in the entry) or unknown. latency_ms is the last answer time while up. since is when the current up or down began (UTC). An entry that is not checked (not pinned and not opened in the last 7 days, a type with no check, a name the host policy refuses) or not checked lately is unknown with both fields null.

One background task makes a round every 60 to 900 seconds and checks only connections that are pinned or were opened in the last 7 days by somebody who still has access: a TCP connect (closed again at once, nothing written) for SSH, desktop and tunnel types, a HEAD of / (GET after 405 or 501) for HTTP types, never following a redirect and sending no cookie or credential, through the same host policy as a real connection (a name that resolves to a loopback, private, link-local or shared address is never contacted and is unknown). A status below 500 counts as up. At most 100 checks per round and at most 10 targets per connection owner, filled in turn across owners (a member's excess is checked less often and reads unknown once stale), 5 at once, 6 seconds each. A check sends a HEAD request or a TCP connect and nothing else: no credentials, no cookies. Down after 3 failed checks in a row, up after 2 good ones. service.health_changed fires on a change between up and down, at most once per connection every 10 minutes and not while the connection is in maintenance; third-party formats get no name and no host.

PUT /api/connections/{id}/prefs File a connection in your own folders and tags

Your own filing of a connection you can reach, one you own or one shared with you: folder, tags, open_mode, pinned. Fields you leave out keep their value. The filing is private: nobody else sees it, neither the owner of a shared connection nor an administrator, and GET /api/connections returns only yours, as prefs on each item. It ends with your access (revoked or left share, expired share, deleted connection or user). Managed services have no filing.

Request

{
  "folder": "Games",
  "tags": ["survival", "co-op"],
  "open_mode": "new",
  "pinned": true
}

folder: at most 40 characters (letters and digits of any language, space and _ - . & ( ) + '), "" clears it. tags: at most 10 tags of at most 24 characters (letters, digits and . + # - _, no spaces), stored lower-case without duplicates. open_mode: default, same, new or embedded. pinned: true or false.

Response

{
  "prefs": {"folder": "Games", "tags": ["survival", "co-op"], "open_mode": "new", "pinned": true, "last_opened_at": null}
}

400 for an unknown field, an empty body or a value outside the limits (nothing is stored). 413 for a body over 8 KB (8192 bytes), by its Content-Length or, when it has none, counted while it is read. A caller with no access gets the 404 of a connection that does not exist, whatever the body. last_opened_at is set when the connection is opened through /connect, the terminal socket or the proxy, at most once a minute per member and connection.

POST /api/connections/{id}/pin Toggle connection pinned status

Toggle whether a connection is pinned. Pinned connections sort to the top of the connections list for quick access.

Response

{
  "is_pinned": true
}
GET /api/connections/{id}/connect Get connection info for launching

Returns connection details and WebSocket URL needed to establish a connection. The dashboard uses this to open the appropriate viewer window. For a connection shared with you, and you are not an administrator, host and port are null and config holds no value but has_stored_password and credential_mode.

Response

{
  "connection": {
    "id": 1,
    "type": "ssh",
    "name": "My Server",
    "host": "10.0.0.5",
    "port": 22,
    "config": {}
  },
  "ssh_public_key": "ssh-ed25519 AAAA... (if SSH key is set)",
  "websocket_url": "/ws/user-connection/1"
}

Connection Type Routing

TypeViewerURL Pattern
ssh, terminalTerminal (xterm.js)/terminal/connect?connection={id}
vnc, rdpVNC (noVNC)/vnc/connect?connection={id}
spiceSPICE Console/spice/connect?connection={id}
proxmoxProxmox VE/proxmox/connect?connection={id}
http, https, http_proxyEmbedded Browser/browser?connection={id}
mediamtx, streamMedia Player/media/connect?connection={id}
database, redis, tcp_tunnel, etc.Info ToastShows host:port (no web viewer)

All viewer pages connect via wss://portal/ws/user-connection/{id} which routes through the appropriate plugin based on the connection type.

POST /api/connections/{id}/host-key/accept Trust an SSH host key

Pin the SSH host key of an ssh or sftp connection. Owner only. The credential must carry its user's full scope: a browser session or an all-scope (*) token or API key. Stream keys, scoped API keys and scoped tokens get 403, and the prompt they receive has can_accept: false and no accept_url or accept_token. Changing the connection's host or port clears the pin. The pin cannot be set through PUT /api/connections/{id}.

Request Body

FieldTypeDescription
fingerprintstringThe fingerprint from the prompt (SHA256: and 43 base64 characters) required
hoststringThe host from the prompt required
portintegerThe port from the prompt required
tokenstringThe accept_token from the prompt required

Response

{"status": "accepted", "fingerprint": "SHA256:..."}

Errors

StatusMeaning
400Missing or malformed fingerprint, host or port
404Connection not found (only the owner can accept; a user the connection is shared with gets 404)
409The prompt is stale: {"error": "...", "type": "host_key_stale"}. The host or port no longer matches the stored target, the token is missing or forged, the fingerprint is not the one the portal presented (or the token expired after 30 minutes), or the target was edited while the prompt was open. Connect again to get a fresh prompt.
WS host_key refusal Host key not trusted or changed

When the server's SSH host key is not pinned yet (unpinned) or differs from the pinned one (changed), the connection is refused during the key exchange, before any password or key is sent. The WebSocket /ws/user-connection/{id} (and the service relay) sends this text message and closes normally; the SFTP routes /api/sftp/{conn_id}/... answer HTTP 409 with the same body plus an error field. can_accept, accept_url, host, port and accept_token are present only for someone who may accept with a full-scope credential (the owner of a connection, an admin for a service); stream keys and scoped keys never get them.

{
  "type": "host_key",
  "state": "unpinned",
  "fingerprint": "SHA256:Xo0bW0n0m9t5mJ0b7G0m3sPjv0o8m5k1u8x4Zr2Qy1A",
  "expected": null,
  "algorithm": "ssh-ed25519",
  "can_accept": true,
  "accept_url": "/api/connections/{id}/host-key/accept",
  "host": "192.168.1.100",
  "port": 22,
  "accept_token": "1767225600.3f9c...",
  "message": "This host's key has not been trusted yet. ..."
}

The connection can be set to skip the check with config.host_key_ignore: true (not recommended).

GET /api/connections/{id}/shares Who a connection is shared with

Owner only. Lists the live shares of the connection; an expired share is not listed.

{"shares": [{"user_id": 7, "username": "alice", "created_at": "2030-01-01 12:00:00",
             "granted_by_username": "owner", "expires_at": "2030-01-01T13:00:00Z", "expires_in": 3600}]}

expires_at and expires_in (seconds left) are null for a share that never expires.

POST /api/connections/{id}/shares Share a connection

Owner only. Body {"usernames": ["alice", "bob"], "expires_in": "7d"}; unknown names and yourself are skipped. Audited as connection.share. When the time passes the grantee no longer sees the connection and cannot open it, whether or not the sweeper has run; the sweeper (every 60 seconds) deletes the row, audits connection.share_expired and closes the grantee's open sockets and SFTP and proxy calls on it (WebSocket close code 4010, "access ended").

Request Body

FieldTypeDescription
expires_instringHow long the access lasts: 1h, 8h, 1d, 7d, 30d, 90d or never. Omitted or null means never (the API default, kept for compatibility; the dialogs preselect 30d). The server computes the end time. Any other value, and a body that carries expires_at, gets 400 and nothing is written. Doing it again for the same person replaces the end time.
{"added": ["alice"], "skipped": [], "shares": [...]}

Errors: 400 unknown duration or a timestamp in the body; 404 not your connection.

DELETE /api/connections/{id}/shares/{grantee_id} Revoke a share

Owner only; {grantee_id} may be me for a grantee leaving. Closes what the grantee holds open through the share (code 4010). Audited as connection.unshare.

POST /api/connections/{id}/notice Continue on a shared web connection's first-open notice

The recipient's Continue (1.24.1): {"accepted": true}. Only for a connection shared with the caller (404 otherwise); needs a full-scope credential. Kept per person and connection and bound to the connection's target: a changed target asks again. Until it is recorded a page request for the connection (/proxy/{id}/... or /browser?connection={id}) is answered with a 302 to /shared-app?connection={id}&next=... and any other request with 403. A bearer token or API key is not asked.

GET /api/me/shares Everything I have shared

Every live share of every connection the caller owns, with grantor, creation time and expiry.

{"shares": [{"connection_id": "k3F...", "connection_name": "box", "connection_type": "ssh",
             "user_id": 7, "username": "alice", "created_at": "2030-01-01 12:00:00",
             "granted_by_username": "owner", "expires_at": null, "expires_in": null}]}

A connection shared with the caller carries share_expires_at and share_expires_in on its entry in GET /api/connections.

Portal can run SearXNG (AGPL-3.0), a privacy-respecting metasearch engine, as an optional managed service reverse-proxied under /search/ behind Portal authentication.

Availability: These endpoints work only while an admin has added and enabled a managed service of type searxng (Services panel). Otherwise they return 503, and the portal is unaffected.
GET /api/search/status Whether SearXNG search is available

Returns { "available": true|false } — whether the searxng service is enabled and running. The dashboard uses this to show or hide the "Search" nav link. Requires authentication.

ALL /search/{path} Auth-gated reverse proxy to SearXNG

Any authenticated user may use it: session cookie, JWT or API key (a stream key signs in nowhere). No scope is checked, so every valid API key can search. Unauthenticated browser requests redirect to /login; unauthenticated API requests (Accept: application/json or ?format=json) get 401.

Requests are forwarded verbatim — SearXNG mounts its whole app under /search/ via its base_url. The Portal session cookie and Authorization header are stripped from the upstream request. Responses get Cache-Control: private, no-store.

Prefer Authorization: Api-Key over X-API-Key here: the Authorization header is stripped before the request reaches SearXNG, while X-API-Key is currently forwarded. 401 means missing or invalid credentials (including a key sent as Bearer); 503 means credentials were accepted but the service is off.

Example — JSON results for automation

curl -H "Authorization: Api-Key $PORTAL_KEY" \
  "https://your-domain/search/search?q=debian&format=json"

Web Browser on the server

An optional Chromium that runs in a locked-down systemd unit on the portal's server and reaches the member as a picture (the README section "Web Browser (server-side)" describes the feature, its privacy statement and its limits). It is off by default. The member routes and the WebSocket accept the browser sign-in only (the session cookie of a password sign-in, full user scope): an API key, a bearer token, a ?token= or a stream key gets 403; GET /api/rbrowser/status is the one exception. Every answer carries Cache-Control: no-store. Nothing in any answer, log or event holds a web address, a page title, a key, a pointer position or clipboard text of a session.

Availability: while the feature is off, or the host cannot run it, /api/rbrowser/status says so and the other member routes answer 403. No session starts before the sandbox check has passed.
GET /api/rbrowser/status Whether the Web Browser can be used

{ "available", "enabled", "allowed", "busy", "checking", "clipboard", "boot_id" }, plus "reason" (text) for an administrator. allowed is true only when the feature is on, the caller used the browser sign-in and the role is at least rbrowser_min_role. busy: every seat is taken. checking: the sandbox check is running. clipboard: both, in or off. boot_id changes when the portal restarts. Any signed-in credential.

GET /api/rbrowser/session The caller's running session

{ "sid", "ws", "width", "height", "idle_deadline", "max_deadline", "clipboard", "net_warning" }; ws is the socket path /ws/rbrowser/{sid}. 404 when there is none, 409 {"elsewhere": true} when another sign-in of the same member made it, 403 when not allowed.

POST /api/rbrowser/session Start the member's session

Body { "width", "height", "takeover"? } (whole numbers 1 to 20000, CSS pixels; takeover boolean). Starts the session (201) or returns it (200) when the same sign-in already has one. One session per member. The window is snapped to a multiple of 16, at least 560 wide and 480 high, at most 1920 by 1200. takeover: true ends a session that another sign-in of the member made and starts a new one.

Answers: 400 bad numbers; 403 (off, role too low, or the sign-in was revoked during the start); 409 {"elsewhere": true} (a session of another sign-in, no takeover); 409 {"busy": true, "free_in_minutes"} (no free seat); 429 (6 starts per 10 minutes per member, Retry-After); 503 with {"retry_after": 10} while the sandbox check runs, {"error": "unavailable"} before a check has passed, or {"error": "start_failed"}. Global maintenance mode refuses the start with the maintenance answer.

DELETE /api/rbrowser/session End the caller's own session

204; any browser sign-in of the member may end it. 404 when there is none.

POST /api/rbrowser/session/resize Resize the window

Body { "width", "height" }. Answers { "ok": true|false }; one call per second per member (429); 404, 409 {"elsewhere"} and 403 as above. Only the sign-in that made the session may resize it.

POST /api/rbrowser/session/clipboard Read the remote browser's clipboard

{ "text", "truncated" }: plain text, at most 262144 bytes (longer text is cut and truncated is true). Only when rbrowser_clipboard is both (403 otherwise), only for the sign-in that made the session, 12 calls a minute (429); 502 {"error"} when the text could not be read. The text is never logged.

GET /rbrowser The page

HTML. A request without a sign-in is redirected to /login. The page has its own content security policy (no inline script) and is refused during global maintenance mode.

WS /ws/rbrowser/{sid} The picture and the member's input

An RFB stream over binary frames; text frames are small control frames. Only the browser sign-in that made the session may attach, and one window at a time: a second window of the same sign-in closes the first. The member's bytes pass a filter (six RFB message types, whole and bounded); anything else closes the socket with 4013 and writes a rbrowser_protocol_violation event.

Close codes

CodeMeaning
4003Not allowed: wrong credential, feature off or role too low
4004No such session (also a session of another member or sign-in)
4012Opened in another window of the same sign-in
4013The session ended; the close text is the reason (idle, detached, max_lifetime, traffic_limit, closed, closed_in_browser, replaced, signed_out, admin_end, crash, portal_stop, start_failed, settings_changed), or slow (too slow to keep up; the session stays) or protocol (broke the byte rules)
4503Maintenance mode
1001The stream ended; reconnect
GET /api/admin/rbrowser Settings, host state, last check and running sessions (administrator)

{ "settings", "defaults", "availability", "preflight", "seats", "sessions", "units_not_confirmed_stopped" }. availability: available, missing (names), reasons, chromium_version, chromium_age_days, kernel_upload_limit, checking, and upload_reason when there is one. preflight: { "ok", "checks": [{ "name", "ok", "detail" }] } of the last sandbox check. seats: { "max", "cpu_percent" }, what the host really allows. Each entry of sessions has only sid_prefix (the first 6 characters), user_id, username, started, state (active or idle), attached, memory_mb, cpu_seconds, net_in_mb and net_out_mb. There is no field for a page and no route that shows one.

PUT /api/admin/rbrowser Change the settings (superadmin, browser sign-in only)

A flat object of the keys to change: rbrowser_enabled (boolean, default false), rbrowser_min_role (admin, moderator, user; default admin), rbrowser_max_sessions (1 to 8; 2), rbrowser_idle_minutes (5 to 120; 15), rbrowser_memory_mb (1024 to 4096; 2048), rbrowser_cpu_percent (50 to 400; 150), rbrowser_clipboard (both, in, off; to_browser is read as in), rbrowser_home_url (an https address, at most 300 characters; https://duckduckgo.com/), rbrowser_upload_kbps (0 or 500 to 50000; 4000) and rbrowser_extra_deny (at most 32 networks in CIDR form).

Returns the body of the GET plus "saved": true. 400 for an unknown key or a bad value (the message names the key, never the value). Switching off, or raising the role, ends the sessions affected (settings_changed); switching on prepares the host and starts the sandbox check; no other change alters a running unit. Audited (rbrowser_settings_update) and a rbrowser_settings_changed security event, both naming the keys.

POST /api/admin/rbrowser/preflight Run the sandbox check now (superadmin)

Answers { "ok", "checks": [{ "name", "ok", "detail" }] }; it can take about 40 seconds. 409 while the feature is off or unavailable; 500 when the check could not run.

POST /api/admin/rbrowser/sessions/{sid_prefix}/end End a member's session (administrator)

Body { "confirm": true } (400 without it). Ends the session whose id starts with the 6 characters from the list (404 when none), writes the audit entry rbrowser_admin_end first, and sends the member a notification. Answers { "ended": true }.

Events. Security events (superadmin list): rbrowser_settings_changed, rbrowser_preflight_failed, rbrowser_listener_found, rbrowser_socket_mismatch, rbrowser_display_mismatch, rbrowser_protocol_violation, rbrowser_traffic_limit; their details are fixed words. Audit log actions: rbrowser_start, rbrowser_end (reason and minutes), rbrowser_admin_end, rbrowser_settings_update.

User Streams

Stream live video using RTMPS, RTSPS, or WebRTC. Streams can be public (visible to all users) or private. Each stream gets an integrated chat channel for viewer interaction.

Architecture: Publishing uses a dedicated subdomain (stream.example.com) for direct RTMPS access with Let's Encrypt TLS. Playback is proxied through Portal on port 443 via Cloudflare.

Streaming Configuration

PurposeHostURL Format
RTMPS Publishing stream.example.com:1936 rtmps://stream.example.com:1936/live
HLS Playback portal.example.com:443 https://portal.example.com/api/stream/{stream_key}/hls/index.m3u8
WebRTC Playback (same network only) portal.example.com:443 (signaling only) https://portal.example.com/api/stream/{stream_key}/webrtc/whep
WebRTC Publishing (same network only) portal.example.com:443 (signaling only) https://portal.example.com/api/stream/{stream_key}/webrtc/whip
RTMP Publishing stream.example.com:1935 rtmp://stream.example.com:1935/live

Who May Watch

The HLS, WebRTC playback (WHEP) and info addresses above, and the thumbnail, follow one rule since 1.16.0. The stream's owner and administrators always may watch; any other signed-in member only a public stream; somebody not signed in only a stream that is public and has the open share link on (allow_unauthenticated), using its current pub_ key. The credential is the session cookie, or a token or API key with the all-scope *; a stream key (live_) and scoped API keys never authorise watching. Everything else answers 404 with {"error": "Stream not found"}, never 401 or 403, so a private stream's existence is not revealed. Access-Control-Allow-Origin: * is sent only for a public stream with the open link on. A change of visibility, open link or key reaches viewers within 5 seconds (normally at once). Relays, the recorder and the thumbnail capture read MediaMTX directly on loopback and are not affected.

Custom thumbnails (1.24.1). A thumbnail uploaded with POST /api/streams/{id}/thumbnail is read from /static/uploads/thumbnails/<file> and follows the same rule: a signed-in member who may watch the stream gets it (a member banned from a public stream still does, as before); for a stream that is not public the owner and administrators get it with Cache-Control: private, no-store and everybody else 404; a file no stream names is 404; a public stream's thumbnail is served as before with Cache-Control: private, and every other file answer of the signed-in route for /static/uploads/... (chat files too) carries Cache-Control: private so a shared cache does not store it (the error answers do not); custom emotes under /static/uploads/emotes/ are the exception, public by design and served to anyone without a sign-in with Cache-Control: public. A request that is not signed in is 401 as before.

Privacy changes (1.24.1). Moderation by message id (delete, timeout_user, ban over the chat socket) and lifting a ban made from an anonymous post (unban over the socket, DELETE /api/streams/{id}/bans/id/{ban_id}) answer the same for a stream owner or stream mod whoever wrote the anonymous post ("Not allowed" only for one's own post); global moderators and administrators keep the rank rules. The anonymous handle anon_ref is stable while one anonymous period lasts and changes when PUT /api/me/anonymous switches anonymous mode on again. A connection the caller owns reports status unknown unless the owner's own pin or an open of their own in the last 7 days qualifies. GET /browser?connection= for a member the connection was shared with (not an administrator) shows the connection's name in the address bar and holds no host or port.

Viewer heartbeat (1.17.0). POST /api/stream/{key}/viewer is what the watch page sends every 10 seconds while the video plays, so viewer_count is right. It follows the same access rule and credentials as playback: a request that may not watch, an unknown key and a stream key all answer the same 404 and count nobody. A signed-in viewer counts once per account; a viewer who is not signed in is identified by the optional X-Viewer-Id header (16 to 64 characters of A-Z a-z 0-9 - _) or by a salted hash of address and browser string (the portal's watch page sends the header but requires a sign-in, so a logged-out viewer is normally a player that sends none), with at most 5 anonymous viewers per address and 5000 per stream. HLS playlist fetches, WHEP offers and the PATCH of a WHEP session count the same way (an external WHEP player must call this route about every 10 seconds to stay counted); segments and thumbnails do not. Answers: 200 {"ok": true}, or 429 with Retry-After above 300 per minute per address (about 40 viewers beating every 10 seconds behind one address), or after 60 refused heartbeats (404) from one address in a minute; a refused heartbeat is charged only to the 60 refused allowance. A viewer leaves the count 15 seconds after the last heartbeat (20 after the last playlist). No address or list of viewers is stored or returned. The owner's stream detail carries last_peak_viewers and last_unique_viewers for the last finished live session (null until one is recorded); other members do not get them.

OBS Studio Setup (Recommended)

To broadcast with OBS Studio using RTMPS (encrypted, recommended):

  1. Go to Settings → Stream
  2. Set Service to Custom
  3. Server: rtmps://stream.example.com:1936/live
  4. Stream Key: Your stream key (e.g., live_abc123...)
  5. Click OK and Start Streaming

Plain RTMP (Alternative)

If your encoder does not support RTMPS, you can use standard RTMP with a temporary token. This requires enabling RTMP on your stream first.

  1. Enable RTMP on your stream (My Streams tab or PUT /api/streams/{id} with rtmp_enabled: true)
  2. Generate a temporary RTMP token via the My Streams tab or POST /api/streams/{id}/rtmp-token
  3. In OBS, go to Settings → Stream
  4. Set Service to Custom
  5. Server: rtmp://stream.example.com:1935/live
  6. Stream Key: Your temporary token (e.g., rtmp_abc123...)
  7. Click OK and Start Streaming
Note: RTMP tokens are single-use, expire in 15 minutes, and have a 30-second grace period for reconnects. The global RTMP_PLAIN_ENABLED setting must also be enabled by the server administrator.

Encoder Settings

Configure your encoder in Settings → Output → Streaming (Output Mode: Advanced).

NVIDIA NVENC (Recommended for NVIDIA GPUs)

Hardware encoding with NVENC provides excellent quality at low CPU usage.

SettingRecommended ValueNotes
Encoder NVIDIA NVENC H.264 Or NVENC HEVC for better compression (requires viewer support)
Rate Control CBR Constant bitrate for stable streaming
Bitrate 4500-6000 kbps Adjust based on your upload speed
Keyframe Interval 2 Required for HLS segmentation
Preset Quality or Max Quality P5-P7 on newer drivers
Profile high Best compatibility
Look-ahead Enabled Improves quality at cost of slight latency
Psycho Visual Tuning Enabled Better perceived quality
B-frames 2 Good balance of quality and latency

AMD AMF (AMD GPUs)

SettingRecommended Value
Encoder AMD HW H.264 (AVC)
Rate Control CBR
Bitrate 4500-6000 kbps
Keyframe Interval 2
Quality Preset Quality

x264 (CPU Encoding)

SettingRecommended Value
Encoder x264
Rate Control CBR
Bitrate 4500-6000 kbps
Keyframe Interval 2
CPU Usage Preset veryfast to medium
Profile high
Tune zerolatency (optional)

Video Settings (Settings → Video)

SettingRecommended Value
Output Resolution 1920x1080 or 1280x720
FPS 30 or 60
Tip: NVENC and AMF hardware encoders allow streaming at high quality while using minimal CPU. Use x264 only if you don't have a dedicated GPU or need maximum quality at the cost of CPU usage.

REST API

Credentials (1.16.0): a stream key (live_, also sent as Authorization: Stream-Key or X-Stream-Key) authorises publishing only; it signs in on no route at all, and a request that offers one as its credential is refused (403 where the route reports why, otherwise 401). It covers the encoder's connection to MediaMTX, WHIP publishing and the stream event call MediaMTX makes. Every route below under /api/streams, and /api/me/follows, answers a stream key with 403; listing, reading, changing, deleting, rotating keys, relays, bans, thumbnails and follows need a browser session or a token or API key with the all-scope * (a narrowly scoped API key gets 403 too; there is no streams-specific scope). Before 1.16.0 a stream key worked on these routes as its owner.
GET /api/streams List your streams

Returns all streams owned by the authenticated user.

Response

{
  "streams": [
    {
      "id": 1,
      "title": "My Live Stream",
      "stream_key": "sk_abc123...",
      "is_live": 0,  // 0=offline, 1=live, 2=encoding
      "is_public": true,
      "rtmp_enabled": false,
      "viewer_count": 0,
      "chat_channel_id": 5,
      "created_at": "2024-01-15T10:00:00Z"
    }
  ]
}

Try It

POST /api/streams Create a new stream

Creates a new stream with a unique stream key. An associated chat channel is automatically created.

Request Body

ParameterTypeDescription
title string Stream title required
description string Stream description
is_public boolean Whether stream is publicly visible (default: true)
rtmp_enabled boolean Enable plain RTMP publishing with temporary tokens (default: false)

Response

{
  "id": 1,
  "title": "My Stream",
  "stream_key": "sk_abc123def456...",
  "rtmp_enabled": false,
  "chat_channel_id": 5,
  "playback_urls": {
    "hls": "https://portal.example.com/api/stream/sk_abc123/hls/index.m3u8",
    "webrtc": "https://portal.example.com/api/stream/sk_abc123/webrtc/whep"  // same-network only
  }
}
Important: The stream key is only shown once. Store it securely for use with OBS or other broadcast software.
PUT /api/streams/{id}/follow Follow a stream (DELETE stops following)

Follow a stream to be told when it goes live (1.16.0). Needs a signed-in member with a full credential; a stream key or a scoped key is refused (403). Answers {"following": true, "stream_id": 5}. A member may follow only a stream they may watch; an unknown stream, a non-numeric id and a stream they may not watch all answer the same 404 {"error": "Stream not found"}. At most 200 follows per member (400). DELETE removes the member's own follow and answers {"following": false, ...} whatever the stream is. Who follows whom is private: GET /api/me/follows returns only the caller's own {"stream_ids": [...]}, the owner of a stream sees a follower_count number only, and no route lists followers. following in GET /api/streams/public and GET /api/streams/{id} is the viewer's own state. Making a stream private removes all its follows.

GET /api/streams/games Game suggestions for the settings form

1.17.0. {"games": ["Chess", "Doom"]}: at most 50 distinct values, first the games you used before (newest first), then the current game of streams that are public now. The game of a stream that is not public is never listed, whoever owns it, and nobody sees another member's history. Needs a full credential (403 for a stream key or scoped key).

GET /api/streams/schedule/upcoming Next scheduled occurrences the member may watch

(1.23.0) {"now", "occurrences": [{"entry_id", "stream_id", "stream_name", "streamer", "title", "start" (UTC epoch seconds), "duration_min", "recurring", "interested" (the caller's own mark), "live"}]}, soonest first, within 14 days, ?limit= clamped to 1 to 50 (not a whole number: 400). At most 30 requests a minute per member: 429 with Retry-After and a reference ID. Only streams the caller may watch (the watch rule, asked again on every read); the owner of a stream gets interested_count, a number and never names. Registered before /api/streams/{id}.

GET /api/streams/{id}/schedule A stream's schedule

(1.23.0) Next occurrences for anyone who may watch the stream (a stream they may not watch answers the same 404 as an unknown one); for the owner also the entries in full, counts of interested members and the title offered at the last go-live (suggestion, never applied by the server). An entry whose time zone the host can no longer load has problem: "time zone no longer available" and no next; it is left out of every other list, of the feed and of the reminders until its owner sends a new tz (a PUT of the start alone is 400).

POST /api/streams/{id}/schedule Add a schedule entry (owner only)

(1.23.0) {"title" (max 100), "start": "2026-12-04T21:00", "tz": "Europe/Berlin", "duration_min": 90, "recurrence": "weekly"}. A weekly entry keeps its local time across daylight saving changes. 400 for a bad field, 409 at 20 entries per stream or 60 per member. Only the stream's owner: an administrator and a chat moderator get 404. PUT and DELETE /api/streams/{id}/schedule/{entry_id} change or cancel the whole entry; POST and DELETE /api/streams/{id}/schedule/{entry_id}/cancel/{start} cancel and restore one occurrence; DELETE /api/streams/{id}/schedule/suggestion dismisses the offered title.

POST /api/streams/{id}/schedule/{entry_id}/rsvp/{start} Mark Interested in one occurrence

(1.23.0) One reminder follows 10 minutes before the start (an in-app notification and, for members with a device who want golive pushes, a Web Push: " starts in 10 minutes" and nothing more; "A stream you are interested in starts in 10 minutes" for a stream that is not public, in both). DELETE on the same path takes the mark back. A member who loses access before the start gets nothing. 409 at 200 marks. A start that is not a whole number from 1 to 4102444800 (1 January 2100) is 404 here and 400 on cancel and restore.

GET /api/streams/schedule/feed/{token}.ics Calendar feed (token in the path, no login)

(1.23.0) text/calendar, no-store, no-referrer, no cookie. Entries of streams the token's member follows, marked Interested on or owns, and only those they may watch now. Weekly entries carry DTSTART;TZID, RRULE:FREQ=WEEKLY, EXDATE and a VTIMEZONE. Weekly EXDATE lines are the wall-clock time of the cancelled week. Unknown or revoked token: 404; rate limited per token and address (429 with Retry-After and a reference ID in its text, like every other limit; the token is never stored with it). The token is in the URL and may be logged by proxies on the way. GET, POST and DELETE /api/me/schedule-feed show the status, make or replace the token (the address is shown once) and revoke it. The token also ends when the member changes their password, when an administrator resets it or signs the member out everywhere, and when the member is deleted.

GET /api/streams/live Streams live now that the member may watch

Used by the chat page's "Live now" strip (1.16.0): {"streams": [{"id", "name", "game" (1.17.0, null when none), "streamer", "viewer_count", "started_at", "following"}]}, only streams the member may watch (the playback rule), no stream key, pub_ key or RTMP address. Open a stream at /watch/{id}.

GET /api/streams/{id}/overlay Chat overlay status (owner only)

(1.24.0) {"active", "created_at", "last_used_at", "stream_public", "available", "max_sockets": 3, "dock_url"}; never the token or its hash. Full user scope; a stream key is refused with 403; anyone but the stream's owner (an administrator included) and an unknown stream get 404. available is false when the stream's chat is not its own (shared with other streams, or a default channel).

POST /api/streams/{id}/overlay Make or replace the chat overlay link (owner only)

(1.24.0) Makes the stream's overlay token or replaces it: sockets of the old one are closed at once and the old token is refused. One active token per stream. The token also ends, with its open sockets, when the owner's password is changed or reset by an administrator or the owner is signed out everywhere (as the calendar link does). 200 {"active": true, "created_at", "stream_public", "url", "dock_url", "max_sockets"}; url is /overlay/stream/{id}#t=ov_... and is shown in this answer only (only a SHA-256 hash is stored; Cache-Control: no-store). 409 when the stream has no chat of its own. Written to the audit log (stream_overlay_create; administrators read it, moderators do not). Making has a budget of 20 a minute per account: over it 429 with Retry-After and a reference ID (limiter overlay_manage). Revoking has no limit, so a leaked link can always be revoked at once.

DELETE /api/streams/{id}/overlay Revoke the chat overlay link (owner only)

(1.24.0) Removes the token and closes its sockets at once. 200 {"active": false}, also when there was none. Audit entry stream_overlay_revoke (administrators read it, moderators do not). It is never rate limited, so a leaked link can always be revoked at once; at most one audit entry per link that existed.

GET /overlay/stream/{id} Chat overlay page for an OBS browser source (no login)

(1.24.0) The same transparent page for every id (it says nothing about whether a stream exists), with its own script and style, no portal navbar and no cookie. Cache-Control: no-store, Referrer-Policy: no-referrer, X-Robots-Tag: noindex, nofollow and a Content-Security-Policy of default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'none'. The page reads the token from the URL fragment (#t=ov_..., never sent to the server) and options &size= (12 to 96), &lines= (1 to 30), &fade= (0 to 600 seconds), clamped by the script.

GET /ws/overlay Chat overlay WebSocket (first-frame token, read-only)

(1.24.0) While the server is stopping this answers 503 with Retry-After before the upgrade. The client sends {"type": "auth", "token": "ov_..."} within 5 seconds (frames of at most 1 KB; no cookie or other credential is read). A bad, unknown, revoked or regenerated token, a late or malformed first frame and a stream or owner that is gone close the socket with the one code 4401; too many sockets on the token (3), on the owner's streams (9 in all) or on the whole portal (300), or a client too slow to read closes it with 1013; any frame sent after the first closes it with 1008. Failed tokens are counted per address (10 in 10 minutes); past that the upgrade is answered 429 with Retry-After and a reference ID. The server sends {"type": "history", "messages": [...]} (the last 50) and then only message (id, name as viewers see it, optional badge owner or mod, text, time), edit (id, text), delete (id), prune (ids) and clear frames for that one chat. Anonymous posts are named Anonymous with no badge. A message an incoming webhook posted is sent live and in the history as [hook] name with no badge. The history frame is the whole set to show, so a client replaces what it shows with it. No member list, presence, typing, direct message, moderation detail or account id is ever sent. The token is accepted by no other route or socket.

GET /api/streams/public List public streams

Returns all public streams (live, encoding, and offline). Used by the community streams page. The is_live field is an integer: 0=offline, 1=live, 2=encoding (VOD finalization in progress).

Try It

GET /api/streams/open List currently live public streams

Returns all public streams that are currently live. Includes viewer counts and playback URLs.

Try It

GET /api/streams/{id} Get stream details

Returns detailed information about a specific stream including playback URLs.

PUT /api/streams/{id} Update stream settings

Update title, description, or visibility of your stream.

Request Body

ParameterTypeDescription
title string New stream title
description string New description
is_public boolean Change visibility. Switching from public to private rotates the playback key; the response then also carries the new key as public_key.
rtmp_enabled boolean Enable or disable plain RTMP publishing with temporary tokens
game string | null The game shown next to the title (1.17.0), at most 60 characters (400 above that, for a lone surrogate or a non-string); control characters are removed, empty or null clears it. Also accepted by POST /api/streams. While the stream is live, a change of name or game is sent to the chat room's sockets that may see the stream as {"type": "stream_info", "stream_id", "name", "game"}; a stream that is not public sends it only to its owner and administrators.
golive_message string The go-live message (1.16.0), at most 200 characters (400 above that or when not a string; a value over 1000 characters is refused before control characters are removed, which are otherwise dropped; empty or null clears it, the default is {title} just went live). Only {streamer}, {title}, {game} (1.17.0) and {url} are replaced, by literal text; other brace text such as {0.__class__} is kept as typed. A stream is announced at most once per 10 minutes.
golive_audience string Who is notified when the stream goes live (1.16.0): "followers" or "everyone" (every member who may watch it); anything else is a 400. New streams default to "followers", streams that existed before 1.16.0 are "everyone". Never the owner, and only members who may watch the stream at that moment. Making the stream private removes its follows and deletes its go-live cards from channels members can read. The owner's stream responses carry follower_count (a number, never names).
POST /api/streams/{id}/regenerate-key Regenerate stream key

Generate a new stream key, invalidating the old one. Use this if your key is compromised. Since 1.24.1, while the stream is live the replacement also ends the live session like End now (the publisher is disconnected on the path the session published on, relays stop, the recording is finished and kept), so a live stream answers 409 with "live": true and changes nothing unless the body is {"end_live_session": true} (the stream settings dialog asks first); the answer then has ended_live_session: true, publisher_disconnected and disconnect_note. Sockets opened with the old key are closed.

POST /api/streams/{id}/regenerate-public-key Rotate the stream's share link

Generate a new public (playback) key, invalidating the old one. Existing viewing links and embeds built from the old key stop working. Owner only. Returns {"public_key": "pub_..."}.

POST /api/streams/{id}/rtmp-token Generate temporary RTMP publish token

Generate a temporary token for publishing via plain RTMP (unencrypted). The stream must have rtmp_enabled: true and the server must have RTMP_PLAIN_ENABLED set globally.

Prerequisites

  • Stream must have rtmp_enabled set to true
  • Global RTMP_PLAIN_ENABLED must be enabled by the server administrator
  • Authenticated as the stream owner (Bearer token)

Response

{
  "token": "rtmp_abc123...",
  "expires_in": 900,
  "rtmp_url": "rtmp://stream.example.com:1935/live"
}
Important: The token is shown only once and is never stored in plain text. It is single-use with a 30-second grace period for reconnects. Expires in 15 minutes if unused.

Internally, the token doubles as the MediaMTX publish path. Portal maps it back to the stream automatically, so all stream features (HLS playback, dynamic thumbnails, VOD recording) work seamlessly with plain RTMP.

DELETE /api/streams/{id} Delete stream

Permanently delete a stream and its associated chat channel.

POST /api/streams/{id}/thumbnail Upload stream thumbnail

Upload a custom thumbnail image (owner only). Multipart form data with field thumbnail. Max 2MB, JPEG/PNG.

DELETE /api/streams/{id}/thumbnail Delete stream thumbnail

Remove a custom thumbnail for a stream (owner only). The stream will revert to using a dynamic thumbnail when live.

GET /api/stream/{key}/thumbnail Get stream thumbnail

Returns a dynamic JPEG thumbnail captured from a live stream via ffmpeg. Cached for 15 seconds. Returns static thumbnail (or 404) if stream is offline or encoding. The key is normally pub_xxx; a live_xxx key only names the stream and gives no right to watch.

Access (1.16.0): one rule decides who may watch, for HLS, the thumbnail, WHEP (and its session calls) and the info route. The stream's owner and administrators always may; any other signed-in member only when the stream is public; somebody not signed in only when the stream is public with allow_unauthenticated on and the address carries the stream's current pub_ key. Credentials: the session cookie, or a token or API key with the all-scope *; a stream key (live_, also sent as Authorization: Stream-Key or X-Stream-Key) and scoped API keys never authorise watching. Everything else is 404 with {"error": "Stream not found"} (never 401 or 403), the same for a private stream, a rotated or wrong key and an unknown stream. Decisions are cached for at most 5 seconds per credential and stream and dropped at once when the stream's visibility, open link or keys change or the viewer is signed out. Access-Control-Allow-Origin: * is sent only for a public stream with the open link on; other answers are Cache-Control: private.

One capture runs per stream at a time and at most two run at once. When a new frame cannot be made (failure, timeout or all capture slots busy) the last good frame is returned; without one the answer is 503 with a Retry-After header: all slots busy, failed capture, timeout, or MediaMTX not configured. Never 500 or 504.

Stream Moderation

Stream owners can ban users from their stream's chat channel.

GET /api/streams/{id}/bans List banned users

List users banned from this stream's chat (owner only). A ban made from an anonymous post is listed with user_id null and the name "Anonymous" unless the caller is staff; every entry has an id.

POST /api/streams/{id}/bans Ban user from stream chat

Request Body

ParameterTypeDescription
user_id integer User to ban required
reason string Ban reason
DELETE /api/streams/{id}/bans/{user_id} Unban user from stream chat

Remove a ban, allowing the user to chat again (owner only). Does not remove a ban made from an anonymous post unless the caller is staff.

DELETE /api/streams/{id}/bans/id/{ban_id} Unban by ban id

Remove one ban by the id shown in the ban list (owner only). Use this for bans made from an anonymous post, which are listed without the account.

Stream Chat Moderators

The ban routes above and the chat actions pin, unpin, timeout, delete, ban, unban and poll creation are open to global staff, to the stream's owner and to stream mods appointed by the owner. A stream mod's power exists only in that stream's own chat and only while they can still read it; a mod acts only on ordinary members, never on the owner, another mod, global staff or themselves. The owner never acts on staff. A ban also applies to the member's signed-in viewing: HLS, thumbnail, info, WHEP and the viewer heartbeat answer the same 404 as for a stream that does not exist, and GET /api/streams/{id} answers 403 with {"banned": true} for a public stream. Owner and administrators are never banned from viewing; an open-link stream can still be watched signed out.

GET /api/streams/{id}/mods List the stream's chat mods

Owner and administrators only; anybody else and an unknown stream get 404. A stream with no chat of its own (a default or shared channel) lists no mods. Returns {"max": 20, "mods": [{"user_id", "username", "nickname", "added_at"}]}.

POST /api/streams/{id}/mods Appoint a chat mod

Body {"user_id": 7}. Owner and administrators only (404 otherwise). 201 on success; 404 unknown user; 400 bad id, the owner or a member banned from the stream; 409 already a mod, 20 mods already, or the stream has no chat of its own. Appointing does not let the member watch or read a private stream.

DELETE /api/streams/{id}/mods/{user_id} Remove a chat mod

Owner and administrators only; 404 when the member is not a mod of this stream; 409 when the stream has no chat of its own (a default or shared channel). The generic /api/chat/channels/{id}/members routes cannot make or remove a stream chat's mods.

@everyone and @here in a chat message (plain text, not in a code span) notify members when the sender is global staff, has a moderator level in that chat or the channel's switch allow_mass_mentions is on; elsewhere they are ordinary text. @everyone reaches every member who may read the channel, @here those with an open chat socket who do not appear offline; members at level none or with a running mute, and the sender, are left out; at most 500 members, one mention notification each (data.mass is everyone or here), written in one transaction together with the members also named in the text (one row per member). A sender who is not admin gets one per 60 seconds (the message is posted, a notice frame with code mass_mention_limited goes to the sender only); an anonymous sender's is dropped. Each counts as 5 in the mention_spam rule where the sender may use it (elsewhere it is plain text and counts as one); staff are blocked by the rule like everybody else. set_mass_mentions (allowed true or false; staff, and the owner of a stream in its own chat) answers the room with mass_mentions_changed; channel_info carries allow_mass_mentions and can_mass_mention.

Chat socket: {"type": "set_slowmode", "seconds": 15} (0, 5, 15 or 30; owner, mods and staff; stream chat only) answers the room with slowmode_changed. timeout_user takes target_user_id or the message_id of one of the member's messages (also for an anonymous post). channel_info carries slowmode_seconds, mod_level (none, mod, owner, staff) and stream_chat; messages of the owner and mods carry stream_role. A change of a member's level sends them a mod_level frame. Refusals on a target all read Not allowed.

Stream Health and Live Operations

GET /api/streams/{id}/health Stream health (owner and administrators)

Owner and administrators only; anybody else (a stream moderator included) and an unknown stream get the same 404. A browser session or a full-scope credential is needed. Nothing is stored. Limited to 90 reads a minute per account (429 with a reference ID). Returns {"stream_id", "live", "uptime_s", "ingest", "relays", "recorder", "load_average", "warnings", "thresholds"}. ingest (bitrate, a ring of about 30 samples, source, codecs, last data) is {"available": false, "reason"} when the stream is not live or when this server has no reading of the stream yet. The numbers come from the paths list of the 30 second MediaMTX health check (the health check's first page is reused; further pages, one call each and at most 10 in all, are read only when MediaMTX reports more than one; the viewer sync tick still fetches nothing), so a live stream has no ingest data until its first reading and no bitrate_bps until its second, and nothing is read while MediaMTX is stopped or unhealthy. Relay and recorder errors are fixed sentences, never a destination, key or path. Warnings (no_data after 75 s, bitrate_drop, relay_failing, recording_stopped_by_guard, recording_refused_by_guard, recording_failed) are smoothed on the server.

GET /api/admin/live-streams Streams that are live now (admin)

Administrators only with a browser session or an all-scope token (404 for anybody else, 403 for every API key and scoped token). Limited to 90 a minute per account (429, limiter live_ops_list), apart from the 30 a minute of the two actions. Returns {"streams": [{"id", "name", "owner", "uptime_s", "bitrate_bps", "viewers", "relays_running", "recording"}]}; bitrate_bps is null until the stream's second reading from the 30 second MediaMTX health check, and while MediaMTX is not running.

POST /api/admin/streams/{id}/stop-relays Stop a stream's relays (admin)

Same access as the list. Body {"confirm": true} (since 1.24.1; without it 400 and nothing happens). Stops the relays of a live stream (409 otherwise) and holds the relay monitor back until the stream ends or the portal restarts (the hold is in memory only; the owner sees the relays as stopped_by_admin, not as failed). A second request while the first runs gets 409. Audited as stream_stop_relays before anything is done. Returns {"success": true, "stopped": 2}.

POST /api/admin/streams/{id}/end End a stream now (admin)

Same access as the list. A second End now for the same stream while one is running (or its recording is still uploading) gets 409 and writes no audit entry; the publisher is disconnected on the path the session was published on (live/<key> for an encoder, the bare <key> for a browser WHIP publish), also after the owner replaced the key. Body {"confirm": true, "regenerate_key": false}: since 1.24.1 confirm must be true (without it, with a bare POST or an empty body: 400, nothing happens) and regenerate_key defaults to false (it was true). With regenerate_key: true it replaces the stream key and revokes temporary RTMP tokens, disconnects the publisher through MediaMTX (/v3/rtmpconns/kick, rtmpsconns, rtspsessions, rtspssessions or webrtcsessions by source type; an SRT, HLS or camera source cannot be disconnected from here) (run against MediaMTX v1.21.3 for RTMP, RTMPS and RTSP; the RTSPS and WebRTC routes were only shown to exist there), then ends the session as usual: relays stop, the recording is finished and uploaded (nothing is deleted), the stream chat goes offline and, as at any stream end, its messages are cleared unless the chat is shared. The owner gets a stream_ended notification ("An administrator ended your stream.") with two sentences added only when they apply: that the stream key was replaced (the encoder needs the new key from the stream settings) and that the encoder could not be disconnected (it may still be sending; not said when MediaMTX had no publisher on the path). No other detail. 409 when the stream is not live. Audited as stream_end_now. Returns {"success", "publisher_disconnected", "disconnect_note", "source", "key_replaced"}.

Watching Streams

All stream traffic routes through Portal on port 443. Viewers can watch streams using HLS.js in browser or any HLS-compatible player:

import Hls from 'hls.js';

const video = document.getElementById('video');
const hls = new Hls();

// All playback through Portal on port 443
hls.loadSource('https://portal.example.com/api/stream/sk_abc123/hls/index.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, () => {
  video.play();
});

Watch page and pop-out chat

The Portal watch page /watch/{id} has a picture-in-picture button next to Fullscreen (also on /live). It is shown only when the browser supports picture-in-picture for the video; Firefox has no page API for it, so use the toggle Firefox draws on the video. In browsers that play HLS natively (for example iPhone Safari) the quality, buffer and stats controls are not shown; the bar then holds only the picture-in-picture button, and the native video controls offer it too. /watch/{id}?chat=only shows only the chat at full width, for a pop-out window; it is served, authorised and loaded exactly like the normal page (login required, the stream comes from GET /api/streams/{id}, bans and anonymous masking apply as usual). The pop-out is a second /ws/chat connection of the same member to the same room: it adds no second join announcement and no second entry to the users list, and closing it announces a leave only when it was the member's last connection in that room. Voice stays in the main window.

Publishing via WHIP (same network only)

Not available through the public proxy. The offer and answer travel through Portal on port 443, but the media does not. It flows directly between the client and MediaMTX's WebRTC media port (UDP/TCP 8189 by default), which the configuration Portal generates binds to loopback and which never passes through the public proxy. WHIP and WHEP therefore work only where the client can reach that port directly, for example on the same network after changing the WebRTC bind addresses in the MediaMTX configuration. From the internet, publish with RTMPS and play back with HLS.

Where the WebRTC media port is reachable, OBS 30.0+ can publish with WHIP:

// OBS Settings:
// Service: WHIP
// Server: https://portal.example.com/api/stream/{stream_key}/webrtc/whip
// Bearer Token: (leave empty - key is in URL)

Stream Relays

Relay your stream to external platforms (Twitch, YouTube, Kick, other Portal instances, or custom RTMP destinations). Relays start automatically when you go live and stop when your stream ends. Maximum 10 relay destinations per stream. Relay credentials are encrypted at rest.

GET /api/relay-platforms List supported relay platforms

Returns the list of supported relay platforms with their default RTMP ingest URLs.

{
  "platforms": [
    { "id": "twitch", "name": "Twitch", "default_url": "rtmp://live.twitch.tv/app" },
    { "id": "youtube", "name": "YouTube", "default_url": "rtmp://a.rtmp.youtube.com/live2" },
    { "id": "kick", "name": "Kick", "default_url": "rtmps://fa723fc1b171.global-contribute.live-video.net/app" },
    { "id": "portal", "name": "Portal", "default_url": "" },
    { "id": "custom", "name": "Custom", "default_url": "" }
  ]
}
GET /api/streams/{id}/relays List relay destinations

Returns all relay destinations configured for this stream (owner only). Stream keys are never returned; a has_stream_key boolean indicates whether one is set.

POST /api/streams/{id}/relays Add relay destination

Request Body

ParameterTypeDescription
platform string Platform ID from /api/relay-platforms required
name string Display name for this destination required
rtmp_url string RTMP ingest URL (must start with rtmp:// or rtmps://) required
stream_key string Stream key for the destination platform required
enabled boolean Whether to relay when live (default: true)
PUT /api/streams/{id}/relays/{relay_id} Update relay destination

Update a relay destination's name, URL, stream key, or enabled state (owner only). All fields are optional; only provided fields are updated.

DELETE /api/streams/{id}/relays/{relay_id} Delete relay destination

Remove a relay destination (owner only). If the relay is currently active, it will be stopped.

VOD Storage

Manage remote SFTP storage for recorded VODs (MKV files). Each user configures their own storage server. VODs are automatically recorded as 5-minute MKV chunks during live broadcasts and continuously uploaded to SFTP. When a stream ends, it enters an Encoding state (is_live=2) while the final chunk is written and all remaining chunks are offloaded, ensuring no VOD data is lost.

GET /api/vods/storage Get storage configuration

Returns the user's SFTP storage configuration. Passwords and private keys are redacted.

Response

{
  "storage": {
    "host": "storage.example.com",
    "port": 22,
    "username": "user",
    "auth_method": "password",
    "remote_path": "/home/user/vods",
    "has_password": true,
    "has_key": false
  },
  "recording_guard": null
}

recording_guard is null, or says that the VOD disk guard stopped or refused a recording of this user: {kind: "stopped" | "refused", code: "low_free_space" | "session_backlog" | "total_backlog", message, stream_name, at} (no paths). It is held in memory, so a restart clears it. The portal keeps one notice per stream and shows the user's most recent one (the shape is the same whatever the number of streams); a notice goes when a recording of that same stream starts normally, so another stream of the user starting does not clear it.

POST /api/vods/storage Save storage configuration

Request Body

FieldTypeDescription
hoststringSFTP server hostname
portintegerSSH port (default: 22)
usernamestringSSH username
auth_methodstring"password" or "key"
passwordstringSSH password (if auth_method=password)
private_keystringSSH private key PEM (if auth_method=key)
remote_pathstringPath to VOD directory on remote server
DELETE /api/vods/storage Remove storage configuration

Removes the SFTP storage configuration. Does not delete any remote files.

POST /api/vods/storage/test Test SFTP connection

Tests the SFTP connection with the provided credentials and reports how many MKV files were found.

POST /api/vods/storage/host-key/accept Trust an SSH host key

Pin (or replace) the VOD storage host key. The credential must carry its user's full scope: a browser session or an all-scope (*) token or API key. Stream keys, scoped API keys and scoped tokens get 403, and the prompt they receive has can_accept: false and no accept_url or accept_token. The storage pins the key it sees on its first connect automatically; a different key later is refused and GET /api/vods/storage shows it as host_key_refused. Only fingerprint is used here; host, port and token are not required. The fingerprint must be the host_key_refused.fingerprint that GET /api/vods/storage shows; any other fingerprint, or no refused key being stored, is answered with 409.

Request Body

FieldTypeDescription
fingerprintstringThe fingerprint from the prompt (SHA256: and 43 base64 characters) required

Response

{"status": "accepted", "fingerprint": "SHA256:..."}

Errors

StatusMeaning
400Missing or malformed fingerprint
404No VOD storage configured
409The fingerprint is not the stored refused key ({"error": "...", "type": "host_key_stale"}), or the storage host or port was changed meanwhile ({"error": "Storage changed; try again"})
GET /api/vods List VOD files

Recursively lists MKV files in the user's remote storage directory. Files are organized by recording session: StreamName/YYYY-MM-DD_HH-MM-SS/chunk_NNN.mkv. Returns 404 if no storage is configured. The answer carries recording_guard (see GET /api/vods/storage) and playback ({enabled, message}), and recording_guard is also on the 502 answers when the storage cannot be reached.

Query Parameters

ParameterTypeDescription
sortstringSort by: name, size, modified (default: modified)
orderstringasc or desc (default: desc)

Response

{
  "files": [
    {
      "name": "StreamName/2026-02-08_04-24-49/chunk_000.mkv",
      "size": 233436982,
      "modified": 1770525031
    }
  ],
  "path": "/home/user/vods"
}
GET /api/vods/play/{path}.mp4 Play one of your own VOD chunks as MP4

{path} is the path GET /api/vods lists with .mp4 appended (StreamName/2026-01-01/chunk_000.mkv.mp4). The portal fetches the chunk over the pinned SFTP connection, checks it with ffprobe, remuxes it without transcoding and keeps the MP4 in a size-capped cache. The answer is that MP4 (video/mp4, Range works, Cache-Control: private, no-cache). Needs a browser session or a full-scope credential (an all-scope * token or API key); stream keys and scoped keys get 403, as on every other /api/vods route. Playback is owner only: another member, and an administrator asking for another member's chunk, get 404, the same as for a chunk that does not exist.

202 not prepared yet (state, stage, status_url, Retry-After): poll the status route, then ask again. 404 not your chunk, not a listed chunk path, or a file that is a link on the storage or lies behind a linked folder leading outside your VOD root. 409 the newest chunk of a stream that is being recorded now. 415 download only (reason): anything but H.264 with AAC or MP3 audio or no audio, or a chunk whose finished copy alone (about 1.2 times its size) is larger than vod_play_cache_mb (not remembered: a raised cap helps at once). 429 too many chunks being prepared. 502 storage unreachable or silent on the size lookup (only a file the storage says is missing is 404; the text names nothing of the storage). 503 the storage lookups did not finish within 20 seconds (Retry-After), playback off (vod_play_cache_mb is 0, code: playback_off), no usable cache folder, not enough free disk (a job needs vod_min_free_gb plus 512 MB left over, also with the floor at 0), or the chunk changed on the storage and a newer version of it is being prepared while the request still saw the older one. 500 conversion failed (nothing is kept). A copy is tied to the chunk's size and modification time; a changed chunk is prepared again.

GET /api/vods/play-status/{path}.mp4 Progress of preparing a chunk

Same path form and authentication as the play route; never starts a job and never contacts the storage. Returns {"state": "idle"}, {"state": "preparing", "stage": "queued|waiting|pulling|probing|remuxing"}, {"state": "ready"}, {"state": "unplayable", "reason", "message"} (download only) or {"state": "failed", "error"}. GET /api/vods carries playback: {enabled, message} so a client knows whether to offer Play.

GET /api/vods/session/{folder}/index.m3u8 A whole session as one HLS playlist

The chunks of {folder} (for example StreamName/2026-01-01) in chunk order as an HLS VOD playlist: one #EXTINF per chunk with the measured length of that chunk, #EXT-X-DISCONTINUITY between chunks, #EXT-X-ENDLIST, relative segment names (chunk_000.ts), no credential in any URL. Authentication and owner rule are those of the single-chunk play route: another member, and an administrator asking for another member's session, get 404.

Lengths come from the recorder (measured at delivery) or, for older sessions, from a bounded probe of the first 256 KB of each chunk (a read that ends inside the first keyframe settles nothing: the length is kept as provisional and the check of the whole file at segment time decides, with 415 for that segment); the request never pulls a chunk. 202 {state: "preparing", stage: "measuring", done, total} with Retry-After until every length is known, then 200. 404 not your folder. 409 {state: "live"}: recording now and no finished chunk yet; while a recording writes to the folder the newest chunk is left out and the playlist is an EVENT playlist without ENDLIST, not a finished VOD. A reload of that playlist is never answered with 202 once chunks are measured: a chunk without a length yet is left out, together with the chunks after it, until it is measured. 413 more than 500 chunks. 415 a chunk is download only. 502 storage unreachable. 503 playback off or busy.

GET /api/vods/session/{folder}/chunk_NNN.ts One chunk of a session as MPEG-TS

The chunk remuxed to MPEG-TS (video/mp2t), made on demand by the same job, cache and cap as the single-chunk MP4. The request waits at most 55 seconds for its job, then answers 503 with Retry-After: 2 (never 202) and the player asks again; the next chunk is prepared ahead when it fits without evicting anything. Also 404, 409 (the newest chunk of a folder being recorded, even when an earlier copy is cached), 415 (download only), 502, 500; too many chunks being prepared is also 503 (state: busy, Retry-After), because hls.js retries a 5xx segment but not a 4xx. The 55 seconds count from the arrival of the request and cover every step (connection, lookups, live checks, the wait for the job); a request that runs out answers 503 with Retry-After. The playlist request has a 20 second deadline for the connection and the folder listing (then 503). A chunk that changed on the storage while its segment was being made gets a new job (a request waiting for the old one gets 409); an older version asking meanwhile gets 503 state: busy.

GET /api/vods/download/{filename} Download a VOD file

Streams the specified MKV file from remote storage. Only .mkv files are allowed. Supports subdirectory paths. Path traversal is blocked, and a file that is a symbolic link on the storage or lies behind a linked folder leading outside your VOD root is answered 404 and not read. Connecting, the check and the size lookup together have 60 seconds; a storage that does not answer in that time gets 502.

POST /api/vods/download-archive Download multiple VODs as zip

Downloads multiple VOD files as a single zip archive streamed from SFTP. Maximum 500 files per request. All paths must end in .mkv.

Request Body

{
  "files": [
    "StreamName/2026-02-08_04-24-49/chunk_000.mkv",
    "StreamName/2026-02-08_04-24-49/chunk_001.mkv"
  ]
}

Response

Binary zip stream with Content-Disposition: attachment header. Connecting and looking up the root have 60 seconds before the zip starts (502 when the storage does not answer, 404 when the root does not exist). The archive stops at once when the client stops reading, and at the first storage timeout it is closed with the files that were complete.

DELETE /api/vods/{filename} Delete a VOD file

Deletes the specified MKV file from remote storage. Only .mkv files can be deleted. Supports subdirectory paths. A copy of the chunk being prepared for browser playback is cancelled and every cached copy of it is removed. A file that is a symbolic link on the storage, or lies behind a linked folder pointing outside your VOD root, answers 404 and nothing is removed. Connecting, the check and the removal together have 60 seconds; a storage that does not answer in that time gets 502.

User Management

GET /api/me Get current user info

Returns information about the authenticated user. Since 1.24.2 the answer also has granted_service_expiry: for the same services as granted_services, {service id: seconds left, or null when the grant never ends}; {} for administrators.

Response

{
  "id": 1,
  "username": "myuser",
  "is_admin": false,
  "scopes": "access:*",
  "created_at": "2024-01-01T00:00:00Z",
  "totp_enabled": true
}

Try It

POST /api/me/password Change password

Other browser sessions and tokens of the account are revoked and their WebSocket connections are closed; the session making the request stays signed in. API keys are not revoked: they are separately managed credentials (often used by scripts) and stay valid, together with any WebSocket opened with them, until you revoke them. If you suspect an account is compromised, revoke its API keys as well. An admin password reset does revoke API keys.

Request Body

ParameterTypeDescription
current_password string Current password required
new_password string New password (min 8 chars) required
PUT /api/me/status Update chat status

Request Body

ParameterTypeDescription
status string online, away, busy, dnd, or offline required
status_message string Custom status message (max 100 chars)
PUT /api/me/nickname Update display nickname

Request Body

ParameterTypeDescription
nickname string Display name (2-32 chars, alphanumeric/spaces/dashes). Empty to clear.
PUT /api/me/avatar Update avatar

Request Body

ParameterTypeDescription
color string Hex color (#RRGGBB)
emoji string Emoji character (null to clear)
initials string 1-2 character initials
PUT /api/me/anonymous Toggle anonymous mode

Toggle anonymous mode in chat. Messages sent while anonymous remain anonymous in history. Each change is announced to every chat room the user is in, so it is limited to 5 per minute per user (HTTP 429 with a Retry-After header beyond that).

Request Body

ParameterTypeDescription
anonymous boolean Enable or disable anonymous mode required

SSH Keys

Generate and manage SSH key pairs for authentication. Private keys are generated on the server and returned only once - they are never stored.

POST /api/ssh-keys Generate SSH key pair

Request Body

ParameterTypeDescription
name string Key name required
key_type string "ed25519" (default) or "rsa"
Important: The private key is only returned once. Save it immediately.

Response

{
  "id": 1,
  "name": "my-key",
  "public_key": "ssh-ed25519 AAAA...",
  "private_key": "-----BEGIN OPENSSH PRIVATE KEY-----\n...",
  "fingerprint": "SHA256:..."
}
GET /api/ssh-keys List SSH keys

Returns all SSH keys for the authenticated user (public keys only).

GET /api/ssh-keys/{id} Get SSH key details

Returns details for a specific SSH key (public key only).

DELETE /api/ssh-keys/{id} Delete SSH key

Permanently delete an SSH key pair.

GET /api/ssh-keys/authorized Get authorized_keys format

Returns all your public keys in authorized_keys format for adding to remote servers.

Two-Factor Authentication

Enable TOTP-based two-factor authentication for enhanced security.

GET /api/user/2fa/status Get 2FA status

Response

{
  "enabled": false,
  "backup_codes_remaining": 0
}
POST /api/user/2fa/setup Start 2FA setup

Generates a TOTP secret and provisioning URI for authenticator apps.

Response

{
  "secret": "JBSWY3DPEHPK3PXP",
  "provisioning_uri": "otpauth://totp/Portal:user?secret=..."
}
POST /api/user/2fa/verify Enable 2FA

Verify a TOTP code to enable 2FA. Returns backup codes.

Request Body

ParameterTypeDescription
code string 6-digit TOTP code required
POST /api/user/2fa/disable Disable 2FA

Disable two-factor authentication. Requires a valid TOTP code to confirm.

Request Body

ParameterTypeDescription
code string 6-digit TOTP code required

WebSocket Service Relay

Open Relay Portal uses WebSocket connections to relay traffic to backend services. This enables real-time bidirectional communication for terminals, VNC, and other interactive protocols.

Connection URL Format

wss://portal.example.com/ws/{plugin}/{service_id}?token=YOUR_TOKEN

Supported Plugins

PluginDescriptionData Format
terminal Local PTY terminal JSON messages
ssh SSH over WebSocket JSON messages
vnc VNC relay (for noVNC) Binary frames
spice SPICE VM console Binary frames
tcp_tunnel Generic TCP tunnel Binary frames
secure_tunnel Multiplexed secure tunnel Binary frames

Terminal WebSocket Protocol

Terminal sessions use JSON messages for communication:

Keys that are not text are ordinary input data: Ctrl+C is "\u0003", Tab is "\t", Esc is "\u001b", and the arrow keys are "\u001b[A" to "\u001b[D" ("\u001bOA" to "\u001bOD" while an application has switched on application cursor keys). The touch key bar in the web terminal sends exactly these, so API clients can do the same.

Client Messages

// Send input
{"type": "input", "data": "ls -la\n"}

// Resize terminal
{"type": "resize", "cols": 120, "rows": 40}

// Ping (keep-alive)
{"type": "ping"}

Server Messages

// Terminal output
{"type": "output", "data": "total 128\ndrwxr-xr-x..."}

// Pong response
{"type": "pong"}

// Error
{"type": "error", "message": "Connection failed"}

JavaScript Example

const ws = new WebSocket('wss://portal.example.com/ws/ssh/1?token=...');

ws.onopen = () => {
  // Send terminal size
  ws.send(JSON.stringify({
    type: 'resize',
    cols: terminal.cols,
    rows: terminal.rows
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === 'output') {
    terminal.write(msg.data);
  }
};

// Send user input
terminal.onData(data => {
  ws.send(JSON.stringify({type: 'input', data}));
});

VNC/RDP WebSocket Protocol

VNC connections relay raw binary RFB protocol frames:

wss://portal.example.com/ws/vnc/{service_id}?token=YOUR_TOKEN

Use with noVNC client library:

import RFB from '@novnc/novnc/core/rfb';

const rfb = new RFB(
  document.getElementById('vnc-container'),
  'wss://portal.example.com/ws/vnc/1?token=...'
);

rfb.scaleViewport = true;
rfb.resizeSession = true;

TCP Tunnel Protocol

Generic TCP tunneling for databases, Redis, and other TCP services:

wss://portal.example.com/ws/tunnel/{service_id}?token=YOUR_TOKEN

Data is sent as binary WebSocket frames, directly relayed to/from the TCP backend.

User Connection WebSocket

Connect to your personal connections via:

wss://portal.example.com/ws/user-connection/{connection_id}

Chat/Forum

Real-time multi-user chat with channels. Messages are encrypted at rest and automatically deleted after 7 days.

Security: All messages are encrypted using AES-256 (Fernet) before storage. Messages older than 7 days are automatically purged.

Display Name Priority

Chat display names follow this priority order:

  1. Anonymous — If anonymous mode is enabled, displayed as "Anonymous" with no avatar or nickname
  2. Nickname — If set via PUT /api/me/nickname
  3. Username — The account username (fallback)

Anonymous state is stored per-message, so messages sent while anonymous remain anonymous even after the user turns anonymous mode off.

Message Rate Limiting

Chat messages are rate limited to 5 messages per 5 seconds per user. If exceeded, the server responds with an error and the message is not sent. Since 1.24.2 react, edit_message and the dm_* frames answer {"type": "error"} (Invalid message_id or Invalid id) for an invalid or out-of-range message or conversation id and the socket stays open; more than 20 voice_kick, voice_server_mute, voice_server_unmute, voice_lock_room or voice_unlock_room frames in 10 seconds on one socket answer Rate limit exceeded; the error frame for a channel the socket can no longer read carries an integer channel_id.

REST API

GET /api/chat/channels List chat channels

Returns the chat channels the caller may see: public channels, private channels the caller belongs to (admins and superadmins: all) and stream chat channels only when the stream is public or the caller is its owner or an admin. The chat of a stream that is not public is left out, with its stream, live state and owner. Since 1.24.2 every row has an integer unread_mentions (the member's own unread mentions that are newer than the read position in that channel; 0 when none).

Response

{
  "channels": [
    {
      "id": 1,
      "name": "general",
      "description": "General discussion",
      "is_default": 1,
      "is_stream_channel": false
    }
  ]
}
POST /api/chat/channels Create channel

Request Body

ParameterTypeDescription
name string Channel name (lowercase, hyphens allowed) required
description string Channel description
PUT /api/chat/channels/{id}/retention Set a channel's retention ADMIN

Administrators only (1.20.0): a moderator or channel moderator gets 403, and the generic channel update ignores these fields. The chat socket has no channel-settings path for retention.

Request

{"retention_days": 30, "file_retention_days": 7, "confirm": true}

retention_days: days after which the periodic cleanup removes the channel's messages (pinned ones stay). A number, 0 or "forever" (stored as the cap, setting retention_chat_max_days, default 3650), or null to follow the global setting. A channel with its own value is no longer touched by the global chat retention. The cap limits a value when it is set; lowering retention_chat_max_days afterwards does not shorten a value already stored. A value of 0 or less found in the database (only a manual edit can store one) is read as no value, never as one day. file_retention_days: removes only the uploaded files of older messages (the message stays, marked file_removed) and can never exceed the message retention (400). A field left out is kept.

A change that makes removal sooner is applied only with "confirm": true. Without it nothing changes and the answer is {"applied": false, "confirm_required": true, "would_remove_messages": 12, "would_remove_files": 3}; "dry_run": true only looks. Applied: {"applied": true, "retention_days": 30, "file_retention_days": 7, "capped": false, "next_cleanup_at": "..."}. Audited as channel_retention_change with the old and new value. Errors: 400 (bad value, including a non-finite one such as Infinity or NaN or a number above 1000000000, file value above the message value, a stream's own chat), 403, 404.

The channel list and the channel_info frame carry retention_days, file_retention_days and retention_next_cleanup for a channel with its own value.

POST /api/chat/channels/{id}/prune Prune messages in a date range MOD

Administrators and the moderators of that chat per chat_mod_level (global staff, a stream's owner, a stream mod). A channel the caller may not read, and a caller with no moderator level in it, get 404 {"error": "Channel not found"}. The prune removes only what the caller could delete one message at a time: a stream mod the posts of ordinary members, the stream's owner everybody's but staff (the go-live card is the owner's), a global moderator or administrator everybody's of a lower role, everybody their own. A user filter on someone the caller may not act on counts 0, and a range prune leaves those posts.

Request

{"from": "2026-11-21T10:00:00Z", "to": "2026-11-21T11:00:00Z", "user": "alice", "skip_pinned": true, "dry_run": true}

from and to (ISO 8601, both required, both inclusive, no offset = UTC; a to later than the moment of the request ends at that moment, so a message posted while the prune runs is never taken). user (optional): an account id or a username; a user filter never matches an anonymous message, for anybody (an administrator included), so the history never shows whose the others were. Without a user filter, an anonymous message in the range is matched for every caller but an administrator whoever wrote it (the rank rules cover named messages only), so a count cannot tell the rank of its author. An administrator's prune without a user filter leaves anonymous messages alone when the rank rules exclude any author (another administrator or a superadmin), so nothing shows which of them survived. skip_pinned (default true). A dry run answers {"count": 12, "margin": 2} and removes nothing. A real run must send that count as expected_count; it is 409 (with the live count) when the live count differs by more than the margin, which is max(2, 2 percent) of the count the dry run showed (the count and margin of the dry run, and the expected_count you send back; the 409 repeats it as margin). 400 without it and for a value that is not a whole number up to 1000000000, a user id beyond the account id range, or a non-finite number (Infinity, NaN). Success: 202 {"started": true, "count": 12}.

The prune runs as a background task in batches of 200 that yield to the event loop. The room receives one messages_pruned frame per batch ({"type": "messages_pruned", "channel": "general", "ids": [41, 42]}, ids only), and one audit entry chat_prune is written when it ends. Upload files go with their messages. One prune per channel at a time (409). GET on the same path returns {"running", "status", "removed", "total", "files"} of the last prune, same gate.

POST /api/chat/upload Upload image for chat

Upload an image to embed in a chat message. Returns a URL to include as image_url in the WS message payload.

Request

Multipart form data with field name image. Max size: 5MB. Accepted types: JPEG, PNG, GIF, WebP. Other files are accepted too (max 25MB). A file sent as application/octet-stream keeps its extension only when it is on the portal's allowed list; any other name is stored with the extension .bin, and the original name is returned as filename.

Response

{
  "url": "/static/uploads/chat/abc123.jpg"
}
GET /api/chat/link-preview Fetch OpenGraph preview for a URL

Fetches OpenGraph metadata (title, description, image) for a given URL. Used by the chat frontend to render link preview cards. Results are cached server-side for 1 hour. Since 1.24.2 a host name that does not resolve within 5 seconds answers 400.

Query Parameters

urlThe URL to preview (required, must be http/https)

Response

{
  "url": "https://example.com/article",
  "title": "Article Title",
  "description": "A brief description...",
  "image": "https://example.com/image.jpg",
  "site_name": "Example"
}
GET /api/chat/thread/{id} Get reply chain for a message

Returns the full reply chain (thread) for a given message, walking backwards through reply_to references up to 20 messages deep. Messages are returned in chronological order (oldest first), in the same shape as the channel history (reactions, polls, reply previews, anonymous posts masked for ordinary members).

Readable under the same rule as the channel's history. 404 {"error": "Message not found"} for a message that does not exist and for one the caller may not read (private channel and not a member, removed member, banned from the stream chat, or the chat of a stream that is not public and the caller is neither its owner nor an admin). 400 when the id is not a number. The answer carries Cache-Control: private, no-store.

Response

{
  "thread": [
    {"id": 10, "username": "alice", "message": "Original message", "created_at": "..."},
    {"id": 15, "username": "bob", "message": "Reply", "reply_to": 10, "created_at": "..."},
    {"id": 20, "username": "alice", "message": "Reply to reply", "reply_to": 15, "created_at": "..."}
  ]
}
GET /api/chat/channels/{id}/messages Older messages of a channel, or a window around one message

Reads more of a channel's history, for scrolling back and for links to a message. Same authentication as the other chat routes. Direct messages are not served here. Messages are oldest first and have the same shape as the WebSocket history reply: join, history_page and this route build them in one shared function, so the same viewer gets identical message objects from each, and anonymous posts are masked for ordinary members everywhere (no account id, role, nickname, avatar or name, also in reactions, reply previews and polls; moderators, admins and the author keep the id).

Query parameters

ParameterDescription
before_idReturn the messages older than this message id. Exclusive with around_id; with neither, the newest page is returned.
around_idReturn a window centred on this message.
limitPage size, default 50, at most 100. 0 or a non-number is a 400.

A before_id or around_id that is not a whole number from 1 to 9223372036854775807 is a 400, and a channel id outside that range is a 404.

Response

{
  "channel_id": 3,
  "messages": [...],
  "has_more": true,
  "has_newer": false,
  "found": true
}

has_more: older messages exist. has_newer: newer messages than the window shows (around_id only). found is false, with an empty list, when around_id is not a message of this channel (deleted, removed by the chat retention, or elsewhere). Messages older than the chat retention (retention_chat_days, one setting for all channels) no longer exist. Reading marks nothing as read. The chat of a stream that is not public can be read, joined and written to only by the stream's owner and admins. The answer carries Cache-Control: private, no-store.

Go-live cards (1.16.0): a message with "message_type": "stream_card" and "card": {"stream_id", "streamer", "title"}; message is a plain-text fallback (alice is live: title - https://host/watch/5) for a client that does not know the type, and a client builds the watch link as /watch/{stream_id}. It is a system post through the normal encrypted insert, cannot be edited, carries no stream key or thumbnail, and is posted into the stream's own chat and, for a public stream, into the announce channel an administrator chose; never into a channel members can read for a stream that is not public. It is deleted from every channel except the stream's own closed chat when the stream becomes private, also from a channel that was made private later and has members (the room receives message_deleted) and everywhere when the stream is deleted; the chat retention removes it like any message.

Errors

400 bad parameter. 401 not authenticated. 404 {"error": "Channel not found"} for a channel the caller cannot read (private and not a member, banned from the stream chat, removed member, the chat of a stream that is not public and the caller is neither owner nor admin) and for one that does not exist. 429 with Retry-After after 30 history requests in a minute; the budget is shared with the WebSocket history_page message and all of the caller's sockets.

GET /api/chat/channels/{id}/notify Your notification choice for a channel

Your own level and timed mute for one channel you may read (1.19.0). notify_level is all, mentions, none or null (no choice: a live badge and nothing else); muted_until is epoch seconds, 0 when not muted. GET /api/chat/channels carries both on every channel.

Errors

401. 404 {"error": "Channel not found"} for a missing channel and, identically, for one you may not read.

PUT /api/chat/channels/{id}/notify Set your level and mute for a channel

Body: {"level": "all" | "mentions" | "none" | "default", "mute_hours": 0 | 1 | 8 | 24}; send either or both. default removes the choice, mute_hours: 0 ends a mute. An active mute stops the badge and the ordinary signal; an @mention still notifies unless the level is none. The answer has the shape of the GET route.

Errors

400 (neither key, or a value not in the lists). 401. 404 as for GET.

GET /api/saved Your saved messages, resolved now

Your own saved entries, newest first (1.23.0). limit 1 to 50, before_id is next_before_id of the previous page. An entry is a reference: no text is stored. Each is resolved now with the same read rule as the chat; a message you can no longer read or that is gone is {"available": false} with only id, saved_at, remind_at and reminded. A channel entry carries channel_id and message_id for jump-to-message, a direct-message entry carries conversation_id. An anonymous post stays anonymous. Answers carry Cache-Control: private, no-store; API keys and stream keys get 403.

Errors

400. 401. 403. 429 with Retry-After (shares the chat history budget).

GET /api/saved/marks Which messages you saved

{"marks": [{"id", "kind", "message_id"}], "limits": {"max_saved": 500, "max_reminders": 100, "reminder_horizon_days": 366}}: what the chat page needs to mark saved messages for you alone. Only entries that resolve now are listed, never one the list shows as no longer available. Counts toward the same chat history budget as the list (429 with Retry-After when it is used up); the chat page asks at most once a minute unless you saved or removed something.

POST /api/saved Save a message

Body {"kind": "channel" | "dm", "message_id": 123}. 201 with {"saved": {"id", "kind", "message_id", "saved_at", "remind_at", "reminded"}}, 200 when it was already saved. Only a message you can read now: a message that does not exist, one you may not read and one of the other kind answer with the same 404 {"error": "Message not found"}. At most 500 entries (409).

DELETE /api/saved/{id} Remove a saved entry

Removes one of your own entries, also one that is no longer available. 404 for any other id.

DELETE /api/saved/unavailable Remove every entry that is no longer available

Removes every one of your own entries that cannot be read now, those with a waiting reminder included. Answers {"removed": 3}, a count and nothing about the messages. Same credential rule as the other saved routes; it counts toward the chat history budget (429 with Retry-After).

PUT /api/saved/{id}/remind Set or clear a reminder

Body {"remind_at": "2026-11-24T08:00:00Z"} sets, {"remind_at": null} clears. The time is an absolute UTC instant ending in Z, in the future and at most 366 days ahead (400 otherwise); at most 100 reminders wait at once (409). A time cannot be set for an entry whose message is no longer available: 409 {"error": "That message is no longer available, so no reminder can be set for it"}, the same answer whatever the reason (so it does not say why); null still clears a waiting reminder of such an entry. When due, one notification of type reminder is created with the fixed title "Reminder for a saved message" and no text; its data is {"channel_id", "message_id", "saved_id"} while the message is readable in a channel, else {"saved": 1, "saved_id"}. It never repeats, also across a restart. A member keeps at most 200 reminder notifications; a newer firing deletes the oldest ones. A Web Push carries the same fixed title and a link, never text, author or channel name.

WebSocket API

Connect to the chat WebSocket for real-time messaging:

wss://portal.example.com/ws/chat

Client Messages

// Join a channel
{"type": "join", "channel": "general"}

// Send a message
{"type": "message", "channel": "general", "message": "Hello!"}

// Send a reply (reply_to is the parent message ID)
{"type": "message", "channel": "general", "message": "Nice!", "reply_to": 42}

// Send a message with an image (upload first via POST /api/chat/upload)
{"type": "message", "channel": "general", "message": "", "image_url": "/static/uploads/chat/abc.jpg"}

// Delete a message (admins/mods: any; users: own only)
{"type": "delete", "message_id": 42}

// Toggle emoji reaction (adds if not present, removes if present)
{"type": "react", "message_id": 42, "emoji": "👍"}

// Edit own message (within 5-minute window)
{"type": "edit_message", "message_id": 42, "message": "Updated text"}

// Pin/unpin message (moderator/admin only)
{"type": "pin_message", "message_id": 42}
{"type": "unpin_message", "message_id": 42}

// Mark channel as read (for unread tracking)
{"type": "mark_read", "message_id": 50}

// Older messages (page before a message), a window around a message, or the newest page again.
// The channel is the one this socket joined; "req" is echoed in the reply. 30 per minute per member.
{"type": "history_page", "before_id": 101, "limit": 50, "req": 7}
{"type": "history_page", "around_id": 42, "req": 8}
{"type": "history_page", "req": 9}

// Access is checked again on every action: message, edit_message, react, create_poll, vote_poll, close_poll,
// delete, pin_message, unpin_message, timeout_user, mute_user, unmute_user and history_page are refused with
// "Channel not found" (or the stream-ban / private-channel text) once the channel has been closed to the member
// since the socket joined; typing is dropped silently. A voice_join gets {"type": "voice_denied", "message": ...}
// instead, and a voice_join with resume gets voice_resume_failed (the held call is dropped). A refused "join"
// leaves the socket in no channel.
//
// Sockets are put out when access is lost (stream made not public, member removed from a private channel, member
// banned from a stream chat, channel made private): the socket is removed from the room, gets one
// {"type": "error", "message": "Channel not found"} frame and nothing more from the room, and its voice call in
// that room ends. The others get user_left and a new users list.

// Typing indicator
{"type": "typing", "channel": "general"}

// Block/unblock a user (hides their messages for you)
{"type": "block_user", "user_id": 5}
{"type": "unblock_user", "user_id": 5}

// Create a poll (2-10 options, optional duration in minutes)
{"type": "create_poll", "channel": "general", "question": "Favorite language?", "options": ["Python", "JavaScript", "Rust"], "allow_multiple": false, "anonymous_votes": false, "duration": 60}

// Vote on a poll (option_index is 0-based)
{"type": "vote_poll", "poll_id": 1, "option_index": 0}

// Close a poll (creator or moderator+)
{"type": "close_poll", "poll_id": 1}

Server Messages

// Channel info (after joining)
{"type": "channel_info", "name": "general", "topic": "..."}

// Message history (newest 50; has_more: older messages exist)
{"type": "history", "channel_id": 3, "messages": [...], "has_more": true}

// Answers to history_page (same message shape as history; see GET /api/chat/channels/{id}/messages)
{"type": "history_older", "req": 7, "channel_id": 3, "messages": [...], "has_more": true, "has_newer": false, "found": true}
{"type": "history_around", "req": 8, "channel_id": 3, "messages": [...], "has_more": true, "has_newer": true, "found": true}
{"type": "history_error", "req": 7, "error_code": "rate_limited", "retry_after": 12}
// error_code: invalid, rate_limited, or not_found (the channel is not readable any more, e.g. removed member)

// New message (includes avatar, nickname, anonymous flag)
{"type": "message", "id": 42, "user_id": 1, "username": "alice", "nickname": "Ali", "role": "user", "anonymous": false, "avatar": {"color": "#3b82f6", "emoji": "🚀"}, "message": "Hello!"}

// Reply message (includes reply_to and reply_preview)
{"type": "message", "id": 43, "user_id": 2, "username": "bob", "message": "Nice!", "reply_to": 42, "reply_preview": {"id": 42, "username": "alice", "message": "Hello!"}}

// User joined/left
{"type": "user_joined", "username": "bob", "role": "user", "anonymous": false}
{"type": "user_left", "username": "bob"}

// Online users list (with profile data)
{"type": "users", "users": [{"user_id": 1, "username": "alice", "nickname": "Ali", "role": "user", "anonymous": false, "avatar": {...}}]}
// New message in a channel you are not joined to (1.19.0): channel id only, no text, no author.
// Sent only to members who may read the channel and whose level and mute allow it; never to the sender.
{"type": "channel_activity", "channel_id": 3}

// @here / @everyone (1.19.0): switch for a channel (staff; the owner of a stream in its own chat), answered to the room
{"type": "set_mass_mentions", "allowed": true}
{"type": "mass_mentions_changed", "channel_id": 3, "allowed": true}
// To the sender only: the message was posted, its @here or @everyone was not carried out (one per 60 seconds unless admin)
{"type": "notice", "code": "mass_mention_limited", "retry_after": 31, "message": "..."}

// Message deleted (deleted_by is null for ordinary members when the message was posted anonymously)
{"type": "message_deleted", "message_id": 42, "deleted_by": 1}
{"type": "messages_pruned", "channel": "general", "ids": [41, 42, 43]}

// Channel renamed (admin action via REST)
{"type": "channel_renamed", "old_name": "dev-talk", "new_name": "engineering"}

// Channel deleted (admin action via REST)
{"type": "channel_deleted", "channel": "old-channel"}

// Reaction update (add or remove)
{"type": "reaction_update", "message_id": 42, "emoji": "👍", "user_id": 1, "username": "alice", "action": "add"}

// Message edited
{"type": "message_edited", "message_id": 42, "new_text": "Updated message", "edited_at": "2026-02-10T12:00:00"}

// Message pinned (mod/admin action)
{"type": "message_pinned", "message_id": 42, "pinned_by": 1, "pinned_by_username": "alice"}

// Message unpinned (mod/admin action)
{"type": "message_unpinned", "message_id": 42}

// Pinned messages list (sent on channel join)
{"type": "pinned_messages", "messages": [{"id": 42, "username": "alice", "message": "Important info", "pinned_at": "..."}]}

// User blocked/unblocked confirmation
{"type": "user_blocked", "user_id": 5, "username": "bob"}
{"type": "user_unblocked", "user_id": 5, "username": "bob"}

// Poll created (includes poll data inline with the message)
{"type": "poll_created", "message": {...}, "poll": {"id": 1, "question": "Favorite language?", "options": ["Python", "JavaScript", "Rust"], "votes": {}, "total_votes": 0}}

// Poll updated (after a vote)
{"type": "poll_updated", "poll_id": 1, "votes": {"0": 3, "1": 5, "2": 2}, "total_votes": 10}

// Poll closed (by creator or moderator)
{"type": "poll_closed", "poll_id": 1}

// Rate limit error (5 messages per 5 seconds)
{"type": "error", "message": "Slow down! You're sending messages too fast."}

DM Client Messages (via /ws/chat)

Direct message operations share the same WebSocket connection as channel chat.

// Open/load a DM conversation
{"type": "dm_open", "conversation_id": 1}

// Create a group DM
{"type": "dm_create_group", "user_ids": [2, 3], "name": "Project Team"}

// Send a DM
{"type": "dm_message", "conversation_id": 1, "message": "Hello!"}

// Typing indicator in DM
{"type": "dm_typing", "conversation_id": 1}

// Delete a DM message
{"type": "dm_delete", "conversation_id": 1, "message_id": 42}

// React to a DM message
{"type": "dm_react", "conversation_id": 1, "message_id": 42, "emoji": "👍"}

// Edit a DM message (within 5-minute window)
{"type": "dm_edit", "conversation_id": 1, "message_id": 42, "message": "Updated text"}

// Mark DM conversation as read
{"type": "dm_mark_read", "conversation_id": 1}

// Load DM history (pagination)
{"type": "dm_history", "conversation_id": 1, "before_id": 100}

DM Server Messages

// Conversation opened (with participant details)
{"type": "dm_conversation_opened", "conversation": {...}}

// Conversations list (on connect or group creation)
{"type": "dm_conversations_list", "conversations": [...]}

// New DM message
{"type": "dm_message", "conversation_id": 1, "id": 42, "user_id": 1, "username": "alice", "message": "Hello!", "created_at": "..."}

// DM typing indicator
{"type": "dm_typing", "conversation_id": 1, "user_id": 1, "username": "alice"}

// DM message deleted
{"type": "dm_message_deleted", "conversation_id": 1, "message_id": 42}

// DM reaction update
{"type": "dm_reaction_update", "conversation_id": 1, "message_id": 42, "emoji": "👍", "action": "add"}

// DM message edited
{"type": "dm_message_edited", "conversation_id": 1, "message_id": 42, "new_text": "Updated", "edited_at": "..."}

// DM message history (paginated)
{"type": "dm_history", "conversation_id": 1, "messages": [...], "has_more": true}

JavaScript Example

const ws = new WebSocket('wss://portal.example.com/ws/chat');

ws.onopen = () => {
  // Join the general channel
  ws.send(JSON.stringify({type: 'join', channel: 'general'}));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === 'message') {
    console.log(`${data.username}: ${data.message}`);
  }
};

// Send a message
ws.send(JSON.stringify({
  type: 'message',
  channel: 'general',
  message: 'Hello everyone!'
}));

Voice Chat

Live voice chat using WebRTC P2P mesh (2-10 users per channel). The server acts purely as a signaling relay — no audio processing or storage. Audio is encrypted via WebRTC DTLS-SRTP. Voice signaling piggybacks on the existing /ws/chat WebSocket.

GET /api/voice/ice-servers Get ICE server configuration

Returns STUN and optional TURN server configuration for WebRTC peer connections.

Response

{
  "ice_servers": [
    {"urls": "stun:stun.l.google.com:19302"},
    {"urls": "turn:turn.example.com:3478", "username": "user", "credential": "pass"}
  ]
}

Voice Signaling (via /ws/chat)

Voice commands are sent as JSON messages on the existing chat WebSocket. Supported client-to-server message types:

TypeFieldsDescription
voice_join room (optional) Join voice in the current text channel, or pass room: "dm:{conversation_id}" for DM voice. Voice in a channel is refused while anonymous mode is on (the server answers voice_denied), and turning anonymous mode on removes the user from a channel voice room the same way. One voice session per account: a second tab is answered with voice_denied. The voice_state reply carries a random resume_token for this join
voice_join (resume) resume: true, room, resume_token Re-attach a new socket to your own voice session after the old socket dropped. Needs the token from the join and the room from voice_state.channel; accepted only for your own account and only while the session is reconnecting or owned by an older socket of yours. The reply is voice_state with resumed: true, or voice_resume_failed
voice_leave room, resume_token (both optional) Leave voice chat (only the socket that owns the session can; the call ends at once, with no reconnect period). With resume_token from the join the leave is accepted from any socket of your own account, also while the session is held after a dropped connection (a Leave clicked while disconnected)
voice_signal target_user_id, signal Forward WebRTC offer/answer/ICE candidate to a specific user
voice_mute muted (bool) Toggle microphone mute state
voice_deafen deafened (bool) Toggle deafen (mute all incoming audio)
voice_speaking speaking (bool) Voice activity indicator (rate-limited to 1/100ms)
voice_kick target_user_id Moderators only. Removes the member from the call for everyone and blocks their rejoin to that room for 60 seconds. The target receives voice_denied with code: "kicked".
voice_server_mute / voice_server_unmute target_user_id Moderators only. Sets or clears a mark everyone receives as voice_server_mute_changed. Advisory: the target client closes its own microphone and shows it. It ends when the member leaves.
voice_lock_room / voice_unlock_room (none) Moderators only. A locked room refuses joiners without moderation power (voice_denied, code locked); everyone receives voice_room_lock_changed. Held in memory: ends when the room empties or the server restarts.

Voice Moderation and the Room Cap

voice_state (join and resume) also carries locked, can_moderate (staff, and in a stream's own chat its owner and stream mods; never in a DM call) and room_cap; each user entry has server_muted. A voice_join is refused with voice_denied carrying a code and a message, sent to the joiner only and nothing to the room: timed_out (timed out or muted in that channel; moderators are exempt), room_full (the room holds voice_room_cap people, default 8, 2 to 25, DM calls included; a resume of a member already in the room is never refused for it), locked (the room is locked and the member has no moderation power), kicked (removed by a moderator less than 60 seconds ago). The moderation frames need a moderation level in that chat (error "Moderator access required"), never act on oneself or on a member of equal or higher level (error "Not allowed") and are refused in a DM call; each change is audited as voice_kick, voice_server_mute, voice_server_unmute, voice_lock or voice_unlock. A timeout or mute in a channel also removes the member from that channel's voice room; the one exception is that a timeout that a stream owner or stream mod placed through an anonymous post does not end a running call (the author is refused with timed_out at their next voice_join). Every voice_signal is dropped unless the sender is in that room and so is the target. Server mute is cooperative, and a kick is enforced against normal clients only: the server cannot cut an existing peer-to-peer link of a modified client. The cap is set with PUT /api/admin/voice (superadmin).

Voice Reconnect

When the socket that owns a voice session closes, the session is kept for 20 seconds. Other members receive voice_user_reconnecting instead of voice_user_left, then voice_user_resumed if the same account resumes in time, or voice_user_left after about 20 seconds. Members that are reconnecting show reconnecting: true in voice_state and voice_reconnecting: true in the users list, receive no voice messages and are skipped when broadcasting. A password reset, role change, account delete, logout, a revoked session or anonymous mode ends a session at once, also while it is being held; making the channel private removes the members who may not stay. Closing a second tab does not affect the call. Audio between browsers does not go through the socket, so a short drop often does not interrupt it; the client re-negotiates only the peers that are no longer connected (an offer with fresh: true). iOS suspends background pages, which still ends a call.

Per-User Volume and Local Mute

Each member can set a playback volume (0 to 200%) and a local mute for every other member of the call they are in. Right-click or long-press a name in the voice bar or the online-users list (or focus it and press Enter, the context-menu key or Shift+F10) to open the popover. Both settings change only what that browser plays. They are stored in that browser's localStorage as voice_peer_prefs_<own user id>, keyed by the other member's user id, and are never sent to the server: there is no endpoint and no WebSocket message for them, and other members cannot see them. Deafen silences everyone whatever the per-user settings are. On iPhone and iPad, and where Web Audio is unavailable, audio plays through the audio element and the slider stops at 100%; iOS Safari may ignore element volume, so there only the local mute is certain to work, and the popover says so when the device refuses a volume. A member who is anonymous in a channel cannot be in a channel call, and the online-users list gives other members no user_id for them, so no setting can be attached to them there; in a direct-message call they appear as "Anonymous" with the account id the call payload already carries.

Voice Modes

Users can choose between two voice activation modes (stored in browser localStorage):

  • VAD (Voice Activity Detection) — Detects speech using AudioContext analysis with a configurable dBFS threshold. The track sent to the other members is disabled while the member is silent and enabled when the level passes the threshold, staying open for 750 ms after the last loud moment. A disabled track carries silence; some browsers still send keep-alive packets.
  • PTT (Push-to-Talk) — Transmit only while holding a configurable key (default: Space), plus an optional release delay of 0 to 1000 ms that keeps the microphone open after the key is released.

Voice Setup (Client Only)

The voice settings window in chat chooses the microphone and, where the browser can set the speaker of an audio context (Chromium browsers), the speaker; it shows a live level meter with the VAD threshold on it, and has an opt-in loopback test that plays the member's own microphone through their own speakers (not available during a call, never sent to anyone). The choices are stored in that browser's localStorage as voice_prefs (mode, pttKey, vadThreshold, pttDelay, inputDeviceId, outputDeviceId), plus the marker voice_gate_notice_seen (value 1) that records that the one-time notice about a strict saved threshold (above -35 dBFS) has been shown, and are never sent to the server: there is no endpoint and no WebSocket message for them, and voice_join, voice_speaking and voice_signal are unchanged. The chosen microphone is used on the next join; changing it during a call replaces the track in each connection with replaceTrack, without a new offer, a voice_leave or a new join, so the resume token stays valid. Outside a call the meter opens the microphone while the settings window is open and releases it when it is closed; during a call it reads the call's own microphone. With a push-to-talk release delay, voice_speaking with speaking: false is sent when the delay ends.

Direct Messages

Private messaging between users with support for 1:1 conversations and group DMs (up to 10 participants). All DM messages are encrypted at rest using AES-256 (Fernet), the same encryption used for channel messages.

Security: All DM messages are encrypted at rest (Fernet). Only conversation participants can access messages. Search results are filtered to the user's own DM conversations. An FTS5 search index (plaintext) is maintained alongside encrypted storage for search functionality.

REST API

GET /api/dm/conversations List conversations

Returns all DM conversations for the authenticated user, ordered by most recent activity. Includes the last message preview and unread count for each conversation.

Response

{
  "conversations": [
    {
      "id": 1,
      "type": "direct",
      "name": null,
      "participants": [
        {"user_id": 1, "username": "alice"},
        {"user_id": 2, "username": "bob"}
      ],
      "last_message": {
        "message": "Hey, are you around?",
        "username": "alice",
        "created_at": "2026-02-11T14:30:00"
      },
      "unread_count": 2,
      "muted": false,
      "created_at": "2026-02-11T10:00:00"
    },
    {
      "id": 2,
      "type": "group",
      "name": "Project Team",
      "participants": [
        {"user_id": 1, "username": "alice"},
        {"user_id": 2, "username": "bob"},
        {"user_id": 3, "username": "charlie"}
      ],
      "last_message": {
        "message": "Meeting at 3pm",
        "username": "charlie",
        "created_at": "2026-02-11T13:00:00"
      },
      "unread_count": 0,
      "muted": false,
      "created_at": "2026-02-10T09:00:00"
    }
  ]
}
POST /api/dm/conversations Create conversation

Create a new DM conversation. For 1:1 conversations, provide user_id. For group DMs, provide user_ids array and an optional name. If a 1:1 conversation already exists with the given user, the existing conversation is returned.

Request Body (1:1)

ParameterTypeDescription
user_id integer Target user ID required

Request Body (Group)

ParameterTypeDescription
user_ids array Array of user IDs to include (max 10 total participants) required
name string Group conversation name required

Response

{
  "id": 3,
  "type": "direct",
  "name": null,
  "participants": [
    {"user_id": 1, "username": "alice"},
    {"user_id": 4, "username": "dave"}
  ],
  "created_at": "2026-02-11T15:00:00"
}
GET /api/dm/conversations/{id} Get conversation details

Returns details for a specific DM conversation. Only accessible by conversation participants.

Response

{
  "id": 1,
  "type": "direct",
  "name": null,
  "participants": [
    {"user_id": 1, "username": "alice", "nickname": "Ali", "role": "user", "avatar": {"color": "#3b82f6", "emoji": "🚀"}},
    {"user_id": 2, "username": "bob", "nickname": null, "role": "admin", "avatar": {"color": "#ef4444", "emoji": "🔥"}}
  ],
  "muted": false,
  "created_at": "2026-02-11T10:00:00"
}
GET /api/dm/conversations/{id}/messages Get conversation messages

Returns messages for a DM conversation with pagination support. Messages are returned in reverse chronological order (newest first). Only accessible by conversation participants.

Query Parameters

ParameterTypeDescription
limit integer Number of messages to return (default: 100)
before_id integer Return messages before this message ID (for pagination)

Response

{
  "messages": [
    {
      "id": 150,
      "user_id": 1,
      "username": "alice",
      "nickname": "Ali",
      "avatar": {"color": "#3b82f6", "emoji": "🚀"},
      "message": "Hey, are you around?",
      "created_at": "2026-02-11T14:30:00"
    },
    {
      "id": 149,
      "user_id": 2,
      "username": "bob",
      "nickname": null,
      "avatar": {"color": "#ef4444", "emoji": "🔥"},
      "message": "Sure, what's up?",
      "created_at": "2026-02-11T14:29:00"
    }
  ],
  "has_more": true
}
POST /api/dm/conversations/{id}/mute Toggle conversation mute

Mute or unmute a DM conversation. Muted conversations do not generate notifications. Only accessible by conversation participants.

Request Body

ParameterTypeDescription
muted boolean Set to true to mute, false to unmute required

Response

{
  "success": true,
  "muted": true
}
POST /api/dm/conversations/{id}/leave Leave group conversation

Leave a group DM conversation. Only available for group conversations (not 1:1). The conversation remains for other participants. Only accessible by conversation participants.

Response

{
  "success": true
}
POST /api/dm/conversations/{id}/participants Add participants to group

Add users to an existing group DM conversation. Only available for group conversations. Total participants cannot exceed 10. Only accessible by existing conversation participants.

Request Body

ParameterTypeDescription
user_ids array Array of user IDs to add (max 10 total participants) required

Response

{
  "success": true,
  "participants": [
    {"user_id": 1, "username": "alice"},
    {"user_id": 2, "username": "bob"},
    {"user_id": 3, "username": "charlie"},
    {"user_id": 5, "username": "eve"}
  ]
}

Full-text search across chat channel messages and DM conversations. Powered by SQLite FTS5 for fast, ranked results. Search respects access control — users can only find messages in channels they have access to and DM conversations they participate in.

Privacy Note: An FTS5 plaintext search index is maintained alongside the encrypted message storage to enable search functionality. The search index contains message text in plaintext for indexing purposes. Search results are always filtered to the authenticated user's accessible messages.
GET /api/chat/search Search messages

Search across channel messages and DM conversations. Rate limited to 10 requests per minute per user (a request refused for a bad query or parameter does not count). The search fails closed: if the readable channels cannot be worked out, the answer is 503 {"error": "Search is unavailable right now"} and nothing is searched. Channel results cover only the channels the caller may read: a private channel needs membership (admins and superadmins search every channel), and the chat of a stream that is not public (is_public off) is searched only for the stream's owner and admins, the rule of the channel history. The text of q holds words and operators.

Query Parameters

ParameterTypeDescription
q string Words and operators (2-200 characters), see below required
scope string Search scope: all (default), channels, or dms
channel_id integer Limit search to a specific channel (1 to 9223372036854775807; any other value answers 400)
conversation_id integer Limit search to a specific DM conversation (same range as channel_id)
from, has, before, after string The older way to give those operators; they go through the same checks as in q
limit integer Results per page (default: 25, max: 50)
offset integer Pagination offset (default: 0, at most 2000; a larger value answers 400 with offset must not exceed 2000)

Operators in q

OperatorMeaning
from:name, -from:nameAuthor by account name or nickname (any case); - leaves that author out
in:channel, -in:channelChannel by name (a leading # is ignored); - leaves it out. DMs are not searched when in: is given
has:link, has:file, has:imageText with an http(s) address; an attachment that is not an image; an image or image attachment
is:pinnedPinned channel messages (no DM results)
before:YYYY-MM-DD, after:YYYY-MM-DDCreated before the start of that day, or from the start of that day (UTC)
"two words"A phrase

Anything else is a word that must appear. A query of only operators is allowed: newest first, at most 200 results in total (capped). 12:30 and https://example.com are searched as text; any other name:value is an unknown operator — put such text in double quotes. An unknown operator or value, a bad date, a negated operator other than from: and in: or more than 10 operators answer 400 with a message in error. An in: naming a channel you cannot read matches nothing, exactly like a channel that does not exist.

Word queries are ordered newest first when scope is all (the default), so offset pages through every match once; with scope=channels or scope=dms they are ordered by relevance.

A positive from: never matches an anonymous post for an ordinary member, and a negated -from: never removes one, so neither the filter nor a count shows who wrote it. Moderators and admins, who already receive the author id, can match it. Results are masked exactly like channel history.

Response

{
  "results": [
    {
      "id": 42,
      "source": "channel",
      "source_id": 1,
      "source_name": "#general",
      "message": "Has anyone tried the new deployment script?",
      "username": "alice",
      "display_name": "Ally",
      "user_id": 1,
      "anonymous": false,
      "has_image": 0, "has_file": 0, "has_link": 0,
      "is_pinned": 0,
      "created_at": "2026-02-11T12:00:00+00:00"
    },
    {
      "id": 88,
      "source": "dm",
      "source_id": 3,
      "source_name": "bob",
      "user_id": 2,
      "username": "bob",
      "message": "I deployed it yesterday, works great",
      "created_at": "2026-02-11T12:05:00+00:00"
    }
  ],
  "total": 2,
  "has_more": false,
  "capped": false,
  "query": "deploy",
  "terms": ["deploy"],
  "operator_only": false,
  "index_complete": true
}

An anonymous post has username and display_name "Anonymous", and user_id, role and nickname null for ordinary members. To open a channel result in context, call GET /api/chat/channels/{source_id}/messages?around_id={id}. total stops at 200 for operator-only queries (capped). has_more is false once offset plus the number returned reaches 200, so following it pages through all 200 results and stops; an offset of 200 or more answers an empty list without reading any rows. has_more is also false when offset plus the number returned is above 2000 (the offset limit), even if more matches exist, because the next page would be refused with 400. index_complete is false until the one-time backfill of the link and file flags for older messages has finished; until then has: queries can miss old messages.

Notifications

Real-time notification system for stream events, service alerts, and security events. Notifications are delivered via polling and displayed in the navbar bell icon.

GET /api/notifications Get user notifications

Returns notifications for the authenticated user with an unread count.

Query Parameters

ParameterTypeDescription
unread string Set to 1 to return only unread notifications

Response

{
  "notifications": [
    {
      "id": 1,
      "type": "stream_live",
      "title": "alice is live!",
      "message": "Gaming Session just went live",
      "data": {"stream_id": 5, "streamer": "alice", "title": "Gaming Session", "url": "https://portal.example.com/watch/5"},
      "is_read": false,
      "created_at": "2026-02-08T12:00:00"
    }
  ],
  "unread_count": 3
}
POST /api/notifications/{id}/read Mark notification as read

Mark a single notification as read. Only affects notifications owned by the authenticated user.

Response

{
  "success": true
}
POST /api/notifications/read-all Mark all notifications read

Mark all notifications as read for the authenticated user.

Response

{
  "success": true,
  "count": 5
}

User Blocking

Block other users to hide their messages and prevent them from sending you DMs. Blocking is bidirectional for DMs — neither party can message the other while a block is active.

GET /api/users/blocked List your blocked users

Returns the list of users you have blocked. Scoped to the authenticated user.

Response

{
  "blocked_users": [
    {"id": 5, "username": "bob", "blocked_at": "2026-02-13T10:00:00"}
  ]
}
POST /api/users/{id}/block Block a user

Block a user by their ID. You cannot block yourself. Blocked users' messages are hidden in chat and DMs are prevented bidirectionally.

Response

{
  "success": true
}
DELETE /api/users/{id}/block Unblock a user

Remove a user from your block list.

Response

{
  "success": true
}

WebSocket Integration

Blocking can also be managed via the /ws/chat WebSocket. Send block_user or unblock_user messages and receive confirmation events. Blocked users' messages are filtered client-side.

Polls

Create inline polls in chat channels. Polls support 2-10 options, optional multi-vote, anonymous voting, and time limits. All poll operations use the /ws/chat WebSocket.

Poll Constraints

FieldLimit
Question length500 characters max
Option count2-10 options
Option length200 characters max per option
DurationOptional, in minutes (poll auto-closes when expired)

WebSocket Messages

Polls are created, voted on, and closed via the chat WebSocket. See the Chat WebSocket API section for the full message format. Key message types:

Client TypeDescriptionAuth
create_pollCreate a new poll in a channelAny user (timeout/mute checked)
vote_pollCast a vote (option_index is 0-based)Any user
close_pollClose a poll earlyPoll creator or Moderator+
Server TypeDescription
poll_createdNew poll broadcast with message and poll data
poll_updatedUpdated vote counts after a vote
poll_closedPoll has been closed

Channel Permissions

Control channel visibility and send permissions. Channels can be public (visible to all) or private (members only), and open (everyone can send) or readonly (only moderators and channel moderators can send).

Channel Properties

FieldValuesDescription
visibilitypublic / privateWho can see and join the channel
modeopen / readonlyWho can send messages

Chat User Search

GET /api/chat/users Search users for DMs and member management

Lightweight user search accessible to all authenticated users. Returns basic info only (id, username, nickname). Used for DM creation and channel member management.

Query Parameters

qSearch query (matches username or nickname, case-insensitive)

Response

{
  "users": [
    {"id": 2, "username": "alice", "nickname": "Ali"},
    {"id": 3, "username": "bob", "nickname": null}
  ]
}

Channel Members

GET /api/chat/channels/{id}/members List channel members

List members of a channel. Visible to channel members and moderators+.

Response

{
  "members": [
    {"user_id": 2, "username": "alice", "role": "moderator", "added_at": "2026-02-13T10:00:00"},
    {"user_id": 3, "username": "bob", "role": "member", "added_at": "2026-02-13T10:05:00"}
  ]
}
POST /api/chat/channels/{id}/members Add a channel member

Add a user as a member of a private channel. Requires admin, channel creator, or channel moderator role. Since 1.24.2 the body must be a JSON object, and a user_id that is not a number or is out of range answers 400 (it answered 500).

Request Body

{
  "user_id": 5
}

Response

{
  "success": true
}
PUT /api/chat/channels/{id}/members/{user_id} Update member role

Change a channel member's role (member or moderator). Requires admin or channel creator.

Request Body

{
  "role": "moderator"
}
DELETE /api/chat/channels/{id}/members/{user_id} Remove a channel member

Remove a user from a private channel. Requires admin, channel creator, or channel moderator role.

Response

{
  "success": true
}

Webhooks

Webhooks let you receive real-time HTTP notifications when events happen in your portal (outgoing), or post messages into chat channels from external services (incoming). Since 1.24.1 the owner's role is read at every delivery: when the owner stops being an administrator the owner's hooks are switched off (kept) and nothing is sent, an incoming hook's token answers 404, and turning one on is refused with 409 while its owner is not an administrator. System hooks are not affected. Outgoing webhooks sign payloads with HMAC-SHA256 for verification. Stream keys are refused (403) on every webhook route. Creating, changing or deleting a webhook and getting a new signing secret need a browser session or an all-scope (*) token or API key; a narrowly scoped key can only list, read and view logs of its own webhooks (testing a webhook triggers a delivery and needs a full-scope credential too). The URL token of an incoming webhook is returned at creation and afterwards only to the webhook's owner using a full-scope credential, never to an administrator reading another user's webhook or to a narrowly scoped key, and an administrator's narrowly scoped key never reaches other users' webhooks (that needs the admin or * scope). Webhook URLs, secrets, and delivery log payloads are encrypted at rest. Admin+ required for management.

POST /api/webhooks Create webhook

Create an outgoing or incoming webhook. Maximum 25 webhooks per user. The webhook secret is returned only once on creation.

Request Body

ParameterTypeDescription
name string Webhook name (1-100 chars) required
type string outgoing or incoming required
url string Delivery URL (outgoing only, HTTPS required, SSRF-protected) required for outgoing
events array Events to subscribe to (outgoing only): message.created, message.deleted, stream.live, stream.offline, user.joined, user.connected, user.disconnected required for outgoing
channel_id integer Target channel for incoming webhook messages required for incoming

Response

{
  "id": 1,
  "name": "My Webhook",
  "type": "outgoing",
  "url": "https://example.com/hook",
  "secret": "abc123...",
  "events": ["message.created"],
  "enabled": true,
  "token": null
}

Note: The secret field is only returned on creation. Store it securely for HMAC verification.

GET /api/webhooks List webhooks

List your webhooks. Admins see all webhooks with owner usernames. Secrets are never returned in list responses.

{
  "webhooks": [
    {
      "id": 1,
      "name": "My Webhook",
      "type": "outgoing",
      "url": "https://example.com/hook",
      "has_secret": true,
      "events": ["message.created"],
      "enabled": true,
      "consecutive_failures": 0,
      "created_at": "2026-02-19 12:00:00"
    }
  ]
}
GET /api/webhooks/{id} Get webhook details

Get details for a specific webhook. Owner or admin required.

PUT /api/webhooks/{id} Update webhook

Update webhook name, URL, events, channel, or enabled status. URL changes are SSRF-validated. Owner or admin required.

Request Body

ParameterTypeDescription
namestringNew name
urlstringNew delivery URL (outgoing only)
eventsarrayUpdated event list
channel_idintegerNew target channel (incoming only)
enabledbooleanEnable/disable webhook
DELETE /api/webhooks/{id} Delete webhook

Delete a webhook and all its delivery logs. Owner or admin required.

GET /api/webhooks/{id}/logs Delivery logs

View delivery logs for a webhook. Includes request payload, response status, success/failure, attempt number, and duration. Logs are encrypted at rest and auto-cleaned after 7 days.

Query Parameters

ParameterTypeDescription
limitintegerMax results (default 50, max 100)
offsetintegerPagination offset
POST /api/webhooks/{id}/test Send test event

Send a webhook.test event to verify your webhook endpoint is working. Owner or admin required. Since 1.24.1 it answers 400 and sends nothing for a user hook whose owner is no longer an administrator, the rule delivery already follows.

POST /api/webhooks/{id}/regenerate-secret Regenerate HMAC secret

Generate a new HMAC signing secret. The new secret is returned only once. The old secret is immediately invalidated.

POST /api/webhooks Notification formats: ntfy, Gotify, Discord, Slack

Outgoing webhooks take a format: generic (default, unchanged, HMAC-signed), ntfy, gotify, discord or slack. The other formats are not signed and need no secret. A hook in another format stores no signing secret; changing it to generic creates one (read it with regenerate-secret) and changing it away from generic removes it. They send an event title, a one-line summary and the portal name only; include_details (default false) adds a short allow-listed set of fields of the event, for alert events also the address and user agent involved; never email addresses or tokens. Message text is cut to 200 characters and mentions are removed (Discord payloads set allowed_mentions to none, and markdown link and formatting syntax in Discord text is escaped so [text](url) shows as typed). Redirects are not followed and HTTPS is required unless allow_private is on, at delivery as well as when the hook is saved.

ParameterTypeDescription
formatstringgeneric, ntfy, gotify, discord, slack
format_configobjectWrite-only credentials: Gotify {"token"} (required), ntfy {"token"} or {"username","password"}. Stored encrypted, never returned (responses show has_format_secret). An edit that omits it keeps the stored value, unless the same edit moves the hook to a new scheme, host or port (or switches allow_private off while changing the URL): then the stored credentials are dropped, and Gotify is refused with 400 until the token is sent again.
include_detailsbooleanAdd the detail fields of the event (default false)
allow_privatebooleanLet the hook reach loopback and LAN addresses, for a self-hosted ntfy or Gotify (default false). Only a superadmin with a browser login session can turn it on (a request that authenticates by API key or bearer token never can, whatever cookie it also carries); any editor can turn it off, and turning it off is never re-checked against the address. Plain http:// is accepted only when every resolved address is private or loopback. Link-local, cloud metadata, 0.0.0.0/8 and the portal's own ports stay blocked. Since 1.24.1 the services the portal runs are blocked too: the ports a managed service names (MediaMTX, the search backend and others) and every port a child process of the portal listens on, on loopback and this host's own addresses. A destination the administrator lists as address:port in WEBHOOK_LOCAL_ALLOW in .env (IP addresses only, read at start) is let through; the portal's own port never is. A hook is re-checked against the default policy only when it is created, when its URL or format changes, or when allow_private is switched on; saving it with the same URL and format (rename, disable, other events, allow_private off) is never refused for the address.

For a non-generic hook the destination URL is never returned: responses carry url: null, url_set, url_host (scheme and host) and has_format_secret. Changing the format of such a hook to generic needs a new url in the same request (otherwise 400), because the URL of a generic hook is returned.

The stream.live payload (1.16.0): data has stream_id, stream_name, owner_username, streamer (nickname, else username), title, game (1.17.0, empty when none), url (the logged-in watch page, <base>/watch/<id>, built from PUBLIC_BASE_URL or HOSTNAME, never from a request header) and message (the owner's go-live message, filled in). public_key is no longer part of it, and no payload carries a stream key, a pub_ key, an RTMP address or a path. A stream is announced at most once per 10 minutes. For a stream that is not public, stream.live and stream.offline go only to system hooks in the generic format, never to a member's own hook or a non-generic hook. In the non-generic formats the streamer, title, message and watch URL appear only with include_details on.

message.created, user.connected and user.disconnected reach a non-generic hook only when listed by name (* does not include them); the two presence events are never sent for a member whose status preference is appear-offline. A user hook can subscribe only to the documented events (any other event is system-only). The generic format receives full event payloads, including the text of messages in private channels, so point it only at a receiver you control. Two rules hold for every format, generic included: the presence events are sent to no hook for a member who appears offline, and an anonymous post's message.created carries user_id: null (message.deleted carries deleted_by: null when the author deleted it). message.created goes only for channels an ordinary member can read (never private channels or the chat of a stream that is not public; anonymous posts show as "Anonymous"). stream.live and stream.offline are sent only for public streams.

A 429 answer waits for Retry-After (capped at 10 minutes, at most 3 waits in all for one delivery, retries after a failure included; the hook is checked again after each wait and nothing more is sent if it was switched off, deleted, changed or unsubscribed meanwhile) and never counts toward the automatic disable after 10 failures. A delivery refused by policy before anything is sent (a non-generic hook over plain http:// with allow_private off) sets the hook's last failure reason to a fixed text without the URL and counts toward those 10 at most once per hour.

POST /api/webhooks/{id}/test Test: sample in the hook's format, receiver status returned

Sends one sample in the chosen format and waits for the receiver. The answer is {"message", "format", "sent", "success", "status", "error"}; status is the receiver's HTTP status code (a 429 is reported at once). Disabled hooks answer 400. Records of non-generic hooks hold no payload and no response body.

GET /api/admin/webhooks System webhooks (superadmin)

System webhooks have no owner and are managed by superadmins only (Admin > Webhooks). System-only events (webhook.test and the alert events below) go to system webhooks only, never to user webhooks, not even through *. They are not reachable through /api/webhooks/{id}.

RoutePurpose
GET /api/admin/webhooksList, plus formats, events, system_only_events, alert_groups
POST /api/admin/webhooksCreate (fields as above, events required, at most 20)
GET, PUT, DELETE /api/admin/webhooks/{id}Read, update (also enabled), delete
GET /api/admin/webhooks/{id}/logsRecent deliveries: event, status code, time; never payloads
POST /api/admin/webhooks/{id}/testTest, as above
POST /api/admin/webhooks/{id}/regenerate-secretGeneric format only

Alert events

Sixteen ops, security and moderation events in three groups (Security, Operations, Moderation) go to system webhooks that list them by name: * never includes an alert, a user hook cannot subscribe to one, and nothing is subscribed by default. Security: auth.login_failed_burst, 2fa.disabled, apikey.created, role.changed, ip.blocked. Operations: update.available, service.health_changed, cert.expiring, cert.renewal_failed, gameserver.crashed, backup.ok, backup.failed, vod.recording_stopped, alerts.suppressed. Moderation: moderation.action, automod.triggered. vod.recording_stopped is sent when the VOD disk guard stops a running recording or refuses to start one: once per recording and reason, a refused start once per stream and reason per hour; the live stream is never interrupted.

Generic body: data holds title, summary, severity, group, and details only for a hook with include_details (addresses, user agents, reasons, rule names). A member who posts anonymously is never named. All alerts together are capped at 33 per 10 minutes, and an alerts.suppressed notice is due whenever an alert is held back (it counts in the window); an alert event dropped for a system webhook that is waiting out a 429 from its receiver is counted too, with the reason "receiver asked to slow down". What a stranger or an ordinary member can set off has a smaller cap of its own in the same window: 5 auth.login_failed_burst and 5 automatic-block ip.blocked alerts per 10 minutes, 5 in all for the moderation alerts any signed-in member can set off (moderation.action and automod.triggered share that one cap), 3 2fa.disabled and 2 apikey.created (a cap each), so they cannot use up the room of the other alerts or of each other. They bind only alerts caused by non-staff accounts: an alert whose actor is a moderator, admin or superadmin, one about a staff account, and every operations alert bypass them (own cooldown and the global cap only), and the global cap keeps a reserve of 10 of the 33 for them. The one exception is the failed-sign-in burst against a staff account name (a stranger can set it off): it may use at most 5 of the 10 reserved slots in a 10-minute window (it is held back once 28 of the 33 slots are used). The first alerts.suppressed notice is sent 30 seconds after the first alert is held back, then at most one per 10 minutes; each names every kind held back since the previous notice with its count (the commonest first; kinds that do not fit are counted as "and N more kinds") and the limit that held it back (global limit, reserve or per-kind limit), then clears those counts. It is never held back by a cap and goes to every system hook with any alert event subscribed. Wrong second-factor codes count toward auth.login_failed_burst, and a burst held back is still written once to the security event log. A moderation or automod alert from a private channel, a conversation or a non-public stream chat says "in a private channel" in the ntfy, Gotify, Discord and Slack formats, with no channel or stream name even in the details. A backup whose extra copy failed sends backup.failed, not backup.ok. role.changed rests 60 seconds per account and role change.

RoutePurpose
GET /api/admin/alertsEvent groups and the in-portal notification switches
PUT /api/admin/alerts/notifyBody {"event", "enabled"}: also notify every administrator inside the portal
POST /api/webhooks/incoming/{token} Post incoming webhook message

Post a message to a chat channel via an incoming webhook. No authentication required — the token in the URL acts as the credential. Rate limited to 10 messages per 60 seconds per token.

Request Body

ParameterTypeDescription
content string Message content (1-4000 chars) required
username string Display name override (max 50 chars, defaults to webhook name)

Outgoing Webhook Payload Format

Outgoing webhooks receive a signed JSON POST with this structure:

{
  "event": "message.created",
  "timestamp": "2026-02-19T12:00:00Z",
  "data": {
    "message_id": 123,
    "channel_id": 1,
    "channel_name": "general",
    "user_id": 10,
    "username": "alice",
    "content": "Hello world"
  }
}

Headers:
  X-Portal-Signature: sha256=abc123...
  X-Portal-Event: message.created
  Content-Type: application/json

Verify the signature by computing HMAC-SHA256(secret, request_body) and comparing with the X-Portal-Signature header value.


Embedded Browser

Portal's embedded browser provides a tabbed browsing experience for HTTP/HTTPS connections (http_proxy plugin type). It includes navigation controls (back, forward, refresh), an address bar, tabbed browsing (Ctrl+T/W/Tab), and multi-site navigation for browser-mode connections. A default "Web Browser" connection is created for all users; its home page is Portal's own private search (SearXNG at /search/) when that managed service is enabled, or DuckDuckGo otherwise. Connection IDs use opaque string tokens.

GET /browser?connection={id} Open embedded browser for HTTP proxy connection

Opens the embedded browser page for browsing a remote web service through Portal. Requires authentication. The connection must use the http_proxy plugin type (includes http, https, http_proxy, and all web panel connection types such as Home Assistant, Grafana, Portainer, etc.). Connections with browser_mode: true support multi-site navigation to any website.

Query Parameters

ParameterTypeDescription
connectionstringConnection ID (opaque token) required

Notes

  • This is the user-facing page for HTTP/HTTPS connections. When users click Connect on a web-type connection, they are directed here.
  • Supports tabbed browsing (Ctrl+T new tab, Ctrl+W close, Ctrl+Tab switch), keyboard shortcuts (Alt+arrows, Ctrl+L, Ctrl+R), and middle-click to close tabs.
  • Browser-mode connections can navigate to any website. The address bar accepts full URLs, bare hostnames (auto-prefixed with https://), and relative paths.
  • The default "Web Browser" connection opens on Portal's private search (SearXNG) when enabled. From there, an external result opens a new tab inside the embedded browser (browser-mode, through the proxy) or a real browser tab (single-origin). An explicit config.home_url (same-origin path) sets a custom home page.
  • The window is session-aware: it polls /api/me and watches for a /login redirect, and navigates itself to /login when the session ends.
  • All proxied traffic is routed internally through /proxy/{connection_id}/{path}. Users should use /browser?connection={id} rather than accessing /proxy/ directly.
  • The embedded browser rewrites links and intercepts navigation (forms, fetch, XHR, WebSocket, Location.assign/replace, history API) to keep all traffic within Portal's proxy layer.
GET /proxy/{connection_id}/{path} Reverse proxy passthrough (internal)

Proxies HTTP requests to the backend service configured for the given connection. This endpoint is used internally by the embedded browser and should not be accessed directly by users. Use /browser?connection={id} instead for the full browsing experience with navigation controls.

Path Parameters

ParameterTypeDescription
connection_idstringConnection ID (opaque token) required
pathstringPath to proxy to the backend service

Behavior

  • Forwards all HTTP methods (GET, POST, PUT, DELETE, etc.) to the backend
  • Proxies WebSocket upgrade requests for real-time features
  • Enforces TLS for connections to HTTPS backends
  • In browser mode, the path encodes the full target URL (e.g., /proxy/{id}/https://example.com/page) for multi-site navigation
  • Localhost and private IPs are blocked for browser-mode targets
  • Portal session cookies and Authorization headers are stripped from upstream requests
  • The upstream always receives X-Forwarded-For and X-Real-IP (the client's address, resolved the same way as for rate limiting), X-Forwarded-Proto (the scheme the client used, believed from CF-Visitor / X-Forwarded-Proto only when they come from a trusted proxy), and, only when the connection has forwarded_host on (default off), X-Forwarded-Host (the portal's configured host name, never a name the client chose) and X-Forwarded-Prefix (/proxy/{id}). A ?token= query parameter that authenticated the request is removed before it is forwarded. Copies of these headers sent by the client are never passed on, nor are CF-Connecting-IP, True-Client-IP, X-Client-IP, Authorization, the portal session cookie, X-API-Key or X-Stream-Key, even when forward_headers matches them. In browser mode only X-Forwarded-Proto is sent, so the sites a member visits learn nothing about the member or the portal.
  • Upstream redirects are followed by the portal itself (at most 5 hops, every hop dialled through the outbound host policy); a Set-Cookie from an intermediate hop is not passed on, and no further hop is made once the member's session was revoked. In browser_mode the 3xx goes to the browser instead, with its Location kept under that site's own path (a protocol-relative //host/path names that host, with the current site's scheme). A Location that still reaches the browser from a single-site connection is kept under /proxy/{id}/, except one on the upstream's host with another scheme or port, which is returned unchanged
  • Every upstream Set-Cookie is kept: each Path is moved under the proxy path, a missing Path becomes the proxy root, and Domain is removed so the browser stores the cookie. In browser_mode the path is that of the site, so one site's cookies are never sent to another. An upstream cookie named like the portal's own session cookie is dropped
  • The connection's timeout (5-300 s, default 60) is the longest the upstream may stay silent; connecting is limited to 10 s. A download passed through as it arrives has no total time limit; a response rewritten in memory (HTML, CSS, JavaScript, JSON) must arrive within this time in total. A silent upstream gives 504. Revoking the member's sessions (also signing out, or revoking one session or an API key) ends the in-progress downloads opened with them
  • Requires authentication — only the connection owner can access their proxy routes

SFTP Browser

Browse and manage files on remote servers via your existing SSH/SFTP connections. Per-user access -- only connections you own are accessible. Ephemeral connections are opened per-request.

Host key check: if the server's SSH host key is not pinned yet or has changed, every route below answers 409 with a type: "host_key" body (see host_key refusal under User Connections and POST /api/connections/{id}/host-key/accept). No credential is sent to the server in that case.
GET /api/sftp/{conn_id}/list List remote directory

List remote directory contents.

Query Parameters

ParameterTypeDescription
pathstringRemote directory path (default: /)
GET /api/sftp/{conn_id}/read Read remote text file

Read remote text file for editing. Maximum file size: 5MB.

Query Parameters

ParameterTypeDescription
pathstringRemote file path required
GET /api/sftp/{conn_id}/download Download remote file

Download a remote file as a streaming attachment.

Query Parameters

ParameterTypeDescription
pathstringRemote file path required
POST /api/sftp/{conn_id}/upload Upload to remote server

Upload a file to the remote server via multipart form data.

Form Fields

ParameterTypeDescription
pathstringDestination directory path required
filefileFile to upload required
POST /api/sftp/{conn_id}/write Write remote text file

Request Body

ParameterTypeDescription
pathstringRemote file path required
contentstringFile content required
POST /api/sftp/{conn_id}/mkdir Create remote directory

Request Body

ParameterTypeDescription
pathstringRemote directory path to create required
POST /api/sftp/{conn_id}/rename Rename or move remote path

Request Body

ParameterTypeDescription
old_pathstringCurrent remote path required
new_pathstringNew remote path required
DELETE /api/sftp/{conn_id}/delete Delete remote file or directory

Delete a remote file or empty directory.

Query Parameters

ParameterTypeDescription
pathstringRemote path to delete required

SFTP VOD Storage

Manage VOD files on your configured SFTP VOD storage server. These endpoints operate on your personal VOD storage connection (configured via the VOD Storage settings in the dashboard). Any user with VOD storage configured can use these endpoints with a browser session or a full-scope credential (an all-scope * token or API key); stream keys and scoped keys get 403.

GET /api/sftp/vod/list List VOD storage directory

List contents of a directory on the VOD SFTP storage.

Query Parameters

ParameterTypeDescription
pathstringRemote directory path (default: /)
GET /api/sftp/vod/read Read VOD storage file

Read a text file from VOD SFTP storage.

Query Parameters

ParameterTypeDescription
pathstringRemote file path required
GET /api/sftp/vod/download Download VOD storage file

Download a file from VOD SFTP storage as a streaming attachment.

Query Parameters

ParameterTypeDescription
pathstringRemote file path required
POST /api/sftp/vod/mkdir Create VOD storage directory

Request Body

ParameterTypeDescription
pathstringRemote directory path to create required
POST /api/sftp/vod/upload Upload to VOD storage

Upload a file to VOD SFTP storage via multipart form data.

Form Fields

ParameterTypeDescription
pathstringDestination directory path required
filefileFile to upload required
POST /api/sftp/vod/write Write file to VOD storage

Request Body

ParameterTypeDescription
pathstringRemote file path required
contentstringFile content required
POST /api/sftp/vod/rename Rename VOD storage file

Request Body

ParameterTypeDescription
old_pathstringCurrent remote path required
new_pathstringNew remote path required
DELETE /api/sftp/vod/delete Delete VOD storage file

Delete a file or empty directory from VOD SFTP storage.

Query Parameters

ParameterTypeDescription
pathstringRemote path to delete required

System Health ADMIN

Detailed system resource monitoring including CPU, memory, disk, and Portal process metrics.

Activity Feed ADMIN

Recent activity log. Admins see all activity; regular users see only their own actions.

GET /api/activity Get recent activity

Returns recent activity entries. Admins see all activity; regular users see only their own.

Query Parameters

ParameterTypeDescription
limit integer Max entries to return, 1-50 (default: 20)

Response

{
  "activities": [
    {
      "id": 1,
      "user_id": 10,
      "username": "john",
      "action": "stream_started",
      "details": "Started streaming",
      "created_at": "2026-02-08T12:00:00"
    }
  ]
}

Certificate Management ADMIN

Manage TLS certificates via the admin panel or API. Supports custom uploads, self-signed generation, and Let's Encrypt automation.

Server Settings ADMIN




Data Retention ADMIN

Configure automatic cleanup policies for chat messages, notifications, activity logs, and service logs. Protects against database bloat while preserving recent data.

Backups SUPERADMIN

Backup archives hold the database, .env, the encryption salt and the invite code, so they are as sensitive as root access to the portal. All five routes need a superadmin whose credential carries admin power: stream keys and narrowly scoped API keys or tokens get 403. Download, delete, changing the extra destination and lowering the number of archives to keep also need the superadmin's own browser login session: an API key, bearer token or ?token= value gets 403 with A browser login session is required.

IP Blocking and Never-Ban List ADMIN

Blocked IPs are rejected app-wide (every page and API call) before authentication. Admin routes need a credential with admin power; the never-ban list and the Cloudflare setting are changed by a superadmin only. An automatic block never overwrites or shortens a manual block, never shortens an automatic one and never turns a permanent block into a timed one; it only replaces a row whose own expiry has passed. Failed sign-ins (see PUT /api/admin/login-ban) and, when PROBE_BLOCK_STRIKES is on, scanner probes write automatic blocks with kind login or probe, always with an expiry. Stop the portal and run sudo venv/bin/python server.py unblock <ip> or clear-bans to lift a block while locked out (no migration is run; the output lists what was removed; both also delete the escalation history).

Audit Log MODERATOR+

View a chronological record of all moderation actions performed on the server. Includes message deletions, user timeouts/mutes/bans, channel operations, role changes, and automod triggers. Available to moderators and above.

Maintenance and Announcements

A service or a connection can be put in maintenance by an administrator (maintenance, maintenance_until, maintenance_message on POST and PUT /api/services and /api/connections; on /api/connections a member's copies of them are ignored, not refused, so a read followed by a write works, and an unchanged end time that has passed is accepted from an administrator; every answer that returns the object has these and maintenance_active). A member who has access then gets 503 with Retry-After (the time left, at most 300 seconds) and a page that says "Down for maintenance until 20:00 UTC" with the message (JSON with maintenance: true, until and message for an API-style request) from /proxy, /browser, /search, the terminal, VNC, media, SPICE, Proxmox and GitHub pages, /api/connections/{id}/connect, /api/sftp/{id}/... and, before the upgrade, the WebSockets. Administrators pass; someone without access gets what they always got. An end time that has passed stops applying with no clean-up.

GET /api/announcements Active announcements for a signed-in member

Returns {"announcements": [{"id": 3, "level": "outage", "body": "text", "updated_at": "...", "ends_at": null}]}. body is plain text as stored; pages show a safe subset (bold, italic, code, http and https links, line breaks) built with DOM nodes. A dismissal is remembered in the browser by id and updated_at, so an edit shows again.

GET /api/announcements/public Announcements shown before sign-in

No credential. Only active announcements an administrator ticked "show before sign-in" for (none by default). The answer is kept in memory for 5 seconds; creating, editing, ending or deleting an announcement drops it at once, and a start or end time that passes shows at most 5 seconds late.

Session Recordings ADMIN

Recorded terminal and SSH sessions (asciicast v2). Only administrators (role admin or superadmin) can use these routes, with a browser session or an all-scope (*) bearer token. Anyone else who is signed in gets 404 for every route and every id, a request without a credential gets 401, and every API key (also one made with *) and every narrowly scoped token gets 403: no existing scope covers recordings. A file name or path is never returned. Recording is off per connection unless its config has "recording" set to true, 1, "1" or "true" (any case), and only an administrator can set or clear that flag (a member's value is ignored without an error); it is also limited by the recordings disk budget (setting recording_max_total_mb, free-space floor). Input is never recorded.

Security Events SUPERADMIN

A separate log of authentication and credential events. It has its own table because the audit log needs a signed-in actor and cannot hold a failed login for an unknown user; its rows are kept when an account is deleted. Reading and exporting need the superadmin role on a credential with admin scope; others get 403. Backup runs, downloads, deletes and settings changes stay in the audit log only.

Auth events: login_success, login_failed (result unknown_user or bad_password), 2fa_required, 2fa_passed, 2fa_failed, 2fa_throttled, backup_code_used, logout, session_revoked (result own, others or admin_all for the sessions page and the admin sign-out), register_failed. Security events: 2fa_enabled, 2fa_disabled, 2fa_disable_failed, api_key_created, api_key_revoked, api_key_deleted, password_changed, password_change_failed, password_reset, user_created, user_deleted, role_changed, invite_created, invite_deactivated, ip_blocked, ip_unblocked (admin or command line), probe_block (automatic), never_ban_changed, login_ban_changed, cf_ranges_refreshed (result ok or failed, run by the weekly job), cf_ranges_reset (use the built-in list), cf_ranges_approved and cf_ranges_dismissed (a pending list approved or dismissed, counts only), cf_refresh_toggled (the weekly refresh turned on or off, was and enabled), security_retention_changed (old_days, new_days of retention_security_events_days), security_events_pruned (a manual run of cleanup deleted events: deleted, days), rate_limited, host_key_accepted, security_log_export.

Aggregation: wrong passwords, bad or missing 2FA codes, failed registrations, wrong current-password attempts, probe blocks and rate-limit trips are counted per (source IP, event, result, minute) and written as one row with a count, every few seconds and at shutdown. An IPv6 source is counted as its /64 network (ip is then written 2001:db8:1:2::/64; a full IPv6 address typed in the ip filter also matches its /64 row, and a typed /64 matches it directly). At most 300 aggregated rows are created per minute across all sources, over every flush; further sources in that minute are added to one shared row per event and result with ip * and no username_tried, user_agent or details. Such a row keeps the first username_tried and user_agent of that minute. Everything else is written at once, at most 30 rows per minute for each account (or address, without an account) and event; the rest of that minute is counted in one aggregated row per account, which keeps the account and has ip *. These events are never held to that limit or folded into an overflow row: role_changed, user_deleted, password_reset, never_ban_changed, login_ban_changed, every cf_* event, security_retention_changed, security_events_pruned, security_log_export, and ip_blocked and ip_unblocked made by an administrator. Passwords, 2FA and backup codes, tokens, API keys and invite codes are never stored. username_tried is cut to 64 characters and user_agent to 200; control, zero-width and bidirectional override characters are removed. Since 1.24.2 the member is part of the key when the event names one, so two members behind one address in the same minute are two rows. A sign-in or probe block that runs out is written as ip_unblocked with result expired (the address in ip and details.target_ip); one sweep writes at most 50 of them and one summary row with details.more.

Auto-Moderation ADMIN

Configure automatic message filtering rules that run before messages are saved, and again when a member edits a message. A blocked message or edit is not stored and only its author is told. Moderators and above are still blocked, but are exempt from the timeout and mute penalties. Triggers are logged to the audit log.


Rate Limits

API requests are rate limited to prevent abuse:

  • Authentication endpoints: 10 requests per minute
  • General API: 60 requests per minute
  • WebSocket connections: 10 concurrent per user
  • Chat messages: 5 messages per 5 seconds per user
  • Outgoing webhooks: 30 deliveries per webhook per 60 seconds Since 1.24.2 an alert hook has one window for alerts and one for ordinary events (30 each per 60 seconds), so ordinary events no longer use up the alerts' share.
  • Incoming webhooks: 10 messages per token per 60 seconds

Rate limit headers are included in responses:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1704067200

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Missing or invalid authentication
403Forbidden - Insufficient permissions or blocked action
404Not Found - Resource doesn't exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error