> For the complete documentation index, see [llms.txt](https://docs.dolphin-anty.com/llms.txt).
> Use it to discover all available pages before exploring further.

# Basic Automation Dolphin {anty}

## General information 📜

Browser profiles based on the "Anty" engine support launching with DevTools Protocol enabled. This allows you to connect to a profile through a port generated at startup and automate the browser using tools like **Puppeteer, Playwright, Selenium**, and others.

Basic automation includes three steps:

1. Start a profile via API with DevTools Protocol enabled.
2. Connect to the profile’s port using an automation tool (Puppeteer, Playwright, Selenium, Postman, etc.).
3. Run your own automation script through the open connection.

<Callout kind="alert" collapsed="false">
  ℹ️ To use **Dolphin&#123;anty}** automation, the app must be running and authorized. Authorization can be done with login/password or programmatically via a token. You can create a token in your [personal account](https://dolphin-anty.com/panel/#/api).
</Callout>

Request parameters for token authorization:

To avoid a 401 error, you must send a request
**Method:** `POST`
**URL:** `http://localhost:3001/v1.0/auth/login-with-token`
**Header:** `Content-Type: application/json`
**Body**:

```json
{ "token": "API_TOKEN"}
```

<Callout kind="alert" collapsed="false">
  Replace `API_TOKEN` with your actual token from your Dolphin&#123;anty} [account on our site](https://dolphin-anty.com/panel/#/api).
</Callout>

The same can be done without code, through an AI agent. The agent can manage profiles via [Dolphin MCP](/en/api/dolphin-mcp) and act inside a profile via [chrome-devtools-mcp](/en/api/connecting-chrome-devtools-mcp-to-dolphin-anty).

## **ChromeDriver ⬇️**

ChromeDriver is the bridge between your script _(e.g., Selenium)_ and the **Dolphin&#123;anty}** browser. The standard driver can reveal automation, so we provide our own modified ChromeDriver for each browser version.

[Download ChromeDriver](https://anty-browser.s3.eu-central-1.amazonaws.com/chromedriver.zip)

## Examples of authorization request ⚙️

<Expandable title="JavaScript example ▶️" default-open="false">
  ```javascript
  const axios = require('axios')
  const apiUrl = 'http://localhost:3001/v1.0/auth/login-with-token'
  const token = 'API_TOKEN'
  const requestData = {token: token}

  axios.post(apiUrl, requestData, {
  headers: {'Content-Type': 'application/json'}
  }).then(response => {
  console.log('OK ', response.data)
  })
  .catch(error => {
  console.error('Error ', error)})
  ```
</Expandable>

<Expandable title="Python example 🐍" default-open="false">
  ```python
  import requests
  api_url = 'http://localhost:3001/v1.0/auth/login-with-token'
  token = 'API_TOKEN'
  request_data = {'token': token}
  headers = {'Content-Type': 'application/json'}

  response = requests.post(api_url, json=request_data, headers=headers)
  if response.status_code == 200:
  print('OK ', response.json())
  else:
  print('Error ', response.status_code)
  ```
</Expandable>

<Expandable title="Java example ☕️" default-open="false">
  ```java
  import java.net.URI;
  import java.net.http.*;

  public class Main {
  public static void main(String[] args) throws Exception {
  var client = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();

  var req = HttpRequest.newBuilder(URI.create("http://localhost:3001/v1.0/auth/login-with-token"))
  .header("Content-Type", "application/json")
  .header("Accept", "application/json")
  .POST(HttpRequest.BodyPublishers.ofString(
  "{"token":"API_TOKEN"}"
  ))
  .build();

  var res = client.send(req, HttpResponse.BodyHandlers.ofString());
  System.out.println("OK " + res.statusCode());
  System.out.println("Body: " + res.body());}}
  ```
</Expandable>

<Expandable title="GO example 🏃" default-open="false">
  ```go
  package main
  import (
  "bytes"
  "fmt"
  "io"
  "net/http"
  )

  func main() {
  url := "http://localhost:3001/v1.0/auth/login-with-token"
  data := []byte(`{"token":"API_TOKEN"}`)
  r, e := http.Post(url, "application/json", bytes.NewBuffer(data))
  if e != nil {
  fmt.Println("Error:", e)
  return
  }
  defer r.Body.Close()
  b, _ := io.ReadAll(r.Body)
  if r.StatusCode == http.StatusOK {
  fmt.Println("OK", string(b))
  } else {
  fmt.Println("Error", r.Status, string(b))
  }}
  ```
</Expandable>

<Callout kind="success" collapsed="false">
  ✅ If successful, the response will be:

  ```json
  {"success": true}
  ```
</Callout>

## Step 1 — Start a profile via API ▶️

To start a browser profile via API, send a **GET** request:

```text
​http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/start?automation=1
```

For **headless mode:**

```text
​http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/start?automation=1&headless=1​
```

1. `PROFILE_ID` - the profile’s ID (you can get it [via the API](https://docs.dolphin-anty-cdn.com/index.html#tag/browser-profiles/get/browser_profiles/list-cursor) or in the Dolphin&#123;anty} app when editing a profile).
2. `automation=1` - required for automation.

Example of starting via Postman by sending a request:

<Image src="https://blob-cdn.documentation.ai/org-b2f37710-00c3-4887-bdd3-fa9df0f7d2f5/doc-fc6e4dd8-a218-43a3-a43e-fb5a676252ba/1777552352276-0xqlxcv2tz89-image.png?fm=auto&auto=compress%2Cformat" width="1186" height="411" alt="" priority={true} fetchPriority="high" />

<Callout kind="alert" collapsed="false">
  **⚠️ Important notes:**

  1. Local API works only if Dolphin&#123;anty} is running.
  2. Requests must be sent from the same machine where the browser runs.
  3. By default, the local API uses port 3001; if busy, another port is assigned (check in the **Health** window in Dolphin&#123;anty}).
  4. **On the Free plan**, API automation doesn't work: profiles with the "automation" flag won't start, and cookie import/export via API isn't available either. To use automation, you need any paid plan, starting with Starter.
  5. **Request limits (rate limit):** 1500 requests per minute
</Callout>

## API Response ✅

If the profile was started successfully, the response will look approximately like this _(the values of the_ **_port_** _and_ **_wsEndpoint_** _fields may vary)_:

```json
{
 "success": true,
  "automation": {
    "port": 50568,
    "wsEndpoint": "/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969" }}​
```

## Step 2 — Connect to the profile 🔌

## Puppeteer

<Image src="https://blob-cdn.documentation.ai/org-b2f37710-00c3-4887-bdd3-fa9df0f7d2f5/doc-fc6e4dd8-a218-43a3-a43e-fb5a676252ba/1777552355435-ntd0gbtt1il-image.png?fm=auto&auto=compress%2Cformat" width="952" height="446" alt="" priority={true} fetchPriority="high" />

[Puppeteer](https://github.com/puppeteer/puppeteer) — Popular Google library for browser UI automation and testing. Originally made for launching Chrome and verifying UI, but supports almost any browser actions. **Requires JavaScript/Node.js knowledge.**

<Expandable title="Code example:" default-open="false">
  ```javascript
  const puppeteer = require('puppeteer-core');

  (async () => {
    // PUT YOUR port HERE
    const port = 50568;

    // PUT YOUR wsEndpoint HERE
    const wsEndpoint = '/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969';

    // DIRECT CONNECTION
    const browser = await puppeteer.connect({
      browserWSEndpoint: `ws://127.0.0.1:${port}${wsEndpoint}`
    });

    // FROM THIS MOMENT YOU CAN AUTOMATE WHATEVER YOU WANT
    // FOR EXAMPLE, TAKE A SCREENSHOT OF GOOGLE
    const page = await browser.newPage();
    await page.goto('https://google.com');
    await page.screenshot({ path: 'google.png' });

    await browser.close();
  })();
  ```
</Expandable>

## Playwright

<Image src="https://blob-cdn.documentation.ai/org-b2f37710-00c3-4887-bdd3-fa9df0f7d2f5/doc-fc6e4dd8-a218-43a3-a43e-fb5a676252ba/1777552358066-p7g6s15aycr-Playwright_logo_long-1024x206.png?fm=auto&auto=compress%2Cformat" width="1024" height="206" alt="" />

[Playwright](https://playwright.dev/) - A newer, modern alternative to Puppeteer by Microsoft with similar API and functionality.

<Expandable title="Code example:" default-open="false">
  ```javascript
  const { chromium } = require('playwright');

  (async () => {
    // PUT YOUR port HERE
    const port = 50568;

    // PUT YOUR wsEndpoint HERE
    const wsEndpoint = '/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969';

    // DIRECT CONNECTION
    const browser = await chromium.connectOverCDP(`ws://127.0.0.1:${port}${wsEndpoint}`);

    // FROM THIS MOMENT YOU CAN AUTOMATE WHATEVER YOU WANT
    // FOR EXAMPLE, TAKE A SCREENSHOT OF GOOGLE
    const page = await browser.contexts()[0].newPage();
    await page.goto('https://google.com');
    await page.screenshot({path: 'google.png'});
    await browser.close();
  })();
  ```
</Expandable>

## Selenium

<Image src="https://blob-cdn.documentation.ai/org-b2f37710-00c3-4887-bdd3-fa9df0f7d2f5/doc-fc6e4dd8-a218-43a3-a43e-fb5a676252ba/1777552360558-w7a9cww5fs-image.png?fm=auto&auto=compress%2Cformat" width="1438" height="418" alt="" />

Connecting Selenium to a running browser is described [in this article](https://cosmocode.io/how-to-connect-selenium-to-an-existing-browser-that-was-opened-manually/). It’s worth noting that Selenium uses the standard ChromeDriver, but websites can detect automation. Therefore, we recommend using our ChromeDriver — [download it](https://anty-browser.s3.eu-central-1.amazonaws.com/chromedriver.zip) and specify its path in your code to hide Selenium usage.

## Step 3 — Stop a profile ⛔️

To stop a browser profile via API, send a **GET request**:

```text
 http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/stop
```

<Callout kind="info" collapsed="false">
  **Useful links 🔗**

  [✨ Sign up for Dolphin &#123;anty}](https://dolphin-anty.com/panel/#/auth/registration?utm_source=intercom\&utm_medium=help_center\&utm_campaign=footer\&utm_content=enregistration)

  [✨ Support service in Telegram](https://dolp.link/helpcentrsuppen)

  [✨ Telegram community chat](https://dolp.link/helpcentrchaten)

  [Download Dolphin &#123;anty} ❤️](https://dolphin-anty.com/download/?utm_source=intercom\&utm_medium=help_center\&utm_campaign=footer\&utm_content=endownload)
</Callout>
