Skip to content
System BridgeSystem Bridge
Esc
↑↓navigate↵open⌘Jpreview
On this page

API

Reference for the System Bridge HTTP, WebSocket and MCP interfaces.

System Bridge exposes your system over a local API. There are three ways to interact with it: an HTTP API for simple request/response calls, a WebSocket API for live data and control, and an MCP server for agents.

The WebSocket API is the primary interface and covers most operations: live data, input, media and power control, notifications, settings, and commands. Reach for HTTP only when you want a quick one-off read of status or a module’s current data.

Base URL

By default the backend listens on port 9170, so the base URL is:

http://{host}:9170

Replace {host} with the hostname or IP address of the machine running System Bridge. The port can be changed with the SYSTEM_BRIDGE_PORT environment variable.

Authentication

Most endpoints need a key. Each client has its own, so you can see which clients connect and remove one without touching the others. A key looks like system-bridge_client_ followed by 49 letters and digits, and it’s only shown once, when it’s made. System Bridge keeps a hash of it, never the key.

A client gets its key by:

  • Pairing, for the Android app.

  • Being made by hand, under Settings > Devices in the web client, or on the computer with:

    system-bridge client key create "My script"

On first start, System Bridge also makes an owner key and writes it to the owner-key file in the settings directory, readable only by your user. The CLI signs in with it. See keys in the CLI.

How you send the key depends on the protocol:

  • HTTP: send Authorization: Bearer {key}.
  • WebSocket: send {"type": "auth", "key": "{key}"} as the first message. See signing in.
  • MCP: send Authorization: Bearer {key}, or for a client that only takes a URL, ?key={key}. See the MCP server.
  • Media files: ask for a signed URL, which holds no key.

The GET /api and GET /api/health endpoints do not need a key.

Moving from the API token

Before keys, every client used one shared API token. A client that has it can trade it for its own key, once. Until the token is removed in a later release, it still works where it did: in the X-API-Token or token header, as a Bearer, in each WebSocket message’s token field, and in the token query parameter of the MCP and media file endpoints.

Version header

The web client sends its version, such as 5.29.0, in the X-System-Bridge-Version header, so a page left open across an update finds out. When it doesn’t match the backend’s version, the backend answers 426 Upgrade Required and leaves the request undone:

{
  "message": "This page is version 5.28.0, but System Bridge is 5.29.0. Reload to use the new version.",
  "server": "5.29.0",
  "client": "5.28.0"
}

GET /api/health answers whatever the version, so a client can always read the backend’s. A request without the header isn’t checked, so other clients don’t need to send it.

Protocols

When to use which

Protocol Best for
WebSocket Most operations: live updates, control actions (media, power, notifications, input), settings, and commands.
HTTP Simple one-off reads: health checks and fetching a module’s current data.
MCP Letting agents query data and trigger actions.

Last updated on