REST API

The REST APIs are undergoing active development, so some of the below APIs may change in time. APIs marked as (upcoming) are yet to be added.

/api/info

Information about LedFx

GET

Returns basic information about the LedFx instance as JSON

{
  "url": "http://127.0.0.1:8888",
  "name": "LedFx",
  "version": "0.3.0"
}

/api/config

LedFx Configuration

GET

Returns the current configuration for LedFx as JSON

/api/log (upcoming)

LedFx Logging

GET

Returns the error logs for the currently active LedFx session

/api/schema/

LedFx Schema Api

GET /api/schema/

Returns all LedFx schemas for devices, effects, and integrations as JSON

/api/schema/<schema_type>

Query a specific LedFx schema with the matching schema_type as JSON

GET /api/schema/<schema_type>

Returns the LedFx schema with the matching schema_type as JSON

  • devices: Returns all the devices registered with LedFx

  • effects: Returns all the valid schemas for an LedFx effect

  • integrations: Returns all the integrations registered with LedFx

/api/devices

Query and manage devices connected to LedFx

GET

Get configuration of all devices

POST

Adds a new device to LedFx based on the provided JSON configuration

/api/devices/<device_id>

Query and manage a specific device with the matching device_id as JSON

GET

Returns information about the device

PUT

Modifies the information pertaining to the device and returns the new device as JSON

DELETE

Deletes a device with the matching device_id

/api/effects

Query and manage all effects

GET

Returns all the effects currently created in LedFx as JSON

POST (upcoming)

Create a new Effect based on the provided JSON configuration

/api/effects/<effect_id>

Query and manage a specific effect with the matching effect_id as JSON

GET

Returns information about the effect

PUT (upcoming)

Modifies the configuration of the effect and returns the new configuration as JSON

DELETE (upcoming)

Deletes the effect with the matching effect_id.

/api/devices/{device_id}/effects

Endpoint linking devices to effects with the matching device_id as JSON

GET

Returns the active effect config of a device

PUT

Update the active effect config of a device based on the provided JSON configuration If config given is “RANDOMIZE”, the active effect config will be automatically generated to random values

POST

Set the device to a new effect based on the provided JSON configuration

DELETE

Clear the active effect of a device

/api/devices/<device_id>/presets

Endpoint linking devices to effect presets (pre-configured effect configs) with the matching device_id as JSON

GET

Get preset effect configs for active effect of a device

PUT

Set active effect config of device to a preset

POST

Save configuration of device’s active effect as a custom preset for that effect

DELETE

Clear effect of a device

/api/effects/<effect_id>/presets

Endpoint for querying and managing presets (pre-configured effect configs) for each effect with the matching effect_id as JSON

GET

Get all presets for an effect

GET

Rename a preset

DELETE

Delete a preset

/api/scenes

Endpoint for managing scenes. Active effects and configs of all devices can be saved as a “scene”.

GET

Get all saved scenes

PUT

Set effects and configs of all devices to those specified in a scene

POST

Save effect configuration of devices as a scene

DELETE

Delete a scene

/api/integrations

Endpoint for managing integrations. Integrations are written to allow ledfx to communicate with other software, and vice versa.

GET

Get info of all integrations Optional, send request body to get specific info of integrations Any of: [“id”, “type”, “active”, “status”, “data”, “config”]

example:

{
  "info":"status"
}

STATUS REFERENCE 0: disconnected 1: connected 2: disconnecting 3: connecting

PUT

Toggle an integration on or off

example:

{
  "id": "myqlc"
}

POST

Create a new integration, or update an existing one

{
  "type": "qlc",
  "config": {
      "description": "QLC Test",
      "ip_address": "127.0.0.1",
      "name": "myQLC+",
      "port": 9999
      }
}
{
  "type": "spotify",
  "config": {
      "description": "Spotify triggers for party",
      "name": "Party Spotify"
      }
}

DELETE

Delete an integration, erasing all its configuration and data.

{
  "id": "myqlc"
}

NOTE: This does not turn off the integration, it deletes it entirely! (though it will first turn off..)

/api/integrations/qlc/<integration_id>

Endpoint for querying and managing a QLC integration.

GET

Returns info from the QLC+ integration.

Specify “info”, one of: ["event_types", "qlc_widgets", "qlc_listeners"]

event_types: retrieves a list of all the types of events and associated filters a qlc listener can subscribe to

qlc_widgets: retrieves a list of all the widgets that can be modified, formatted as [(ID, Type, Name),…] for “type”:

  • “Buttons” can be set to either off (0) or on (255)

  • “Audio Triggers” are either off (0) or on (255)

  • “Sliders” can be anywhere between 0 and 255

qlc_listeners: retrieves a list of all of the events that QLC is listening to, and their associated widget value payloads

{
  "info": "qlc_listeners"
}

PUT

Toggle a QLC+ event listener on or off, so that it will or will not send its payload to set QLC+ widgets

{
  "event_type": "scene_set",
  "event_filter": {
      "scene_name": "My Scene"
      }
}

POST

Add a new QLC event listener and QLC+ payload or update an existing one if it exists with same event_type and event_filter The “qlc_payload” is a dict of {“widget_id”: value} that will be sent to QLC+

{
  "event_type": "scene_set",
  "event_filter": {
      "scene_name": "My Scene"
      },
  "qlc_payload": {
      "0":255,
      "1":255,
      "2":169
      }
}

DELETE

Delete a QLC event listener, and associated payload data.

{
  "event_type": "scene_set",
  "event_filter": {
      "scene_name": "My Scene"
      }
}

NOTE: This does not turn off the integration, it deletes it entirely! (though it will first turn off..)

/api/integrations/spotify/<integration_id>

Endpoint for querying and managing a Spotify integration.

GET

Get all the song triggers

PUT

Update a song trigger [TODO]

POST

Create a new song trigger

{
  "scene_id": "my_scene",
  "song_id": "347956287364597",
  "song_name": "Really Cool Song",
  "song_position": "43764"
}

DELETE

Delete a song trigger

{
  "trigger_id": "Really Cool Song - 43764"
}

WebSocket API

In addition to the REST APIs LedFx has a WebSocket API for streaming realtime data. The primary use for this is for things like effect visualizations in the frontend.

Will document this further once it is more well defined. The general structure will be event registration based.