> [!info] Available only on SPX Broadcast license. See [Products](https://spxgraphics.com/software/)
SPX Server API is a set of REST API endpoints from SPX Broadcast Server for advanced system integrations such as MOS and also for completely automated workflows.
Server API endpoints targets SPX Server directly and no open browser with Graphics Controller is needed.
---
> [!example]- POST `/api/v1/directplayout`
> Populate template and execute a play/continue/stop command. Note the optional `updateRundownItem` property. `updateRundownItem.itemID` can be used to force UI updates and persist data to a rundown file. **Special characters in values are not supported at the moment.**
>``` json
// Stringified JSON
>{
> "casparServer": "OVERLAY",
> "casparChannel": "1",
> "casparLayer": "20",
> "webplayoutLayer": "20",
> "relativeTemplatePath": "/vendor/pack/template.html",
> "out": "manual",
> "DataFields": [
> {
> "field": "f0",
> "value": "Firstname"
> },
> {
> "field": "f1",
> "value": "Lastname"
> }
> ],
> "command": "play",
> "updateRundownItem": {
> "updateUI": true,
> "itemID": "myItemID",
> "persist": true,
> "project": "myFirstProject",
> "rundown": "myFirstRundown"
> }
>}
---
> [!example]- GET `/api/v1/controlRundownItemByID?file=MyFirstProject/MyFirstRundown&item=1234567890&command=play`
> Play / next / stop / preview / preview-next an item from a known rundown. (Rundown items can be renamed in the SPX GUI.)
---
> [!example]- GET `/api/v1/objectDBPlayout/1234567890?command=play`
> Play / next / stop / preview / preview-next a graphic element based on its MOS ID. Reserved for Studio Automation systems.
---
> [!example]- GET `/api/v1/rundown/get`
> Returns the currently active rundown as JSON.
---
> [!example]- GET `/api/v1/rundown/json?project=MyFirstProject&rundown=FirstRundown`
> Returns the content of a specific rundown as JSON data.
---
> [!example]- POST `/api/v1/rundown/json`
> Creates or updates a rundown file. `body.content` must contain valid rundown JSON data.
> This endpoint has some mandatory fields:
> - body.project = A name of an existing project in SPX ('myProject')
>- body.file = The rundown name ('myRundown')
>- body.templates = Array of templates
>- body.templates[index].relpath = Relative path to a template file
>- body.templates[index].DataFields = Array of fTypes for each template
>
> If any of these properties are missing a rundown file will not be generated and an error response is sent and the error is logged.
>
> It is highly recommended to pass all project- and template properties, to avoid populating everything with default values provided by the API.
> ``` json
>// Stringified JSON
> {
> "project": "myProject",
> "file": "myRundown",
> "content" : {
> "comment" : "Hello from myApp",
> "templates": [
> {
> "relpath": "/brand/project/template.html",
> "DataFields": [
> {
> "field": "f0",
> "ftype": "textfield",
> "title": "Fullname",
> "value": "First Frank"
> }
> ]
> },
> {
> "relpath": "/brand/project/template.html",
> "DataFields": [
> {
> "field": "f0",
> "ftype": "textfield",
> "title": "Fullname",
> "value": "Second Steve"
> }
> ]
> }
> ]
> }
> }
---
> [!example]- GET `/api/v1/getlayerstate`
> Returns the current memory state of web-playout layers on the server (not UI).
---
> [!example]- GET `/api/v1/allrundowns`
> Returns all projects and rundowns.
---
> [!example]- GET `/api/v1/getprojects`
> Returns project names as an array of strings.
---
> [!example]- GET `/api/v1/getProjectProfile?project=MyFirstProject`
> Returns the profile of a specific project as JSON data.
---
> [!example]- GET `/api/v1/getrundowns?project=MyFirstProject`
> Returns rundown names for a given project as an array of strings.
---
> [!example]- GET `/api/v1/gettemplates?project=MyFirstProject`
> Returns templates and their settings from a given project.
---
> [!example]- GET `/api/v1/executeScript?file=win-open-calculator.bat`
> Executes a shell script or batch file from the `ASSETS/scripts` folder.
---
> [!example]- GET `/api/v1/getFileList?assetsfolder=excel`
> Returns an array of filenames found in a given subfolder of ASSETS.
---
> [!example]- POST `/api/v1/saveCustomJSON`
> Creates or updates a JSON file in the ASSETS folder or a provided subpath.
> ``` json
>// Stringified JSON
>{
> "path": "todoApp",
> "filename": "myData.json",
> "content": {
> "note": "Get these done by the end of month",
> "items": [
> {
> "task": "Grow a beard",
> "done": false
> },
> {
> "task": "Get a haircut",
> "done": true
> }
> ]
> }
>}
---
> [!example]- POST `/api/v1/uploadAsset?path=media/images`
> Uploads an image file to the ASSETS folder. Use `multipart/form-data`. Supported formats: JPEG, PNG, SVG, GIF, WEBP.
---
## Read Next
- [[Control API|Control API]] - UI control endpoints
- [[Common API|Common API]] - Utility endpoints
- [[Documentation/Control Interfaces/REST/Overview of SPX API|API Overview]] - Complete API guide
- [[Documentation/Control Interfaces/External Control|External Control]] - Hardware controller integration