Skip to main content

HTTP API and HTTP/WebSockets Commands

This page covers five topics:

  1. HTTP API for C-Play — endpoints for controlling C-Play remotely
  2. REST (HTTP and WebSockets) Commands Editor — built-in client for managing and testing HTTP and WebSocket commands
  3. REST Layer — non-visual layer type that fires HTTP or WebSocket requests from slides
  4. TCP connection and update control — REST endpoints for C-Play's outgoing TCP connections and saved commands
  5. Change subscriptions — state snapshots, HTTP long polling, and optional event WebSockets

HTTP API for C-Play​

The HTTP Web API allows external systems to control C-Play remotely. Enable or disable it in data/http-server-conf.json, where you can also configure the port (default 7007).

Endpoints support HTTP POST and/or HTTP GET requests. Unless noted otherwise, both request and response bodies are plain text.

A sample Medialon Manager 7 project demonstrating these commands is available here.


HTTP methods​

Endpoints are divided into two categories:

  • GET + POST — retrieval/get-set endpoints that support both methods. The GET handler reads the current value; some endpoints require a target or accept formatting parameters. POST can also set values on endpoints that document a setter parameter. Retrieval-only endpoints remain read-only with either method.
  • POST only — action endpoints that trigger a state change and only accept POST.

GET + POST endpoints​

/status, /position, /remaining, /duration, /auto_play, /speed, /volume, /fade_duration, /sync_image_volume_fade, /visibility, /stereo_mode, /grid_mode, /background_image, /background_mode, /background_color, /background_image_stereo_mode, /background_image_grid_mode, /foreground_image, /foreground_image_stereo_mode, /foreground_image_grid_mode, /eof_mode, /loop_mode, /view_mode, /media_title, /audiotracks, /playing_in_audiotracks, /playlist, /playing_in_playlist, /sections, /playing_in_sections, /section_start_time, /section_end_time, /section_end_mode, /playfile_json, /playlist_json, /slide_name, /slides, /playing_in_slides, /slide_skipped, /slide_volume, /layers, /layer_volume, /layer_visibility, /layer_plane

POST only endpoints​

/quit, /play, /pause, /stop, /rewind, /seek, /fade_volume_down, /fade_volume_up, /fade_image_down, /fade_image_up, /spin_pitch_up, /spin_pitch_down, /spin_yaw_left, /spin_yaw_right, /spin_roll_ccw, /spin_roll_cw, /orientation_reset, /surface_transition, /slide_previous, /slide_next, /slide_skip_toggle, /load_from_audiotracks, /load_from_playlist, /load_from_sections, /load_from_slides, /select_from_slides, /slide_volume_fade_up, /slide_volume_fade_down, /layer_fade_in, /layer_fade_out (also accepted under their former names /layer_fade_up and /layer_fade_down)

The additional GET-only endpoints /tcp/servers, /tcp/commands, /event_topics and /events, and POST-only endpoints /tcp/connect, /tcp/disconnect, /tcp/trigger and /tcp/command, are documented in TCP connection and update control and Change subscriptions at the bottom of this page. The endpoints used by the presenter and movie views (/presentation_state, /slide_notes, /presentation_recent, /presentation_open_recent, /movie_state, /movie_cue, /movie_recent, /movie_open_recent and others) are documented in Presenter view and movie view.


General​

EndpointMethodParamsDescriptionReturns
/statusGET, POST—Check connection"OK"
/quitPOST—Quit C-Play"Quitting C-Play"
/media_titleGET, POST—Get current media titleTitle string
/playPOST—Play current media"Play"
/pausePOST—Pause current media"Pause"
/stopPOST—Stop/rewind to start"Stop/rewind"
/rewindPOST—Same as /stop"Stop/rewind"

Time & position​

EndpointMethodParamsDescriptionReturns
/positionGET, POSTformat= (optional) — e.g. hh:mm:ss/zzGet current positionSeconds or formatted string
set= (optional) — secondsSet position(same)
/seekPOSTtime= (required) — seconds (negative = backward)Seek relativeNew position
format= (optional)Formatted string
/remainingGET, POSTformat= (optional)Remaining timeSeconds or formatted string
/durationGET, POSTformat= (optional)Total durationSeconds or formatted string
/speedGET, POSTfactor= (optional) — 0.01–100Get or set playback speedSpeed factor
/auto_playGET, POSTon= (optional) — 1 or 0Get or set auto-play0/1, or confirmation message

Volume & visibility​

EndpointMethodParamsDescriptionReturns
/volumeGET, POSTlevel= (optional) — 0–100Get or set audio volumeVolume level (0–100)
/visibilityGET, POST—Get media visibilityValue (0–100)
/fade_durationGET, POSTformat= (optional)Get fade durationSeconds or formatted string
/fade_volume_downPOST—Fade volume to zero"Fading volume down"
/fade_volume_upPOST—Fade volume back up"Fading volume up"
/fade_image_downPOST—Fade media visibility to 0%"Fading image down"
/fade_image_upPOST—Fade media visibility to 100%"Fading image up"
/sync_image_volume_fadeGET, POSTvalue= (optional) — 1 or 0Get or set sync between volume and visibility fading0/1, or confirmation message

Media modes​

EndpointMethodParamsDescriptionReturns
/stereo_modeGET, POST—Get stereoscopic mode0–3 (see below)
/grid_modeGET, POST—Get grid/mapping mode0–4 (see below)
/eof_modeGET, POST—Get end-of-file mode (alias: /loop_mode)0–2 (see below)
/loop_modeGET, POST—Get end-of-file mode0–2 (see below)
/view_modeGET, POSTmode= (optional) — 0 or 1Get or set automatic/forced-2D stereo display0–1 (see below)

Stereo mode values:

ValueMode
02D (mono)
13D side-by-side
23D top-bottom
33D top-bottom-flip

Grid mode values:

ValueMode
0Pre-split
1Plane
2Dome
3Sphere EQR
4Sphere EAC

EOF mode values:

ValueMode
0Pause
1Continue to next
2Loop

View mode values:

This endpoint controls stereo display on the cluster. It does not select the master's flat, perspective, fisheye or sphere preview described in Views.

ValueMode
0Auto 2D/3D switch
1Force 2D for all

Background & foreground images​

EndpointMethodParamsDescriptionReturns
/background_imageGET, POSTon= (optional) — 1 or 0Get or set background visibility0/1, or confirmation message
/background_modeGET, POSTmode= (optional) — 0/image or 1/colorGet or set whether the background shows the background image or the background color. Setting a mode also turns the background on (image mode only when an image is set)0 (image) / 1 (color), or confirmation message
/background_colorGET, POSTcolor= (optional) — RRGGBB, %23RRGGBB or a color nameGet or set the background color used in color mode#rrggbb, or confirmation message
/background_image_stereo_modeGET, POST—Get background stereo mode0–3
/background_image_grid_modeGET, POST—Get background grid mode0–4
/foreground_imageGET, POSTon= (optional) — 1 or 0Get or set foreground visibility0/1, or confirmation message
/foreground_image_stereo_modeGET, POST—Get foreground stereo mode0–3
/foreground_image_grid_modeGET, POST—Get foreground grid mode0–4

Playlist​

EndpointMethodParamsDescriptionReturns
/playlistGET, POSTcharsPerItem= (optional)Get formatted playlistText list
/playing_in_playlistGET, POST—Current playlist indexIndex, or -1
/load_from_playlistPOSTindex= (required)Load playlist itemConfirmation or error

Audio tracks​

EndpointMethodParamsDescriptionReturns
/audiotracksGET, POSTcharsPerItem= (optional), removeLoadedFilePrefix=1 (optional)Get formatted audio track listText list
/playing_in_audiotracksGET, POST—Current audio track indexIndex, or -1
/load_from_audiotracksPOSTindex= (required)Load audio trackConfirmation or error

Sections​

EndpointMethodParamsDescriptionReturns
/sectionsGET, POSTcharsPerItem= (optional)Get formatted section listText list
/playing_in_sectionsGET, POST—Current section indexIndex, or -1
/load_from_sectionsPOSTindex= (required)Load sectionConfirmation or error
/section_start_timeGET, POSTformat= (optional)Current section start timeSeconds or formatted string
/section_end_timeGET, POSTformat= (optional)Current section end timeSeconds or formatted string
/section_end_modeGET, POST—Current section end mode0–4 (see below)

Section end mode values:

ValueMode
0Pause
1Fade out (then pause)
2Continue
3Next
4Loop

Slides & layers​

EndpointMethodParamsDescriptionReturns
/slide_nameGET, POST—Get current slide nameSlide name, or empty string
/slide_previousPOST—Step back through animation click steps, or go to the previous slide"Previous slide"
/slide_nextPOST—Play the next pending animation click step, or go to the next slide"Next slide"
/slidesGET, POSTcharsPerItem= (optional)Get formatted slide listText list
/playing_in_slidesGET, POST—Current slide index (-1 = master)Index
/select_from_slidesPOSTindex= (required)Select slide (pre-loads layers)Confirmation or error
/load_from_slidesPOSTindex= (required)Load/trigger slideConfirmation or error
/slide_skippedGET, POSTslide_idx= (-1 = master) or slide_name= (optional, default: selected slide), on= (optional, POST) — 1 or 0Get or set whether the slide is skipped. Skipped slides are passed over by next/previous; a skipped master slide is not rendered and its layers get zero opacity0/1, or confirmation message
/slide_volumeGET, POSTslide_idx= (-1 = master) or slide_name= (optional, default: selected slide), level= (optional, POST) — 0–100Get or set the slide volume, which scales the volume of the slide's own layersVolume level (0–100), or error
/slide_volume_fade_downPOSTslide_idx= (-1 = master) or slide_name= (optional, default: selected slide)Fade the slide volume down to 0 over the fade duration"Fading slide volume down" or error
/slide_volume_fade_upPOSTslide_idx= (-1 = master) or slide_name= (optional, default: selected slide)Fade the slide volume up over the fade duration, to the level the last fade down started from, or else to 100"Fading slide volume up" or error
/slide_skip_togglePOSTslide_idx= or slide_name= (optional, default: selected slide)Toggle whether the slide is skippedConfirmation or error
/layersGET, POSTslide_name= or slide_idx= (required), charsPerItem= (optional)Get formatted layer list for a slideText list
/layer_statesGET, POSTcharsPerItem= (optional, 0–4096, default 0)On/off/transition state of the layers of the selected slide (playing_in_slides; the master slide when it is -1), as the layer_states event topic sends itslide=2;0:ON;1:IN with charsPerItem=0, otherwise a fixed-width text list

Layer control​

All layer endpoints require a layer identifier and an optional slide identifier:

ParamDescription
layer_title=Layer title (name)
layer_idx=Layer index (alternative to title)
slide_name=Slide name (optional — defaults to master slide)
slide_idx=Slide index (optional — alternative to name, -1 for master)

To target a sublayer (e.g. a Division Mode cell or a Duplicate Mode copy), add one of:

ParamDescription
sub_layer_title=Sublayer title (e.g. Div_0_0, or 1 for the first duplicate)
sub_layer_idx=Sublayer index (0-based)

If neither sublayer param is provided, the parent layer is used. If the parent layer has no sublayers and a sublayer param is given, an error is returned.

EndpointMethodAdditional paramsDescriptionReturns
/layer_volumeGET, POSTlevel= (optional) — 0–100Get or set layer volumeVolume level (0–100)
/layer_visibilityGET, POSTvalue= (optional) — 0–100Get or set layer visibilityVisibility (0–100)
/layer_fade_inPOST—Show the layer as double-clicking it does: plays its entrance effects when it has any, otherwise fades its visibility up to 100 over the fade duration. Formerly /layer_fade_up, which still works"Fading layer in" or error
/layer_fade_outPOST—Hide the layer as double-clicking it does: plays its exit effects when it has any, otherwise fades its visibility down to 0 over the fade duration. Formerly /layer_fade_down, which still works"Fading layer out" or error
/layer_planeGET, POSTazimuth=, elevation=, roll=, distance=, horizontal=, vertical=, circular=, centreDegrees=, widthDegrees= (any combination)Get or set layer plane parameters. Send a param with no value to read.One value per param, newline-separated

circular accepts 0, 1, false or true. centreDegrees accepts finite, fractional and unwrapped angles; widthDegrees must be greater than 0 and at most 360. Empty values leave these new fields unchanged and return their current values. Nonempty invalid values return HTTP 400 before applying the plane update. The existing horizontal parameter keeps its centimetre meaning; use centreDegrees for circular placement. The shared mapping must also be enabled in Grid Settings.

For example, enable a 20° layer centred at 355°:

curl -X POST 'http://localhost:7007/layer_plane?slide_idx=0&layer_idx=0&circular=1&centreDegrees=355&widthDegrees=20'

The same parameters are accepted by the TCP Control Server. The structured layers event includes circular, centreDegrees and widthDegrees in each layer's plane data.

Spin & orientation​

EndpointMethodParamsDescriptionReturns
/orientation_resetPOST—Reset grid orientation to defaults"Origin Reset"
/surface_transitionPOSTformat= (optional)Run transition to alternative valuesTransition time
/spin_pitch_upPOSTon= — 1 or 0Enable/disable pitch upConfirmation or error
/spin_pitch_downPOSTon= — 1 or 0Enable/disable pitch downConfirmation or error
/spin_yaw_leftPOSTon= — 1 or 0Enable/disable yaw leftConfirmation or error
/spin_yaw_rightPOSTon= — 1 or 0Enable/disable yaw rightConfirmation or error
/spin_roll_ccwPOSTon= — 1 or 0Enable/disable roll counter-clockwiseConfirmation or error
/spin_roll_cwPOSTon= — 1 or 0Enable/disable roll clockwiseConfirmation or error

JSON​

EndpointMethodDescriptionReturns
/playfile_jsonGET, POSTCurrent media state as cplayfileJSON
/playlist_jsonGET, POSTFull playlistJSON

REST Layer​

The REST Layer is a non-visual layer type that fires an HTTP or WebSocket request when triggered as part of the slide/layer system. It exists on the master only and can be used to integrate external systems (lighting, projectors, other applications) into your slide workflow.

Properties​

PropertyDescription
URLTarget endpoint
MethodGET, POST, PUT, DELETE, WS, or WSS
ParametersA list of name/value pairs, each with individual UI fields that can be added or removed as needed
Ignore StatusOptional fire-and-forget behavior; C-Play assumes success after the request is sent or the connection opens

When a slide containing a REST layer is loaded, the layer sends the configured HTTP or WebSocket request on a background thread. Status is reported as: in-progress, success, or failure.

Configuring a REST layer​

In the layer editor, a REST layer can be configured in two ways:

  1. From predefined commands — Select a command from the dropdown populated by the REST Commands Editor (see below). This auto-fills URL, method, and parameters.
  2. Custom — Toggle to custom mode to manually enter URL, method, parameters, and ignore-status behavior.

REST Commands Editor​

The REST Commands Editor is a standalone window accessible from Settings → REST Commands Editor. It manages a list of predefined HTTP and WebSocket commands that can be used both for manual testing and as presets when configuring REST layers.

REST Commands Editor

Features​

  • Browse all predefined commands (title, method, URL)
  • Add, update, or remove commands
  • Trigger a command immediately and inspect the response (status code + body)
  • Use WS/WSS for WebSocket targets, including OBS WebSocket v5 commands

Command fields​

FieldDescription
TitleDisplay name for the command
URLFull endpoint URL
MethodGET, POST, PUT, DELETE, WS, or WSS
ParametersA list of name/value pairs with individual fields for each entry (supports values with spaces and special characters)
Ignore StatusDo not wait for the full response; useful for fire-and-forget launch/control commands

WebSocket and OBS commands​

For WS and WSS, C-Play opens the WebSocket URL and sends the configured parameters as a JSON text message. If the command is an OBS WebSocket v5 command, C-Play negotiates the obswebsocket.json subprotocol, sends the required Identify message, and then sends the OBS request.

OBS commands use these parameter names:

Parameter styleDescription
requestTypeOBS request name, for example SetCurrentProgramScene
requestData.nameAdds name to the OBS requestData object, for example requestData.sceneName = Browser
passwordOBS WebSocket password, if authentication is enabled
eventSubscriptionsOptional OBS event subscription bitmask used during Identify

The editor includes an OBS helper for switching profile, current program scene, and scene collection. Those helpers fill requestType and the correct requestData.* field for you.

Storage​

Commands are stored in data/predefined-rest-commands.json relative to the application working directory. The file format:

{
"commands": [
{
"enabled": true,
"ignoreStatus": false,
"method": "GET",
"title": "Get C-Play playlist",
"url": "http://localhost:7007/playlist",
"parameters": []
},
{
"enabled": true,
"ignoreStatus": false,
"method": "POST",
"title": "Force 2D in C-Play",
"url": "http://localhost:7007/view_mode",
"parameters": [{"name": "mode", "value": "1"}]
},
{
"enabled": true,
"ignoreStatus": false,
"method": "WS",
"title": "OBS - Set scene Browser",
"url": "ws://localhost:4455",
"parameters": [
{"name": "requestType", "value": "SetCurrentProgramScene"},
{"name": "requestData.sceneName", "value": "Browser"}
]
}
]
}

Commands with "enabled": false are skipped when loading. Parameters are stored as a JSON array of {"name": ..., "value": ...} objects, which allows values containing spaces and special characters. For POST/PUT requests parameters are sent as the request body; for GET/DELETE they are appended as query parameters; for WS/WSS they are converted to a JSON WebSocket message or an OBS WebSocket request.


TCP connection and update control​

These HTTP endpoints manage the outgoing TCP Control Client: its saved server profiles, connections and commands. They use the HTTP API port (default 7007), and return application/json with Cache-Control: no-store. The incoming TCP Control Server is a separate listener, normally on port 7008; its bind address and port are configured in TCP control settings.

EndpointMethodParametersResult
/tcp/serversGET—servers array containing saved profiles and runtime connection state.
/tcp/commandsGETserver_id (optional)commands array, optionally filtered to one saved server; includes command IDs, payloads, event topics, charsPerItem and any timeFormat.
/tcp/connectPOSTserver_idStart or resume connection attempts; HTTP 202 with success and server_id. The server must be enabled and the player active.
/tcp/disconnectPOSTserver_idDisconnect and suspend retries; HTTP 200 with success and server_id. Does not disable the saved profile.
/tcp/triggerPOSTserver_id, command_idSend one saved command on its server; HTTP 200 with success. Use command_id=all for a full state update.
/tcp/commandPOSTcommand_id, and charsPerItem and/or timeFormatSave the command's list width (integer 0–4096) and/or its time code format (for example hh:mm:ss; empty restores seconds; only for position, remaining and duration commands, see time format); HTTP 200 with success and the updated command object.

Obtain IDs from /tcp/servers and /tcp/commands. Server IDs are endpoints such as 127.0.0.1:9000 or [2001:db8::1]:9000; command IDs are stable saved identifiers. /tcp/trigger requires the command to belong to the specified server. /tcp/command changes only the width and time format of an existing command; it does not create a command or send it.

With command_id=all, C-Play reads one cached state snapshot and dispatches each command on that server with a nonempty eventTopics selection once. Commands without event topics are excluded. The response reports success, accepted and rejected counts, and a message. A full update requires an active event feed and a connected TCP server. C-Play sends the same full update automatically whenever a server connection is established or restored; requesting it manually is useful when the server needs a fresh state at another time.

charsPerItem=0 sends arrays and objects as compact JSON for commands using eventPayload: "value". Positive widths send numbered, padded or truncated list labels concatenated into one frame; the packaged list commands use 40. Scalars retain their usual value format. See EventModel formatting for details.

For example, list the definitions, connect to the saved example endpoint, then request a full update:

curl 'http://localhost:7007/tcp/servers'
curl 'http://localhost:7007/tcp/commands?server_id=127.0.0.1%3A9000'
curl -X POST 'http://localhost:7007/tcp/connect?server_id=127.0.0.1%3A9000'
# Wait until /tcp/servers reports the connection as connected.
curl -X POST 'http://localhost:7007/tcp/trigger?server_id=127.0.0.1%3A9000&command_id=all'

To change a list command's width, use the exact ID returned by /tcp/commands in place of COMMAND_ID:

curl -X POST 'http://localhost:7007/tcp/command?command_id=COMMAND_ID&charsPerItem=60'
curl -X POST 'http://localhost:7007/tcp/trigger?server_id=127.0.0.1%3A9000&command_id=COMMAND_ID'
curl -X POST 'http://localhost:7007/tcp/disconnect?server_id=127.0.0.1%3A9000'

Successful connect and trigger responses confirm that C-Play accepted the operation or transport write; they do not confirm connection completion or execution by the remote device. Invalid or missing parameters return HTTP 400, unknown IDs return 404, rejected operations or save failures return 409, and unavailable TCP control or a request timeout returns 503. Error responses contain success: false and a message; full-update responses retain their counts. Commands rejected while disconnected are not queued.

Change subscriptions​

The event feed exposes the same sampled state to HTTP, WebSocket and outgoing TCP subscribers. HTTP uses the configured API port (default 7007). Values are sampled every 100 ms on the ready master, so rapid changes may be coalesced.

EndpointMethodParametersResult
/event_topicsGET—JSON array of supported topic names.
/eventsGETtopics (optional), since (optional), wait (optional)JSON state snapshot or changes after a sequence cursor.

topics is a comma-separated list, such as volume,playing_in_slides,playlist; omit it or use * for all topics. Topic names include position, remaining, duration, pause, volume, mute, speed, playlist, sections, audiotracks, slides, layers, triggered_slide and main_video_load (see Starting playback on all nodes), plus presentation, movie and layerview in builds with the web views. Call /event_topics for the complete list. Unsupported topics return HTTP 400.

Initial snapshot and long polling​

Start without since to get current values:

curl 'http://localhost:7007/event_topics'
curl 'http://localhost:7007/events?topics=volume,pause'

A snapshot has this structure:

{"type":"snapshot","sequence":"42","values":{"volume":75,"pause":false},"events":[],"reset":false}

Use the returned sequence as since in the next request. since is an unsigned integer cursor represented as a string in responses. wait is an integer from 0 to 25000 milliseconds (default 0); with a valid cursor, a positive value waits for matching changes or the timeout:

curl 'http://localhost:7007/events?topics=volume,pause&since=42&wait=25000'

A change response has type: "events", the latest string sequence, values: {}, an events array, and reset: false. Each event contains type: "change", topic, value, previous, its string sequence, and a UTC timestamp. A timeout returns an empty events array. Repeat the request with the latest response's sequence; stopping requests ends polling without an explicit unsubscribe call.

The journal keeps the latest 512 events across all topics. A cursor that is too old or ahead of the current sequence returns reset: true with a fresh snapshot. Start again without since after restarting C-Play or changing topic selections. Invalid cursors or wait values return HTTP 400; an unavailable event feed returns 503. Successful /events responses use application/json and Cache-Control: no-store.

Event responses use native JSON numbers and booleans, and structured collection values. Playlist, track, section, slide and layer events refresh controller state; they do not reproduce the original REST text-list formatting. playing_in_slides follows the selected slide, while triggered_slide follows the slide actually triggered. layers covers all slides, including the master, and includes volume, visibility and plane properties.

Starting playback on all nodes​

When the master loads a new main video file, every cluster node connected over the DataTransfer channel (the datatransferport of the node, by default its port + 1000) reports back when it has the file open and its first frame rendered, or when it could not open it. C-Play holds playback until all of them have answered: the play button is disabled, and a play requested meanwhile (/play, a cue, auto play) starts once the nodes are ready. A file that was already playing when the next one loads (for example the next playlist item) is paused until then. Nodes that could not load the file do not hold playback but are logged; nodes that do not answer within 30 seconds stop holding it. Without connected nodes, with playback sync off, or for multi-video compositions, playback is not held.

The main_video_load topic follows this: {"id": 12, "ready": false, "timedOut": false, "nodes": 2, "waiting": ["10.0.0.11"], "failed": []}. nodes is the number of nodes the load waits for (0 when no node is connected or playback sync is off). id changes for every loaded file, so a client that loads a file can wait for a new id with ready: true before it fades in.

Optional event WebSocket listener​

To receive pushed events, add websocketPort to data/http-server-conf.json and enable HTTP:

{"run":"yes","port":7007,"websocketPort":7009}

Connect to ws://localhost:7009/events?topics=volume,triggered_slide. This is a separate WebSocket port, not the HTTP port or the TCP Control Server port. The listener sends an initial snapshot followed by individual matching change objects. Reconnect with a new URL to change topics; closing the connection unsubscribes, and reconnecting receives a fresh snapshot. It runs on the ready master, permits up to 16 subscribers and closes slow connections when pending output exceeds 1 MiB.

The outgoing TCP client's Get/Subscribe/Unsubscribe protocol offers access to this feed over an existing control connection. The incoming TCP Control Server accepts actions only and does not implement event queries or subscriptions.