Terminate a Session

This API command can be used to terminate any active session on a Plex server. Once the session is terminated, the client will receive a message on the screen indicating that the playback session has been terminated. The message that is display on the client's screen will also contain the reason provided by this command.

URL

GET http://[IP address]:32400/status/sessions/terminate?sessionId=[Session ID]&reason=[Message String]&X-Plex-Token=[PlexToken]

Parameters

NameDescription
IP addressThe IP address of the Plex Media server.
PlexTokenThe authentication Plex token.
Session IDThe key associated with a session. This key can be found by calling the Active Sessions API command and looking for the session.
Message StringThis is the message that will be sent to the client associated with the terminated session. Any special characters will need to be encoded. For example, a space will need to be encoded to %20.

Return Status

HTTP CodeDescription
200Success - The request was successful.
400Bad Request - A parameter was not specified, or was specified incorrectly.
401Unauthorized - The Plex token provided was not valid.

Response

No response is returned when a session is terminated. Check for a return status code of 200 to determine if the API call was successful.

Remarks

The 'i' in the parameter sessionId is capitalized. Using a lowercase 'i' will cause the request to return a status code of 400, and the session won't terminate.

Examples

curl -X GET http://[IP address]:32400/status/sessions/terminate?sessionId=[Session ID]&reason=[Message String]&X-Plex-Token=[PlexToken]
import requests
plex_url = http://[IP address]:32400/status/sessions/terminate?sessionId=[Session ID]&reason=[Message String]&X-Plex-Token=[PlexToken]
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://[IP address]:32400/status/sessions/terminate?sessionId=[Session ID]&reason=[Message String]&X-Plex-Token=[PlexToken]' -Method 'GET'
Write-Output $response
Subscribe
Display