Skip to main content
POST
/
browser_pools
/
{id_or_name}
/
acquire
JavaScript
import Kernel from '@onkernel/sdk';

const client = new Kernel({
  apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});

const response = await client.browserPools.acquire('id_or_name');

console.log(response.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>",
  "viewport": {
    "width": 1280,
    "height": 800,
    "refresh_rate": 60
  },
  "kiosk_mode": false,
  "deleted_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id_or_name
string
required

Browser pool ID or name

Body

application/json

Request body for acquiring a browser from the pool.

acquire_timeout_seconds
integer

Maximum number of seconds to wait for a browser to be available. Defaults to the calculated time it would take to fill the pool at the currently configured fill rate.

Response

Browser acquired successfully

created_at
string<date-time>
required

When the browser session was created.

cdp_ws_url
string
required

Websocket URL for Chrome DevTools Protocol connections to the browser session

Example:

"wss://api.onkernel.com/browser/cdp?jwt=eyJ0eXAi..."

headless
boolean
required

Whether the browser session is running in headless mode.

Example:

false

stealth
boolean
required

Whether the browser session is running in stealth mode.

Example:

false

session_id
string
required

Unique identifier for the browser session

Example:

"htzv5orfit78e1m2biiifpbv"

timeout_seconds
integer
required

The number of seconds of inactivity before the browser session is terminated.

browser_live_view_url
string

Remote URL for live viewing the browser session. Only available for non-headless browsers.

Example:

"https://api.onkernel.com/browser/remote?jwt=eyJ0eXAi..."

gpu
boolean

Whether the browser session has hardware-accelerated GPU rendering.

Example:

false

persistence
object
deprecated

DEPRECATED: Use timeout_seconds (up to 72 hours) and Profiles instead.

profile
object

Browser profile metadata.

proxy_id
string

ID of the proxy associated with this browser session, if any.

viewport
object

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).

kiosk_mode
boolean

Whether the browser session is running in kiosk mode.

Example:

false

deleted_at
string<date-time>

When the browser session was soft-deleted. Only present for deleted sessions.