Skip to main content
The getSessionId() method returns the unique session ID associated with your active sandbox connection. This ID identifies the live session currently linked to your WebSocket connection.

getSessionId()

Description: Returns the current sandbox session ID, or null if not connected. Parameters: None Returns: string | null - Session ID or null Example:
await sandbox.create({ shouldBackupFilesystem: false })
console.log(sandbox.getSessionId()) // 'session-abc123'
Session ID is different from snippet ID. Session is temporary, snippet is persistent.