API reference

TouchDesigner Python API

Native Python interface for controlling Lightpath from inside TouchDesigner.

Native Python interface for controlling Lightpath from inside TouchDesigner. The LightpathAPI.tox component (provided by Digital Ambiance) wraps the HTTP API and exposes everything two ways: as custom parameters you can wire in the editor, and as extension methods you can call from any DAT via op.LIGHTPATH_API.MethodName().

Setup

  1. Load LightpathAPI.tox into your .toe. The component self-installs the LIGHTPATH_API global op shortcut, so you can reach it from anywhere as op.LIGHTPATH_API.

  2. Configure the server. On the component's Server page, set:

    • Host — the Lightpath server hostname or IP. Leave as localhost if you're running on the same machine.
    • Port — defaults to 3001. Leave as-is unless your install overrides it.
  3. Log in. Lightpath's content routes are auth-gated, so the component needs to hold a valid token before it can do anything:

    • Enter your Username and Password on the Server page.
    • Pulse Login. On success, the Status page's Logged In field shows yes (expires …).
  4. Sync data. Pulse Sync Data to query the server for all looks, scenes, playlists, outputs, and actions, and populate the dropdown menus on every page. Now you can pick things by name from a dropdown instead of typing them.

    Sync Data auto-fires whenever Host or Port changes, so once you're configured you rarely need to pulse it manually.

That's it — you can now drive Lightpath either by pulsing the parameter buttons on the component, or by calling the extension methods from Python:

op.LIGHTPATH_API.ActivateLook("Sunset")
op.LIGHTPATH_API.FireAction("All Lights On")
op.LIGHTPATH_API.SetDimmer("Facade", 0.75)

Authentication

The component authenticates by calling POST /api/login with the username and password you set on its Server page, then attaches the returned JWT as Authorization: Bearer … on every subsequent request. The token is persisted via TouchDesigner's StorageManager so it survives a .toe save/load — you only need to log in again when the token's server-side TTL elapses (typically 7 days).

Login is the right credential for an interactive TD workflow where you, a person, are driving Lightpath through the network. If you're embedding TD in an unattended show-control rig and want a long-lived credential without storing a user password, mint an integration key in the Lightpath UI (Settings → Integration Keys) and call SetIntegrationKey("lpath_live_…") instead of Login(…). Either credential type is accepted on the same endpoints — the server auto-detects the lpath_ prefix.

MethodDescription
SetServer(host="localhost", port=3001)Set the Lightpath server address
GetServer()Returns { "host": "...", "port": ... }
Login(username, password)Authenticate and store the returned JWT
SetIntegrationKey(key)Use a long-lived integration key instead of login
Logout()Clear the stored credential

Content activation

MethodDescription
ActivateLook(name)Activate a look on its configured output
ActivateScene(name)Activate a scene across all of its outputs
ActivatePlaylist(name)Start a global playlist (scene rotation)
op.LIGHTPATH_API.ActivateLook("Sunset")
op.LIGHTPATH_API.ActivateScene("Evening")

Each look is bound to one output at design time, so ActivateLook doesn't take a target — the look already knows where it goes. Use scenes or playlists when you want one trigger to drive several outputs at once.

Playlist control

Per-output and global playlists share the same methods — pass output="Name" to control a specific output's playlist, omit it to control the global scene-rotation playlist.

MethodDescription
PausePlaylist(output=None)Pause a playlist
ResumePlaylist(output=None)Resume a playlist
StopPlaylist(output=None)Stop a playlist
SetTrack(index, output=None)Jump to a specific track (0-based)
ToggleLoop(output=None)Toggle loop mode
NextTrack(output)Advance to next track (per-output only)
PrevTrack(output)Go to previous track (per-output only)
# Per-output
op.LIGHTPATH_API.NextTrack("Output 1")
op.LIGHTPATH_API.SetTrack(2, output="Output 1")
op.LIGHTPATH_API.PausePlaylist(output="Output 1")

# Global
op.LIGHTPATH_API.PausePlaylist()
op.LIGHTPATH_API.SetTrack(2)

Actions

MethodDescription
FireAction(name, targetState=None)Execute an action. For toggles, pass targetState=True/False
SetActionState(name, state)Set a toggle action state (True/False or "on"/"off")
op.LIGHTPATH_API.FireAction("All Lights On")
op.LIGHTPATH_API.FireAction("Projector", targetState=True)
op.LIGHTPATH_API.SetActionState("Projector", True)

Output control

MethodDescription
SetDimmer(outputName, value)Set output brightness (0.0 – 1.0)
SetOutputEnabled(outputName, enabled)Power toggle
op.LIGHTPATH_API.SetDimmer("Output 1", 0.75)
op.LIGHTPATH_API.SetOutputEnabled("Output 1", False)

Global playback

MethodDescription
StopAll()Stop all playback across all outputs
GetPlaybackStatus()Get playback status for all playlists
status = op.LIGHTPATH_API.GetPlaybackStatus()
print(status)

State queries

MethodDescription
GetState()Get full current system state
GetLooks()Get all looks
GetLook(name)Get a single look by name
GetScenes()Get all scenes
GetScene(name)Get a single scene by name
GetPlaylists()Get all playlists (both global scene rotations and per-output look rotations)
GetPlaylist(name)Get a single playlist by name (checks both global and per-output)
GetOutputs()Get all output definitions
GetOutputState(name)Get the live runtime state for a single output (active look, dimmer, etc.)
GetOutputStates()Get live runtime state for every output
GetActions()Get all actions with their configured state
GetAction(name)Get a single action definition by name
GetPalettes()Get all palettes
GetPalette(name)Get a single palette by name
looks = op.LIGHTPATH_API.GetLooks()
for look in looks.get("looks", []):
    print(look["name"])

Calendar

Calendar events drive scheduled content activation.

MethodDescription
GetCalendarEvents(timeMin, timeMax)List events in an ISO time range
GetCurrentCalendarEvents()List events currently active, with metadata
CreateCalendarEvent(event)Create an event
UpdateCalendarEvent(eventId, updates)Update an event by id
DeleteCalendarEvent(eventId, deleteScope=None)Delete; pass "this" or "all" for recurring events
GetSunTimes(date)Sunrise/sunset times for an ISO date (project location required)
SetOutputCalendarEnabled(outputName, enabled)Toggle calendar playback on one output
SetAllOutputsCalendarEnabled(enabled)Toggle calendar playback on every output

On this page