Sunshine latest
Self-hosted game stream host for Moonlight.
API

Sunshine has a RESTful API which can be used to interact with the service.

Unless otherwise specified, authentication is required for all API calls. You can authenticate using basic authentication with the admin username and password.

GET /api/apps

Get the list of available applications.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

GET /api/logs

Get the logs from the log file.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/apps

Save an application. To save a new application the index must be -1. To update an existing application, you must provide the current index of the application.

Parameters
responseThe HTTP response object.
requestThe HTTP request object. The body for the post request should be JSON serialized in the following format:
{
"name": "Application Name",
"output": "Log Output Path",
"cmd": "Command to run the application",
"index": -1,
"exclude-global-prep-cmd": false,
"elevated": false,
"auto-detach": true,
"wait-all": true,
"exit-timeout": 5,
"prep-cmd": [
{
"do": "Command to prepare",
"undo": "Command to undo preparation",
"elevated": false
}
],
"detached": [
"Detached command"
],
"image-path": "Full path to the application image. Must be a png file."
}

DELETE /api/apps/{index}

Delete an application.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/covers/upload

Upload a cover image.

Parameters
responseThe HTTP response object.
requestThe HTTP request object. The body for the post request should be JSON serialized in the following format:
{
"key": "igdb_<game_id>",
"url": "https://images.igdb.com/igdb/image/upload/t_cover_big_2x/<slug>.png"
}

GET /api/config

Get the configuration settings.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

GET /api/configLocale

Get the locale setting. This endpoint does not require authentication.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/config

Save the configuration settings.

Parameters
responseThe HTTP response object.
requestThe HTTP request object. The body for the post request should be JSON serialized in the following format:
{
"key": "value"
}
Attention
It is recommended to ONLY save the config settings that differ from the default behavior.

POST /api/restart

Restart Sunshine.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/reset-display-device-persistence

Reset the display device persistence.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/password

Update existing credentials.

Parameters
responseThe HTTP response object.
requestThe HTTP request object. The body for the post request should be JSON serialized in the following format:
{
"currentUsername": "Current Username",
"currentPassword": "Current Password",
"newUsername": "New Username",
"newPassword": "New Password",
"confirmNewPassword": "Confirm New Password"
}

POST /api/pin

Send a pin code to the host. The pin is generated from the Moonlight client during the pairing process.

Parameters
responseThe HTTP response object.
requestThe HTTP request object. The body for the post request should be JSON serialized in the following format:
{
"pin": "<pin>",
"name": "Friendly Client Name"
}

POST /api/clients/unpair-all

Unpair all clients.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/clients/unpair

Unpair a client.

Parameters
responseThe HTTP response object.
requestThe HTTP request object. The body for the post request should be JSON serialized in the following format:
{
"uuid": "<uuid>"
}

GET /api/clients/list

Get the list of paired clients.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.

POST /api/apps/close

Close the currently running application.

Parameters
responseThe HTTP response object.
requestThe HTTP request object.