Skip to main content

LOCAL API v1

Introduction

Using the v1 API in Undetectable, you will be able to retrieve a list of profiles, start and close them. In addition, with information you get, you will be able to connect various automation tools, such as Puppeteer, Playwright, etc. in Chromium profiles.

The program must be running to work with the API.

By default, the local server runs on port 25325, if this port is busy, it will start on a different port. In the settings of the program you can see the port and change it to the right one.

To access a local server, use IP 127.0.0.1, localhost or a local IP within your network and the port from the settings + the path you want to execute, e.g. http://localhost:25325/status.

All responses to the API look like:

{
"code": `<status code>`,
"status": `<status>`,
"data": `<return object>`,
}

where <status code> и <status> reflect status:

<status code><status>Description
0"success"success
1"error"error, <return object> = {“error”:”error description”}

<return object> – Various data sent by the API, such as a list of profiles.

Errors are of the form:

{
"code":1,
"status":”error”,
"data":
{“error”: ”error description”},
}

Requests

Path: /status

Method: GET
Description: Returns the status of the local server, whether it is running or not

Returning Data
{
"code":0,
"status":"success",
"data":{},
}

Path: /list

Method: GET
Description: Returns the list of profiles on the Chromium browser available in the program

{
"code": 0,
"status": "success",
"data" {
"profile_id1": {
"name": "Profile1" // Profile name in program
"status": ”Available”, // profile status сan be: ”Started”,”Locked”, “Available”
"debug_port": "xxxx", // browser debug port, used for automation (empty value if the profile is not running). Only in Chromium
"websocket_link": "ws://127.0.0.1:xxxx/devtools/browser/xxxxxx", // Browser link, used for automation (empty value if the profile is not running). Only in Chromium
"folder": "Name", // Profile folder name
"tags": ["tag1", "tag2", "tag3"] // Profile Tags
},
"profile_id2": {
},

},
}

Path: /profile/start/<profileID>

Method: GET
Description: Starts a profile with the selected <profileID>

Returning Data
{
"code":0,
"status":"success",
"data":{
"name": "Profile1" // Profile name in the program
"websocket_link":"ws://127.0.0.1:xxxx/devtools/browser/xxxxxx", // Browser link, used for automation (empty value if the profile is not running). Only in Chromium
"debug_port": "xxxx", // browser debug port, used for automation (empty value if the profile is not running). Only in Chromium
"folder": "Name", // Profile folder name
"tags": ["tag1", "tag2", "tag3"] // Profile Tags
},
}

Path: /profile/stop/<profileID>

Method: GET
Description: Stops the profile with the selected <profileID>

Returning Data:
{
"code": 0,
"status": "success",
"data": {}
}

Path: /profile/update/<profileID>

Method: POST
Description: Update information in profile with the selected <profileID>. All parameters are optional
Format: JSON

Request parameters:
{
"proxy":"socks5://127.0.0.1:5555:login:pass", // Change proxy in profile (you can use http, https, socks5 proxy and proxy with login/pass or without login/pass)
"notes":"Text", // Change notes in profile
"name":"Profile Name" // Change profile name
}
Returning Data:
{
"code": 0,
"status": "success",
"data": {}
}

Path: /profile/delete/<profileID>

Method: GET
Description: Delete the profile with the selected <profileID>

Returning Data:
{
"code": 0,
"status": "success",
"data": {}
}

Examples

Node.js Puppeteer Running a profile with a specific name and opening an undetectable.io page in that profile:

const puppeteer = require('puppeteer');
const axios = require('axios');

const port = 25325; // Port
const ip = '127.0.0.1'; // Local IP
const profileName = ‘TestProfile’; // Name profile

const sleep = (ms) => {
return new Promise((resolve) => setTimeout(resolve, ms));
};

axios.get('http://' + ip + ':' + port + '/status').then(response => {
if (response.data.code == 0) {
axios.get('http://' + ip + ':' + port + '/list').then(async response => {

for (var profile in response.data.data) {
// Starting a specific profile and navigating to the page
if (response.data.data[profile].name == profileName ) {
axios.get('http://' + ip + ':' + port + '/profile/start/' + profile).then(async response => {
try {
const browser = await puppeteer.connect({
browserWSEndpoint: response.data.data.websocket_link,
defaultViewport: null
});
const page = await browser.newPage();
await sleep(1000);
await page.goto('https://undetectable.io');
} catch (e) {
console.log(e);
}
})
.catch(error => {
console.log(error);
});
}
}
})
.catch(error => {
console.log(error);
});
}
})
.catch(error => {
console.log(error);
});

Python + Selenium Running profiles with a specific folder and opening few sites in these profiles:

from time import sleep
import requests
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

address = "127.0.0.1" # Local API IP address (if you work from another PC on the same network or a port is open in the router settings, you can access the local API remotely and this address will need to be changed)
port_from_settings_browser = '25325' # Local API port (can be found in the program settings)
chrome_driver_path = "chromedriver.exe" # Path to chromedriver for v100
ser = Service(chrome_driver_path)
chrome_options = Options()
list_response = requests.get(f'http://{address}:{port_from_settings_browser}/list').json()['data'] # Send a request to the local API to get a list of profiles
profile_id = ''

for key, value in list_response.items(): # Loop through the list of profiles and run them one by one
if value['folder'] == 'test': # Here you can add a check to run only the profiles you need (in this example, we run the profiles that are in the 'test' folder)
profile_id = key
if value['status'] == 'Available': # If the profile is not running, then run the profile and take the debug_port
try:
start_profile_response = requests.get(f'http://{address}:{port_from_settings_browser}/profile/start/{profile_id}', timeout=5).json()['data']
debug_port = start_profile_response['debug_port']
if value['status'] == 'Started': # If the profile is running, then we simply take the debug_port from the available data
debug_port = value['debug_port']
if value['status'] == 'Locked': # If the profile is Locked, then skip
continue
if debug_port: # We check if the browser has a connection port (WebEngine profiles doesnt have ports, so we close them immediately)
chrome_options.debugger_address = f'{address}:{debug_port}'
driver = webdriver.Chrome(service=ser, options=chrome_options, executable_path=chrome_driver_path)
driver.get("https://whoer.net/") # Open whoer.net in active tab
driver.switch_to.new_window('tab') # Create a new tab and switch to it
driver.get(url='https://browserleaks.com/js') # Open browserleaks.com/js in active tab
# You can add any other actions here
sleep(5) # Wait 5 sec
requests.get(f'http://{address}:{port_from_settings_browser}/profile/stop/{profile_id}') # Stop profile