POST
/
browsers
JavaScript
import Kernel from '@onkernel/sdk';

const client = new Kernel({
  apiKey: 'My API Key',
});

const browser = await client.browsers.create();

console.log(browser.session_id);
{
  "created_at": "2023-11-07T05:31:56Z",
  "cdp_ws_url": "wss://api.onkernel.com/browser/cdp?jwt=eyJ0eXAi...",
  "browser_live_view_url": "https://api.onkernel.com/browser/remote?jwt=eyJ0eXAi...",
  "headless": false,
  "stealth": false,
  "session_id": "htzv5orfit78e1m2biiifpbv",
  "persistence": {
    "id": "my-awesome-browser-for-user-1234"
  },
  "timeout_seconds": 123,
  "profile": {
    "id": "<string>",
    "name": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "last_used_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.

Body

application/json

Parameters for creating a browser session. Specify at most one of "persistence" or "profile". These options are mutually exclusive; if both are provided the request is invalid.

Response

Successful response

The response is of type object.