import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});
const browser = await client.browsers.update('htzv5orfit78e1m2biiifpbv');
console.log(browser.session_id);{
"created_at": "2023-11-07T05:31:56Z",
"cdp_ws_url": "wss://api.onkernel.com/browser/cdp?jwt=eyJ0eXAi...",
"headless": false,
"stealth": false,
"session_id": "htzv5orfit78e1m2biiifpbv",
"timeout_seconds": 123,
"browser_live_view_url": "https://api.onkernel.com/browser/remote?jwt=eyJ0eXAi...",
"gpu": false,
"persistence": {
"id": "my-awesome-browser-for-user-1234"
},
"profile": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z"
},
"proxy_id": "<string>",
"pool": {
"id": "<string>",
"name": "<string>"
},
"viewport": {
"width": 1280,
"height": 800,
"refresh_rate": 60
},
"kiosk_mode": false,
"deleted_at": "2023-11-07T05:31:56Z",
"usage": {
"uptime_ms": 123
}
}Update a browser session.
import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});
const browser = await client.browsers.update('htzv5orfit78e1m2biiifpbv');
console.log(browser.session_id);{
"created_at": "2023-11-07T05:31:56Z",
"cdp_ws_url": "wss://api.onkernel.com/browser/cdp?jwt=eyJ0eXAi...",
"headless": false,
"stealth": false,
"session_id": "htzv5orfit78e1m2biiifpbv",
"timeout_seconds": 123,
"browser_live_view_url": "https://api.onkernel.com/browser/remote?jwt=eyJ0eXAi...",
"gpu": false,
"persistence": {
"id": "my-awesome-browser-for-user-1234"
},
"profile": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z"
},
"proxy_id": "<string>",
"pool": {
"id": "<string>",
"name": "<string>"
},
"viewport": {
"width": 1280,
"height": 800,
"refresh_rate": 60
},
"kiosk_mode": false,
"deleted_at": "2023-11-07T05:31:56Z",
"usage": {
"uptime_ms": 123
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Browser session ID
Request body for updating a browser session.
ID of the proxy to use. Omit to leave unchanged, set to empty string to remove proxy.
Profile to load into the browser session. Only allowed if the session does not already have a profile loaded.
Show child attributes
Viewport configuration to apply to the browser session.
Show child attributes
Browser session updated successfully
When the browser session was created.
Websocket URL for Chrome DevTools Protocol connections to the browser session
"wss://api.onkernel.com/browser/cdp?jwt=eyJ0eXAi..."
Whether the browser session is running in headless mode.
false
Whether the browser session is running in stealth mode.
false
Unique identifier for the browser session
"htzv5orfit78e1m2biiifpbv"
The number of seconds of inactivity before the browser session is terminated.
Remote URL for live viewing the browser session. Only available for non-headless browsers.
"https://api.onkernel.com/browser/remote?jwt=eyJ0eXAi..."
Whether the browser session has hardware-accelerated GPU rendering.
false
DEPRECATED: Use timeout_seconds (up to 72 hours) and Profiles instead.
Show child attributes
Browser profile metadata.
Show child attributes
ID of the proxy associated with this browser session, if any.
Browser pool this session was acquired from, if any.
Show child attributes
Initial browser window size in pixels with optional refresh rate. If omitted, image defaults apply (1920x1080@25). Arbitrary viewport dimensions are accepted, but the following configurations are known-good and fully tested: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60. Viewports outside this list may exhibit unstable live view or recording behavior. If refresh_rate is not provided, it will be automatically determined based on the resolution (higher resolutions use lower refresh rates to keep bandwidth reasonable).
Show child attributes
Whether the browser session is running in kiosk mode.
false
When the browser session was soft-deleted. Only present for deleted sessions.
Session usage metrics.
Show child attributes