Close Session

Close an Existing Session

POST /session/close

This endpoint closes an existing session and returns the session ID. A valid session ID must be provided to close the session.

Request Example:

bashCopyEditcurl --location \
--request POST 'https://api.cros.one/session/close' \
--header 'Authorization: Bearer your-api-key' \
--header 'Content-Type: application/json' \
--data '{
  "session_id": "1234567890abcdef",
  "keep_alive": false,
  "session_timeout_minutes": 10,
  "screenshot": true
}'

Response:

jsonCopyEdit{
  "session_id": "1234567890abcdef",
  "status": "closed",
  "created_at": "2025-02-06T14:00:00.000Z",
  "last_accessed_at": "2025-02-06T14:05:00.000Z",
  "duration": "5 minutes",
  "timeout_minutes": 10,
  "error": null
}

Fields in the Request Body:

  • keep_alive (boolean, default: false): If true, the session will not be closed after the operation is completed.

  • screenshot (boolean | null): Whether to include a screenshot in the response.

  • session_id (string): The ID of the session to close.

  • session_timeout_minutes (integer, default: 5): Session timeout in minutes. The timeout cannot exceed the global timeout. Allowed range: 0 < x < 30.

Fields in the Response:

  • session_id (string): The ID of the session (created or existing). Use this ID to interact with the session for the next operation.

  • status (string): The status of the session. Available options: active, closed, error, timed_out.

  • created_at (string): The timestamp when the session was created.

  • last_accessed_at (string): The timestamp of the last session access.

  • duration (string): The session duration.

  • timeout_minutes (integer): Session timeout in minutes.

  • error (string | null): An error message if the operation failed.

Last updated