REST & WebSocket API
phix exposes a HTTP/WebSocket API that allows external applications to send commands and receive real-time state updates. This is the same API used by the built-in GUI.
Enabling the API#
The API server runs on a configurable port (default: 9000).
api enableapi port 9000Authentication#
The API uses Bearer token authentication. Create a token:
api token create "My App"Include the token in every request:
Authorization: Bearer <your-token>REST endpoints#
| Method | Path | Description |
|---|---|---|
POST | /api/v1/command | Execute a command (JSON body) |
POST | /api/v1/parse | Parse a text command |
GET | /api/v1/status | Server status and connected clients |
GET | /api/v1/ws | WebSocket endpoint for real-time events |
POST | /api/v1/auth/validate | Validate an API token |
Sending a command#
POST /api/v1/command
Send a JSON-serialized Command object. Example โ trigger executor 1:
POST /api/v1/commandAuthorization: Bearer <token>Content-Type: application/json
{ "command": { "Go": { "executor_index": 1 } }}Parsing a text command#
POST /api/v1/parse
Parse a text command string (like the command line). phix returns the parsed JSON command:
POST /api/v1/parseAuthorization: Bearer <token>Content-Type: application/json
{ "input": "go 1"}Real-time events via WebSocket#
Connect to GET /api/v1/ws with a WebSocket client. phix streams all engine events in JSON format:
{ "ExecutorListChanged": { "executors": [ ... ] }}Events include:
StateChangedโ general state updateFixtureListChangedโ fixture list updatedPresetListChangedโ preset pool updatedExecutorListChangedโ executor state changedCueListChangedโ cue list for the active sequenceProgrammerChangedโ programmer values changedDmxFrameSentโ a DMX frame was outputSelectionChangedโ fixture selection changed
Managing API tokens#
api token create "My App" -- create a new tokenapi token list -- list all tokensapi token delete <id> -- delete a tokenUse cases#
- Custom control surfaces โ build a web or mobile app that controls phix
- Show automation โ trigger cues from a video system, QSC Q-SYS, or automation controller
- Integration โ connect phix to other show-control systems via HTTP
- Monitoring โ stream DMX values or executor state to a visualization tool