Skip to main content
Close session
import requests

url = 'https://api.simplex.sh/close_session'
headers = {
    'X-API-Key': 'your_api_key_here'
}
data = {
    'session_id': 'your_session_id'
}

response = requests.post(url, headers=headers, data=data)
print(response.json())
{
  "success": true
}
Closes a running session. Stops the agent, saves state, and sets the session status to Stopped. The call blocks until the container confirms the close or a timeout forces the status update. If the container has already exited, the endpoint directly updates the session status to Stopped and returns immediately.

Authorizations

X-API-Key
string
header
required

Simplex API Key

Body

application/json
session_id
string<uuid>
required

The ID of the session to connect to.

Response

Close Session response

success
boolean

Indicates if the session was successfully closed.

Example:

true