Skip to content
Light StreamWiki
← Knowledge base
Page tools

REST API


The REST API lets an external program, automation system or your own control panel control the running Light Stream 4 application: start scenes, change brightness, control groups of fixtures, open projects and edit the schedule.

The documentation matches the LS4 implementation as of September 15, 2026. The application version is available via GET /api/system/info in the buildVersion field.

Download the OpenAPI specification

One file contains 93 HTTP operations, 88 data schemas and 7 integration scenarios: cookie login, starting a scene, brightness, groups, web triggers, project upload and download, calendar and settings. It includes parameters, response formats, errors, examples and HTTP/HTTPS specifics. The format is OpenAPI 3.0.3; it can be imported into Swagger or Postman.

How to use it: the specification describes the LS4 interface for building your own applications and integrations. You can read it as a reference, import it into Swagger or Postman, use it to generate client code, or give it to a programming assistant together with a description of your task. YAML and JSON contain the same specification — choose whichever format is convenient.

Compatibility: the schema was verified against the LS4 code of 15.09.2026, commit a6ab280c0 (application version 4.0.0). Earlier builds with the same number 4.0.0 may have a different set of methods. This is a description of the REST API; SignalR, WebSocket and the Blazor interface are separate protocols.

In LS4 builds that include the schema, the JSON can be obtained directly from your own server at /openapi/ls4.openapi.json. The file from your own server corresponds to the application release. Reading the schema does not require login. HTTPS and the HTTP permission setting work the same way as for the other server addresses.

In Swagger UI, importing the schema does not remove the browser's cookie/CORS restrictions. For programmatic calls, Postman with a cookie jar is convenient: first POST /api/auth/login, then the other methods. Sequences of actions are described inside the file in x-ls4-workflows.

Sections

1. Connection

In the LS4 settings, open the “Web server” section, enable the server and set the login, password and port. The application must remain running. To control scenes, open the required project.

Use the address from the web server link in the application. General form:

https://<LS4-computer-address>:<port>/api

The default HTTPS port is 443. For example, the server base address could be https://192.168.1.50:443, and the scene list is available at https://192.168.1.50:443/api/compositions. Here 192.168.1.50 is an example; replace it with the address of your own computer. localhost works only for a client running on the same computer as LS4.

The server listens on the computer's network interfaces. The selected TCP port must be reachable from the client device, including through the Windows firewall.

Access to the API is protected by a login and password (see the “Authorization” section). A certificate is needed only for HTTPS, and it can be avoided in two ways — they are described below.

Connecting without a certificate

By default, the server accepts requests only over HTTPS, and it has its own self-signed certificate. A client on another computer does not trust it and refuses to connect even though the login and password are correct. There are two simple ways out.

Method 1. Plain HTTP. In the LS4 settings (“Web server”), check “Allow unencrypted HTTP”. After that the server responds at

http://<LS4-computer-address>/api

The HTTP port is 80; it can be omitted from the address. Login, cookies and all methods are the same as over HTTPS; only the certificate is no longer needed. The password is then sent over the network in plain text, so enable the checkbox only in a trusted site network — the REST API of LS Player works the same way. The checkbox appeared in LS4 builds after September 15, 2026; in earlier ones use method 2.

If the browser has already opened this server over HTTPS by host name (not by IP), it may remember an HSTS rule and refuse to go to http:// by that name. Use the IP address or clear the HSTS entry in the browser.

Method 2. HTTPS without certificate verification. Keep HTTPS and disable certificate verification in the client:

Client How to disable verification
curl add -k (same as --insecure) to every request
PowerShell 7 -SkipCertificateCheck on Invoke-RestMethod / Invoke-WebRequest
Windows PowerShell 5.1 there is no parameter; use method 1 or install root-ca.cer (see below)
Python requests verify=False
.NET HttpClient HttpClientHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => true

The traffic stays encrypted; only protection against server spoofing is lost. For a site network this is acceptable.

HTTPS certificate (strict option)

If you need full certificate verification, set up trust for the LS4 root certificate. LS4 creates its own root certificate and server certificate. On the LS4 computer, the root certificate is added to the current user's trusted certificates. Trust for another computer or HTTP client is configured separately.

The public root certificate is located in the program's documents folder: Server/Certificates/root-ca.cer. Give this file to the client and set up trust in its certificate store. For clients that need PEM, convert the public certificate to PEM. The root-ca.pfx file is not needed for the client connection.

For curl with a separate PEM file, you can add --cacert ls4-root-ca.pem to every request. The name or IP in the URL must also match the server certificate.

2. Authorization

Login uses the LS4 web server login and password — those set in the “Web server” settings. The server returns a session cookie; the client saves it and sends it in subsequent requests. A certificate is not needed for login: authorization works the same over HTTPS and over HTTP (see “Connecting without a certificate”). Basic Auth, Bearer/JWT and a separate API key are not provided in this implementation.

Log in

POST /api/auth/login
Content-Type: application/json

{"username":"operator","password":"YOUR_PASSWORD"}

Success: 204 No Content and a Set-Cookie header. Wrong login or password: 401 Unauthorized. The login and password are case-sensitive. The standard cookie name is .AspNetCore.Cookies; use the client's cookie store so that possible splitting of the cookie into parts is handled as well.

The response contains no JSON token. Save the updated cookies from subsequent responses. When the session expires or the credentials change, protected methods return 401; log in again. The login link lifetime setting applies to QR codes and the “Open in browser” link, not to the duration of a regular API session. Every login (both by password and by QR) is visible in the web control panel's list of logins and can be terminated from there — the client will then receive 401; changing the login or password terminates all logins.

Log out

POST /api/auth/logout

The response is 204, and the server deletes the client's cookie. The browser variant GET /api/auth/logout redirects to /login.

QR login

GET /api/auth/qrlogin?token=... logs in with a QR token and redirects to / on success or to /invalid-qr if the token is invalid. The token is reusable until it expires (the first scan restarts the period) and carries a role: a code with the “Remote only” role opens only the triggers page and permits only the calls that it makes; other methods respond with 403. Login by password always gives full access. For details, see Web remote: logins and QR codes. This is a browser login. For programmatic integration, use POST /api/auth/login.

3. Quick start with curl

Create a local UTF-8 file login.json with the login and password of your web server:

{"username":"operator","password":"YOUR_PASSWORD"}

Run the commands, replacing the server address. The examples are for HTTPS with a trusted certificate; if the certificate is not set up, add -k to every curl command or, after enabling “Allow unencrypted HTTP” in LS4, replace https://192.168.1.50:443 with http://192.168.1.50:

curl --fail-with-body --show-error -i -c ls4-cookies.txt -H "Content-Type: application/json" --data-binary @login.json "https://192.168.1.50:443/api/auth/login"
curl --fail-with-body --show-error -b ls4-cookies.txt -c ls4-cookies.txt "https://192.168.1.50:443/api/compositions"

The same login over HTTP:

curl --fail-with-body --show-error -i -c ls4-cookies.txt -H "Content-Type: application/json" --data-binary @login.json "http://192.168.1.50/api/auth/login"
curl --fail-with-body --show-error -b ls4-cookies.txt -c ls4-cookies.txt "http://192.168.1.50/api/compositions"

In Windows PowerShell, use curl.exe instead of curl. Example response with the scene list:

[{"id":12,"header":"Вечерний фасад"},{"id":27,"header":"Праздничная сцена"}]

Take the id from your own response. The commands below really do start and stop a scene:

curl --fail-with-body --show-error -b ls4-cookies.txt -c ls4-cookies.txt -X POST "https://192.168.1.50:443/api/compositions/play/12"
curl --fail-with-body --show-error -b ls4-cookies.txt -c ls4-cookies.txt "https://192.168.1.50:443/api/compositions/current"
curl --fail-with-body --show-error -b ls4-cookies.txt -c ls4-cookies.txt -X POST "https://192.168.1.50:443/api/compositions/stop"
curl --fail-with-body --show-error -b ls4-cookies.txt -c ls4-cookies.txt -X POST "https://192.168.1.50:443/api/auth/logout"

Files with the password and cookies give access to controlling LS4; keep them only on the integration client, and do not include them in a repository or in examples handed to users.

4. PowerShell example

The example asks for credentials, logs in and reads the scene list. It does not start playback. For HTTP, substitute $base = 'http://192.168.1.50'; for HTTPS without a trusted certificate in PowerShell 7, add -SkipCertificateCheck to every Invoke-RestMethod.

$base = 'https://192.168.1.50:443'
$credential = Get-Credential -Message 'Логин и пароль веб-сервера LS4'
$login = @{
    username = $credential.UserName
    password = $credential.GetNetworkCredential().Password
} | ConvertTo-Json

Invoke-RestMethod -Uri "$base/api/auth/login" -Method Post `
    -ContentType 'application/json; charset=utf-8' `
    -Body ([System.Text.Encoding]::UTF8.GetBytes($login)) -SessionVariable ls4

$scenes = Invoke-RestMethod -Uri "$base/api/compositions" -WebSession $ls4
$scenes | Format-Table id, header

# To start, substitute an id from the list and run it separately:
# Invoke-RestMethod -Uri "$base/api/compositions/play/12" -Method Post -WebSession $ls4

Invoke-RestMethod -Uri "$base/api/auth/logout" -Method Post -WebSession $ls4

General rules

Rule What to keep in mind
Format Bodies of regular requests are JSON, Content-Type: application/json, UTF-8 encoding. File upload is an exception.
Field names Examples and responses use camelCase, for example propertyId, projectOpen.
Numbers The decimal separator is a dot. In triggers/set the value is passed as a string.
Identifiers Scene/playlist ID is an integer; group/control ID is a GUID; the calendar event key is a string that changes when edited.
Time Scene duration and elapsed time are in seconds. The calendar uses the local time of the LS4 computer.
Successful command Usually 204 with an empty body. Do not always try to parse the response as JSON.
Verifying the result After a command, read the corresponding status. Acceptance of the HTTP request does not prove that the fixtures are already producing light.
Polling To follow the control panel state, it is convenient to poll /api/triggers/status about once per second; when the stamps change, re-read /api/triggers/board.
Settings A POST to a settings section sends the whole section object. First GET, then change the needed fields, then POST. Omitted fields may receive default values.
Saving Changing the project in memory and writing the .ls file are different actions. To write, use /api/projects/save.

The API has no version prefix such as /api/v1. It is useful for the client to ignore unfamiliar response fields and to check that the needed capabilities exist in the installed LS4 version.

Errors

HTTP code Meaning and client action
200 Successful read or operation with a response body.
204 Successful command without a body.
400 Invalid body, field or parameter; see the description of the specific method.
401 No valid session; log in again.
403 Login with the “Remote only” role: the method is unavailable to this role.
404 The object, file, prepared export or route was not found.
409 The operation is currently impossible: for example, a project is being opened/saved or the event requires the extended editor.
415 Unsuitable Content-Type for a request with JSON.
500 Execution error; check the LS4 log.
501 The operation is not implemented in the current variant of the application, for example scene renaming is unavailable.
503 Monitoring data is not ready yet or is stale; repeat the read later.

There is no single error format: you may encounter an empty body, text, the standard JSON validation error, and objects {"code":"..."}, {"error":"..."}, {"reason":"..."} or {"field":"...","value":"..."}. First check the HTTP code and Content-Type.

Do not automatically retry start, switch, event-creation or one-time-ticket download commands after a network timeout: the request may have been executed. Read the state first.

Access from a browser application

The current CORS policy allows an arbitrary Origin but does not enable credentials for cross-site requests. Therefore a working curl does not mean that fetch with cookies will work from another site. For your own browser control panel, use the same origin or your own server-side intermediary with an LS4 cookie session. Direct cross-site cookie login requires changing the server configuration.

Available without login are /ping (the text pong), GET /api/settings/theme, GET /api/settings/language, GET /api/assets/version and the login/logout routes. /ping checks the availability of the web server, but not whether a project is present or the state of the output.

SignalR /triggerHub and WebSocket /ws/preview, /ws/scene are separate protocols of the web control panel; they are not REST methods and are not needed for the control scenarios given here.