HTTP API #
Rubylight docs › For developers · Getting started · Configuration
The host serves its administration API at https://localhost:47990/api; the web console is built on the same API. Changing the base port setting moves the console to port + 1.
Routing, authentication and token scopes are implemented in web.rs, and the handlers for each area in web/. The C++ host's API guide is kept at the 2.0.0-rc.23 tag as a migration reference.
Paired clients use other routes, on the streaming HTTPS port (HttpsPort from /serverinfo, normally 47984), authenticated by the certificate the device paired with. None of the authentication methods on this page apply to them:
| Route | Reference |
|---|---|
/api/native/v1/... |
Native API v1: game library, session state and actions, graphics driver settings (Radeon or NVIDIA), files, power and more. Summary below. |
/api/hardware-metrics |
Hardware metrics: CPU and AMD GPU readings for a client's overlay. |
/api/network-path |
Remote connection route: the requesting peer's current Tailscale route category (NetworkPathVersion). |
/internet-play/v1 |
Play over the internet: this device's rendezvous secret, the host's session, public endpoints, IPv6 addresses, forwarded ports and port numbers (RustHostInternetPlayVersion). |
Moonlight pairing, app discovery and streaming use the GameStream endpoints in nvhttp.rs.
Authentication #
Create the administrator account through the local console first. Initial account creation (POST /api/password while no account exists) is accepted only from the host PC. Access to the web interface also follows origin_web_ui_allowed: pc, lan (the default), or wan.
| Method | Use |
|---|---|
| HTTP Basic | Send the administrator username and password over HTTPS. Useful for interactive scripts. |
| Scoped API token | Send Authorization: Bearer <token>. Each token grants only the selected paths and HTTP methods. |
| Web session | Sign in with POST /api/auth/login. The host issues secure, HttpOnly session and refresh cookies; it also returns the access, refresh and CSRF tokens in JSON. |
The public API routes are /api/auth/status, /api/auth/login, /api/auth/refresh, /api/csrf-token and /api/configLocale. Other API routes require authentication, apart from local first-time account creation.
Scoped tokens #
Use the console's API token controls, or these administrator-authenticated routes. Select all permissions selects every available path and method, including paths hidden by search. You can clear the selection or deselect individual permissions before creating the token. A token may hold any number of the advertised paths, and the host keeps at most 256 tokens.
| Method and path | Result |
|---|---|
GET /api/token/routes |
Available scope paths and their allowed methods. |
POST /api/token |
Create a token from a scopes array; returns its secret once. |
GET /api/tokens |
Token hashes, ownership, creation times and scopes. |
DELETE /api/token/{hash} |
Revoke a token. |
A read-only token request body can be:
{
"scopes": [
{ "path": "/api/metadata", "methods": ["GET"] },
{ "path": "/api/session/status", "methods": ["GET"] }
]
}
Choose paths exactly as returned by /api/token/routes, including the pattern entries (/api/apps/[^/]+, /api/apps/[^/]+/cover, /api/apps/[^/]+/icon, /api/covers/[0-9]+). The host validates the selected methods and matches each scope against the whole request path. Secrets are stored as hashes; keep the creation response if the token will be used later.
Some routes are not in the catalogue, so no token can reach them: the authentication and token routes themselves, and the console-only routes.
Sessions and CSRF #
Browser sign-in takes username, password and optional remember_me. POST /api/auth/refresh rotates the refresh token; POST /api/auth/logout revokes the current session. GET /api/auth/sessions lists sessions, and DELETE /api/auth/sessions/{id} revokes one. Remembered sessions survive host restarts. GET /api/auth/status answers authenticated, credentials_configured and login_required, and renews a remembered browser whose access cookie lapsed.
For requests that change state:
- If an
Originheader is present, it must match the host's HTTPS origin or an entry incsrf_allowed_origins. A CSRF token does not override a rejected origin. - Session authentication, whether through a cookie or a Bearer access token, requires
X-CSRF-Tokenon protected routes. Read the session's token fromGET /api/csrf-tokenusing the same session. - Basic authentication and valid scoped API tokens do not require a session CSRF token. Origin checks still apply. A Basic-authenticated request without
Originis refused with403when it has a form content type (application/x-www-form-urlencoded,multipart/form-data,text/plain) orSec-Fetch-Siteother thansame-originornone: send JSON or no body. - Before browser sign-in or first-time account creation, fetch
/api/csrf-token, retain its anonymous cookie, and send the returned token asX-CSRF-Token. If that cookie is present, the host requires a matching header. POST /api/auth/refreshthat relies on the__Host-apollo_refreshcookie requiresX-CSRF-Token: the session's token, or the anonymous token from/api/csrf-tokenwith its cookie. A refresh token sent asAuthorization: Refresh <token>or asrefresh_tokenin the body needs none.- First-time account creation (
POST /api/passwordbefore any credentials exist) is accepted only from a browser on the host PC (over loopback or to the PC's own address), with noForwardedorX-Forwarded-*header and with aHostandOriginthat name this PC. Behind a reverse proxy or tunnel on the PC (nginx, cloudflared,tailscale serve), set the first sign-in on the PC instead: runbutterpollo.exe --creds NAME PASSWORDfrom an administrator PowerShell (Getting started).
Read-only examples #
These PowerShell examples read host status without launching an app or changing settings. Replace the certificate path with the console's root from the active profile and admin with your administrator name. curl.exe --user admin prompts for the password instead of putting it in the command.
The console's certificate names localhost, 127.0.0.1 and ::1. On an installed host, Windows' curl.exe also trusts it without --cacert, through the root setup adds to Windows, when given --ssl-no-revoke: the root publishes no revocation list, and Windows' curl otherwise refuses a certificate it cannot check for revocation. Browsers do not need this.
$certificate = 'C:\path\to\profile\credentials\console-root.pem'
curl.exe --fail-with-body --silent --show-error --cacert $certificate --user admin https://localhost:47990/api/metadata
curl.exe --fail-with-body --silent --show-error --cacert $certificate --user admin https://localhost:47990/api/session/status
curl.exe --fail-with-body --silent --show-error --cacert $certificate --user admin https://localhost:47990/api/token/routes
/api/metadata (also served as /api/meta) reports the host version, codec probe status, configured capture backend, displays, GPUs, audio endpoints, virtual-display capabilities and host warnings. Results are cached for up to five seconds; reading them does not start a codec probe. Codec state (encoder_status.state) is checking, ready or failed.
/api/session/status includes activeSessions, appRunning, appName, paused and running. An app can remain running after its stream disconnects, so these fields describe different states.
Endpoint groups #
JSON requests use Content-Type: application/json; most responses include a Boolean status. Display lists, images and log downloads have their own response formats. Every route below can be granted to an API token unless it is listed under Console-only routes.
| Area | Read | Change |
|---|---|---|
| Host settings | GET /api/config, GET /api/metadata (or /api/meta), GET /api/configLocale |
POST or PATCH /api/config, POST /api/warnings/dismiss |
| Applications | GET /api/apps, GET /api/apps/{id}/cover, GET /api/apps/{uuid}/icon |
POST /api/apps, DELETE /api/apps/{id}, POST /api/apps/delete, POST /api/apps/reorder, POST /api/apps/launch, POST /api/apps/close |
| Game library | GET /api/library/discovery |
POST /api/library/import, POST /api/library/sync, POST /api/library/restore |
| Paired devices | GET /api/clients/list, GET /api/clients/pending |
POST /api/pin, POST /api/otp, POST /api/pairing/qr (with qr_pairing on, the default), POST /api/clients/update, POST /api/clients/disconnect, POST /api/clients/unpair, POST /api/clients/unpair-all, POST /api/clients/reset-network-history |
| Webhooks (format) | GET /api/webhooks |
POST /api/webhooks, POST /api/webhooks/delete, POST /api/webhooks/test |
| Active sessions | GET /api/session/status, GET /api/rtsp/sessions, GET /api/sessions/history, GET /api/session/console |
POST /api/session/console |
| Forwarded USB devices | GET /api/usb |
POST /api/usb/detach |
| Stream DVR and clips (setting) | GET /api/dvr, GET /api/dvr/clips?limit=50&cursor=, GET /api/dvr/clips/{id}/video, GET /api/dvr/clips/{id}/download |
POST /api/dvr/clip, POST /api/dvr/record, DELETE /api/dvr/clips/{id} |
| Displays | GET /api/display-devices, GET /api/clients/display-layout, GET /api/clients/hdr-profiles, GET /api/display/golden_status |
PUT /api/clients/display-layout, POST /api/display/export_golden, POST /api/display/restore_golden, DELETE /api/display/golden, POST /api/display/terminate_virtual, POST /api/reset-display-device-persistence |
| Frame limiting and HDR | GET /api/frame-limiter/status, GET /api/rtss/status, GET /api/health/vulkan-hdr-layer, GET /api/framegen/edid-refresh?device_id=... |
POST /api/health/vulkan-hdr-layer/register |
| Steam | GET /api/steam/status, GET /api/steam/games |
POST /api/steam/force_sync, POST /api/steam/launch |
| Playnite | GET /api/playnite/status, GET /api/playnite/games, GET /api/playnite/categories |
POST /api/playnite/install, POST /api/playnite/uninstall, POST /api/playnite/force_sync, POST /api/playnite/cover, POST /api/playnite/launch |
| Library extras | GET /api/covers/{id}, GET /api/lossless_scaling/status, GET /api/browse?path=...&type=... |
POST /api/covers/upload, POST /api/apps/purge_autosync |
| Graphics driver (Radeon or NVIDIA) | GET /api/radeon |
Set radeon-profile and radeon-settings on the application. |
| Updates | GET /api/updates |
POST /api/updates/check, POST /api/updates/install, POST /api/updates/install_now, POST /api/updates/cancel |
| Diagnostics | GET /api/logs, GET /api/logs/tail, GET /api/logs/analysis, GET /api/logs/export, GET /api/logs/export_crash, GET /api/logs/export_crash/manifest, GET /api/health/crashdump |
POST /api/health/crashdump/dismiss |
| Administration | Authentication and token routes above. | POST /api/password, POST /api/restart, POST /api/quit |
Request and response details:
- Configuration. Writes merge the submitted fields and return
restart_required(trueunless every submitted key applies without a restart) and an optionalwarning. Treat the response as a saved configuration, not confirmation that every active stream has adopted it. Thewebhookssetting is left out of reads and refused in writes; use the webhook routes.POST /api/warnings/dismisstakes thecodeof a host warning that/api/metadatalists. - Applications. Applications are updated by their
uuid.DELETE /api/apps/{id}takes the UUID or numeric app ID;POST /api/apps/deletetakes oneuuid, or auuidsarray (at most 10,000) to delete several in one save, and answersdeletedandkept.POST /api/apps/reordertakes anorderarray. Read/api/appsbefore making changes rather than treating an array index as the identity./api/apps/{uuid}/iconreturns the PNG icon a Playnite sync saved for the app, or404. - Game library.
GET /api/library/discoverylists the games the launcher scan found.POST /api/library/importtakesgames, an array of{"source", "id"}pairs;POST /api/library/syncrescans;POST /api/library/restorebrings back removed games,{"all": true}or{"games": ["steam:570", ...]}(at most 10,000). - Device updates.
POST /api/clients/updatetakes the device'suuidand the fields to change.name,enabledandperm(masked with0x071f1f00) change the device; any other key is stored in the device's settings, andnullremoves it. The grantshost_control(host control),pairing_approve(Approve new devices, see approve a device),allow_sleep(Sleep PC),allow_restart_shutdown(Restart and shut down PC),allow_usb(USB forwarding) andcoop_join(Can join co-op games) accept onlytrue,falseornull, and only a JSONtrueturns one on; anything else refuses the whole update.doandundo(the device's connect and disconnect commands) take a list of{"cmd": "...", "elevated": bool}of at most 64 entries,""ornull, and a list the host could not run refuses the whole update.shared_folderstakes{"<folder id>": "read" | "write"}ornull(shared folders), andconfig_overridesis checked as the host's own settings are. The first device with a certificate paired on a host starts withpairing_approveunless the owner chose Watch only; every other device gets it only here.connected,network_loss_routes,client_agentandclient_warningare read-only. - Device list.
/api/clients/listhas, for each device, read-onlynetwork_loss_routes(address, seconds until expiry, and eligible sessions until a fast-rate probe),client_agent(theUser-Agentof the device's latest/serverinfosince the host started, ornull) andclient_warning({"problem", "link"}for a client build with a known problem against this host, ornull; it never refuses the device). The top-levelsleep_unavailablesays why this PC offers no Sleep PC, such as a PC with only Modern Standby, or isnull.POST /api/clients/reset-network-historywith{"uuid": "device-id"}clears the loss routes for subsequent streams; it does not change a running stream. - USB.
GET /api/usblists thedevicesthat clients forward:id,client,name,vid,pid,class,speed,busid,state(waitingfor the tunnel,opening,attachedordetaching), the driver'sportonce attached, andsince_unix_ms.POST /api/usb/detachwith{"id": 1}detaches one; the client is told. - Console session recovery.
GET /api/session/consolereturnsrecoverywithsession_id,console_session_id,can_reattachand a human-readablereason. After explicit user confirmation,POST /api/session/consolewith those two IDs asks Windows to return the host's own RDP session to the physical console. The destination must have no signed-in user, or be disconnected with a verified matching user SID; active sessions, different users and unknown identities are refused. The host rechecks session identity, destination eligibility and idle transports before making the request, and never selects another user's source session. The response acknowledges the request, not completion of the asynchronous Windows transition. This can disconnect RDP and make the desktop visible at the PC. - Active sessions.
GET /api/rtsp/sessionslists the running streams. Each stream'sstutterobject is where its new pictures lost time against the stream's own usual path:windows,pictures,late_pictures,lost_ms,dominant(a stage id, ornullwhen none stands out),stages(id,lost_msandpercentof the lost time, most first) andnot_measured(the game's own intervals, the network, decoding and the display, which the host cannot see; repeats inpipeline_ratesshow a game slower than the stream). - Graphics driver.
GET /api/radeonlists the graphics driver settings of the GPU the host streams with, Radeon or NVIDIA (nvidia_ids), as the native API does (id, state, range, options), for a game's Graphics driver panel. It only reads; a game's profile is applied when it starts. - File picker.
/api/browselists a folder of this PC:path,parentandentries(each withname,pathandtypedirectoryorfile), folders first.type=executablelists only.exe,.bat,.cmdand.ps1files; notype,type=anyortype=fileany file;type=directoryor any other value no files. Folders are always listed. A file or missing path lists the nearest existing folder above it; an emptypathlists the drives, and a drive root'sparentis empty. - Playnite.
/api/playnite/covertakesplaynite_idandcover_key(an image saved by/api/covers/uploador a cover search), asks the Playnite plugin to use that image as the game's cover, then syncs the library and returns the cover'spath./api/playnite/launchrestarts Playnite in desktop mode. - Updates.
/api/updates/installqueues the update for an idle installed service./api/updates/install_nowinstalls without waiting and ends a running stream;nowistruein/api/updateswhile such an update is queued. Read/api/updatesfor progress and the result. - Logs.
/api/logsand/api/logs/exportreturn up to the last 8 MiB of the current log as text; the ordinary log export is not a ZIP./api/logs/export_crashcreates the support ZIP with redacted logs and diagnostics; it holds the newest crash memory dump only withinclude_dump=1(the manifest takes the same parameter)./api/logs/tailacceptsoffsetandmax, then returnstext, the nextoffset,sizeand aresetflag for log rotation. - Log analysis.
/api/logs/analysisreads the last 8 MiB of the current log on the host and returnsfindings, newest first, plus thesinceanduntiltimes it covered. Each finding hasid,category(encoder,capture,networkordriver),level(warnorerror),title,explanation,fix, alinkto the troubleshooting guide,setting(the key of the setting the fix names, or null),count,first_seen,last_seenand the latest matching line assample. It uses fixed local rules and contacts nothing. - Session history.
GET /api/sessions/historylists the ended streams, newest first, with the host's fixed caps:sessions,limit(200),days(90) andbytes(256 KiB, which can trim below the count). There is no setting for it; the caps are constants. One stream hasid,device,device_name,app_id,app,role,transport(moonlightorwebrtc),codec,width,height,fps,hdr,bitrate_kbps,mean_bitrate_kbps(video bytes over the duration; audio is not counted),mean_fps,p95_fps,loss_percent,end_reason(ended,failed,start_failedorinterrupted),end_detail,end_category(thelog_analysisrule's category, or null),started_unix_ms,ended_unix_msandduration_ms.p95_fpsis the frame rate the slowest 5% of sampled seconds ran at or below, and is 0 until 20 seconds were sampled.loss_percentis the client's reported missing video packets as a share of what the host sent, ornullwhen the client reported no FEC blocks: "not reported" is not "no loss". Astart_failedsession never ran, so itswidth,height,fpsandbitrate_kbpsare 0. Aninterruptedsession'sended_unix_msis the host's last heartbeat before it stopped (up to a minute before the crash, so the downtime after is not counted), or its start when the journal predates the heartbeat; its id starts withinterrupted-. The host keeps the history insession-history.jsonin its data directory, saves it on a thread of its own, and drops the oldest sessions past any cap. Input-only and remote-monitor sessions are not recorded.
Console-only routes #
These routes back console pages. They take Basic or web-session authentication like the others, but they are not in the token catalogue, so no API token reaches them.
| Area | Read | Change |
|---|---|---|
| Stream guests (guests) | GET /api/guests, GET /api/guests/addresses, GET /api/guests/internet |
POST /api/guests/invite, POST /api/guests/internet, POST /api/guests/revoke, POST /api/guests/kick |
| Co-op (Nucleus Co-op) | GET /api/coop, GET /api/coop/sessions |
POST /api/coop/folder, POST /api/coop/open, POST /api/coop/close, POST /api/coop/kick, POST /api/coop/end |
| Neural Rendering (setting) | GET /api/neural?uuid=... |
POST /api/neural/accept, POST /api/neural/enable, POST /api/neural/disable |
| Managed game files (files) | GET /api/game-settings?uuid=... |
POST /api/game-settings/release |
| Wake and sleep (power) | GET /api/power |
POST /api/power/wake/fix |
| Settings backup (backup and restore) | POST /api/backup/export, POST /api/backup/inspect, POST /api/backup/restore |
|
| Stream in the console (WebRTC) | GET /api/webrtc/signal (WebSocket, web session only) |
|
| Opening the clips folder (Stream DVR) | POST /api/dvr/open-folder |
|
| Account and file picker | GET /api/browse |
POST /api/password |
- Co-op.
GET /api/coopshows the background mode and why, the Nucleus Co-op install (the chosen folder, or why it can't run from it), each app's co-op status and every co-op session;GET /api/coop/sessionsreturns onlysessions, for Home's poll.POST /api/coop/folderchecks the folder inpathand keeps it asnucleus_path.openandcloseopen and close Nucleus Co-op's window on the PC.kicktakessessionandslotand removes that player;endtakessessionand ends it; both end the streams those seats held. - Neural Rendering.
GET /api/neural?uuid=says whether this PC can have frame generation and why not, whether the notice was accepted, the app's install (modefull, oraddonin the user's own OptiScaler) with its progress, andearlier_upscalingwhile Rubylight 3.0's neural upscaling is still in the game's folder.POST /api/neural/acceptrecords acceptance of the notice.enable(uuid, optionalexe, the full path of a.exe) downloads and installs, removing the earlier upscaling first;disable(uuid) removes either; withearlier: trueit removes only the earlier upscaling, for example files it left beside another program of the game while frame generation stays on. Both answer202once the job has started,404for an app the host doesn't have, and409while a stream runs or while the host is busy with the game.enablealso answers409before the notice is accepted, when the PC can't have it (none of its GPUs can run it, or the Visual C++ runtime is missing) and when frame generation is already on, and400for anexethat isn't the full path of a.exe; a game that is refused (an anti-cheat, no DLSS frame generation, its program to be chosen) fails in the job, whoseerrorsays why. A removal that finds the game running fails in its job with "close the game and try again", with nothing in the game's folder changed. Paired devices use the native API's/neural. - Managed game files.
GET /api/game-settings?uuid=lists which devices have a saved copy of the app's files.POST /api/game-settings/releasewith{"id": "..."}puts the files back now, for a swap that waits for a process that is not the game;409with the reason when it can't. - Wake and sleep.
GET /api/powerreads Wake-on-LAN readiness and sleep after idle;?refresh=1reads the adapters again.POST /api/power/wake/fixchanges adapter and power settings only when asked: optionalfast_startup_off(Boolean) andchanges(the changesGET /api/powerlisted, to apply exactly those). It answers202with every change it will make, applied about a second later;200when there is nothing to change;409while a stream is active or starting, or a fix runs. - Settings backup.
POST /api/backup/exportanswers a ZIP download (application/zip). Its body is optional:{"secrets": true}adds the pairing identity and credentials (this PC's pairing certificate and key, the paired devices with their certificates, the console sign-in, API tokens and webhook secrets); anything else leaves them out.POST /api/backup/inspecttakes the archive itself as the request body (up to 512 MiB, any content type but a form's) and checks it: itsbackup.jsonmanifest, every file's size and SHA-256, that it holds only files a backup holds and secrets only when it says so, and that its settings, app list and device files can be read. It answers{"status": true, "token": "...", "summary": {"created_unix", "host_version", "secrets", "changes": [{"item", "detail"}]}}, or400with the reason; the host keeps only the most recent upload.POST /api/backup/restorewith{"token": "..."}saves the current settings, with their secrets, asbackups\before-restore-<time>.zipin the data folder (the newest five stay), stages the upload and restarts the host, which applies it before anything else on start. It answers409while a device streams or connects, and400for a token that is unknown or whose upload is gone. A failed restore keeps the previous settings and shows a notice in the console. - Stream DVR and clips.
GET /api/dvris the native API'sDvrStatus(Stream DVR) plusenabled(thedvr_enabledsetting) andclips_dir(the resolved clips folder).GET /api/dvr/clipslists the saved clips newest first as aClipList(clips,next_cursor,quota_used_bytes,quota_limit_bytes); passnext_cursorback ascursorfor the next page.POST /api/dvr/clipwith{}or{"duration_secs": 60}saves the replay buffer and answers{"status": true, "clip": ClipSummary}once the file is written;POST /api/dvr/recordwith{"action": "start"}or{"action": "stop"}answers{"status": true, "dvr": DvrStatus, "clip": ClipSummary or null}. Both refuse with409and{"status": false, "error", "reason"}, wherereasonis aDvrReason(disabled,pyrowave,no_keyframe_yet,busy,disk_full,quota_exceeded,audio_codec_unsupported,io_error,not_streaming).DELETE /api/dvr/clips/{id}deletes one clip (404for an unknown id);GET /api/dvr/clips/{id}/videoserves it asvideo/mp4with range requests for the console's player,/downloadas an attachment.POST /api/dvr/open-folderopens the clips folder on the PC's desktop.
Errors #
Authentication failures return HTTP 401; denied origins or network reach return 403; invalid requests commonly return 400 with {"status":false,"error":"..."}. Login rate limiting returns 429 for the sign-in endpoint and 401 for HTTP Basic authentication. Check the HTTP status and response body together.
For exact request fields beyond this overview, follow the API router and its area handlers, token scope validation and administration checks.
Native API v1 (paired clients) #
Rubylight 3.0 and later. Nightjar and other paired clients use /api/native/v1 on the streaming HTTPS port. No Basic authentication, cookies or API tokens apply, and nothing is served on plain HTTP or the console port: the client presents the TLS certificate it paired with, and the host checks the device's permissions on every request. GET /serverinfo carries NativeApiVersion: missing on hosts without the API, 0 for a request that may not use it, and 1 when a paired HTTPS request may call /api/native/v1/capabilities. Stock Moonlight ignores the field.
Native API v1 is the contract: discovery, features, every endpoint, permissions, errors and versioning. Host control, Approve new devices and the other per-device grants it needs are set only in the console (Devices → device → Other) or through POST /api/clients/update above.