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={id}&reason={message}&X-Plex-Token={plex_token}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex token.
idThe key associated with a session. This key can be found by calling the Active Sessions API command and looking for the session.
messageThis 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={id}&reason={message}&X-Plex-Token={plex_token}
import requests
plex_url = http://{ip_address}:32400/status/sessions/terminate?sessionId={id}&reason={message}&X-Plex-Token={plex_token}
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/status/sessions/terminate?sessionId={id}&reason={message}&X-Plex-Token={plex_token}' -Method 'GET'
Write-Output $response

Script examples

Below are a list of post and articles that provide an example that use this API endpoint:

Subscribe
Display