Getting Running Browser Instance
Please read the Material Usage Rules on this site.
Description: This method returns the running browser instance data for the specified profile. The connectionString field contains the WebSocket connection string for connecting to the browser through the Chrome DevTools Protocol (CDP), while processId contains the browser process identifier (PID). If no browser instance is currently running for the profile, the API returns an error.
Request parameters:
| Parameter | Type | Format | Default | Description |
|---|---|---|---|---|
| profileId | string | uuid | (required) | Unique identifier of the profile. |
| workspaceId | integer | int64 | -1 | Workspace identifier. -1 means the default workspace. |
Example request:
POST
CURL:
curl 'http://localhost:8160/v1/browser_instances/get_running?profileId=123e4567-e89b-12d3-a456-426614174000&workspaceId=-1' \
--request POST \
--header 'Api-Token: YOUR_SECRET_TOKEN'
C#:
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:8160/v1/browser_instances/get_running?profileId=123e4567-e89b-12d3-a456-426614174000&workspaceId=-1"),
Headers =
{
{ "Api-Token", "YOUR_SECRET_TOKEN" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
Cube:
http://localhost:8160/v1/browser_instances/get_running?profileId=123e4567-e89b-12d3-a456-426614174000&workspaceId=-1
Additionally:
User-Agent: {-Profile.UserAgent-}
Api-Token: Token from UserArea2.
Response API:
| Response code | Result |
|---|---|
200 OK | OK |
401 Unauthorized | Unauthorized |
403 Forbidden | Forbidden |
409 Conflict | No browser instance is running for the specified profile |
500 Internal Server Error | Internal Server Error |
Response fields:
| Field | Type | Format | Description |
|---|---|---|---|
| connectionString | string | WebSocket connection string for connecting to the browser through the Chrome DevTools Protocol (CDP). | |
| processId | integer | int32 | Browser process identifier (PID). |
| profileId | string | uuid | Unique identifier of the profile. |
Success Response (200 OK):
{
"connectionString": "ws://127.0.0.1:12345/devtools/browser/example",
"processId": 1234,
"profileId": "123e4567-e89b-12d3-a456-426614174000"
}
Error Response (500):
{
"message": null
}