Skip to main content

Creating Browser Instance

Description: This method creates the new browser instance using the specified profile with optional workspace and desktop settings.

Request parameters:​

ParameterTypeFormatDefaultDescription
profileIdstringuuid(required)Unique identifier of the profile to associate with the browser instance (required).
workspaceIdintegerint64-1Workspace identifier. -1 means the default workspace.
desktopNamestring(empty)The name of the desktop environment (optional). Defaults to empty.
threadTokenstring(empty)Thread token for the browser instance. To create a new execution thread, pass an empty string (default).
environmentTagsstring(empty)Tags to configure the environment for the browser instance.
commandLineArgumentsstring(empty)Custom command line arguments to pass to the browser on startup
customFeaturesstring(empty)Optional JSON object containing browser feature overrides. Overrides features read from the environment.

Example request:​

POST
CURL:

curl 'http://localhost:8160/v1/browser_instances/create?profileId=123e4567-e89b-12d3-a456-426614174000&workspaceId=-1&desktopName=Desktop%201&threadToken=thread-token-1&environmentTags=&commandLineArguments=--disable-gpu&customFeatures=%7B%7D' \
--request POST \
--header 'Api-Token: YOUR_SECRET_TOKEN'

C#:

using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:8160/v1/browser_instances/create?profileId=123e4567-e89b-12d3-a456-426614174000&workspaceId=-1&desktopName=Desktop%201&threadToken=thread-token-1&environmentTags=&commandLineArguments=--disable-gpu&customFeatures=%7B%7D"),
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/create?profileId=PROFILE_ID&workspaceId=-1&desktopName=&threadToken=&environmentTags=&commandLineArguments=&customFeatures={}

Additionally:
User-Agent: {-Profile.UserAgent-}
Api-Token: Token from UserArea2.

Response API:​

Response codeResult
200 OKOK
401 UnauthorizedUnauthorized
403 ForbiddenForbidden
500 Internal Server ErrorInternal Server Error

Success Response (200 OK):

{
"profileId": "123e4567-e89b-12d3-a456-426614174000",
"processId": 1,
"connectionString": "ws://127.0.0.1:12345/devtools/browser/example"
}

Error Response (500):

{
"message": null
}