Skip to content

Local API and CDP

The Geksy app on your PC runs a local API. A script uses it to launch a profile (with sync, proxy, and fingerprint, just like clicking the button) and gets CDP addresses to connect automation to.

  • Address: http://127.0.0.1:<port>/api/v1/. The default port is 47800; if it’s taken, the app picks another one.

  • Authentication: Authorization: Bearer <token>.

  • The actual port and token are in agent.json in the app data folder (Windows — %LOCALAPPDATA%\Geksy, Linux — ~/.local/share/Geksy):

    {"port": 47800, "token": "…"}

    Only your Windows user can read this file. Scripts read it themselves, so you don’t need to copy the token.

  • The API listens only on this computer. Requests from a browser (with an Origin header) are rejected, so websites can’t reach it.

  • The app must be running and signed in.

CallWhat it does
GET /api/v1/statusapp and engine version, whether you’re signed in: {"version", "engine_version", "logged_in", "user": {"email"}}
GET /api/v1/workspacesworkspaces of the account signed in to the app
GET /api/v1/workspaces/{workspace_id}/profilesthe workspace’s profiles (requested from the cloud on behalf of this PC)
GET /api/v1/profiles/runningprofiles running on this PC: {"items": [{"workspace_id", "profile_id", "mode", "cdp_http", "cdp_ws", "started_at"}]}
POST /api/v1/profiles/{profile_id}/startlaunch a profile: {"workspace_id": "…", "headless": false}
POST /api/v1/profiles/{profile_id}/stopclose a profile: {"workspace_id": "…"} → 204; data goes to the cloud
GET /api/v1/profiles/{profile_id}/cookies?workspace_id=…&format=json|netscapecookies of a running profile
PUT /api/v1/profiles/{profile_id}/cookiesimport cookies: {"workspace_id", "text"} (JSON or Netscape) → {"imported": n}
GET /api/v1/cachelocal profile copies on this PC: size, last opened, unsent changes; cache quota
POST /api/v1/profiles/{profile_id}/clear-cachedelete the local copy of a closed profile (unsent data goes to the cloud first): {"workspace_id"}
GET /api/v1/enginesinstalled engines and an available update
POST /api/v1/engines/install · GET /api/v1/engines/install-statusinstall an engine ({"version": null} for the assigned one) · install progress
GET /api/v1/engines/resolve?pinned=… · DELETE /api/v1/engines/{version}which engine a profile will run on · remove an unused engine
POST /api/v1/scenarios, /api/v1/syncscenarios and window sync — see Scenarios

profile_id and workspace_id are cloud identifiers (shown in the web app and in the cloud API). The profile must already exist in the cloud: the app marks it as busy, downloads its data, and applies the fingerprint and proxy.

POST /api/v1/profiles/8f0c…/start
Authorization: Bearer <token>
Content-Type: application/json
{"workspace_id": "1b7e…", "headless": false}
{
"profile_id": "8f0c…",
"workspace_id": "1b7e…",
"mode": "headed",
"cdp_http": "http://127.0.0.1:53412",
"cdp_ws": "ws://127.0.0.1:53412/devtools/browser/4b1d…"
}

A profile that’s open by another member or on another PC won’t launch; you get a profile_busy error. Errors come in the same format as in the cloud: {"error": {"code", "params", "message"}}.

Besides the cloud error codes, the local API returns its own:

CodeWhen
agent_engine_missingno suitable engine version on this PC — the app downloads it or offers to install it
agent_engine_failedthe engine failed to start (params.version)
not_foundthe profile isn’t running on this PC (params.resource = running_profile)
networkno connection to the cloud
internalapp error; details in %LOCALAPPDATA%\Geksy\logs\agent.log

POST /api/v1/profiles/{workspace_id}/{profile_id}/actions runs one action in a running profile: {"action": "click", "args": {"ref": "e12"}, "request_id": "…"} → {"ok": true, "result": {…}} or {"ok": false, "error": {"code", "params"}}. A repeat with the same request_id doesn’t run the action again. From the command line: python -m agent act WS PROFILE click --args '{"ref": "e12"}'.

ActionPermissionWhat it does
snapshot, screenshot, extract, wait_forreadpage snapshot with element numbers (ref), screenshot, data, waiting
goto, back, forward, reload, click, hover, type, fill, select, press, scroll, tabs, ask_human, human_done, set_dialog_policycontrolnavigation, human-like clicks and typing, tabs, asking a person
cookiescontrol + profile exportcookies of one site
evalcustom JavaScriptan expression (expression) or a function body (body: true) in an isolated world: the page DOM is visible, its variables are not
uploadfile uploadfiles from the allowed folder into <input type=file>

Inside an iframe: "frame": "<iframe ref from the snapshot>" for snapshot, click, type, fill, select, press, scroll, wait_for, extract, eval, upload. goto doesn’t open addresses of this computer or the local network (without a proxy, also after a DNS check of the name; the final address after redirects is checked too).

Permissions. An action is allowed if you have the automation permission in the workspace (“read the page”, “control the page”, “run custom JavaScript”, “upload files”, “connect Playwright/Puppeteer”), given by your role, and the token has it too. Custom JavaScript and file upload are off in the app until you turn them on: python -m agent automation --eval on --upload-dir "C:\Files\upload".

Tokens for scripts and AI agents. The token from agent.json gives everything. Give a script or an AI agent a limited token instead:

Окно терминала
python -m agent token create --name my-bot --scopes automation.read,automation.control --workspace WS --ttl 120
Call (main token only)What it does
POST /api/v1/tokens{"name", "scopes", "workspace_id", "profile_ids", "ttl_minutes", "max_sessions"} → {"token": "st_…", "id", …}
GET /api/v1/tokens · DELETE /api/v1/tokens/{id}list · revoke
GET /api/v1/secrets · PUT /api/v1/secrets/{name} · DELETE …secret names · set {"value"} · delete
GET /api/v1/automation · PUT /api/v1/automation{"eval": false, "upload_dir": null} — turn on JavaScript and the upload folder

A limited token can use status, profile lists, start and stop, actions, events and a CDP token — within its permissions, workspace and profiles; more than max_sessions profiles at once gives 429 agent_session_limit.

Secrets. You don’t have to give a password to a script or a model: save it on this computer (python -m agent secret set shop_login, the value isn’t shown) and write {{secret:shop_login}} in text or value. The app fills it in; the response has only the name; snapshots and extract show the field as ••••; no screenshot is taken while a secret is being typed. Secrets are encrypted with the OS user key and never go to the cloud.

Log. The workspace audit log gets the start of a token’s work with a profile and risky actions (JavaScript, files, cookies, a secret by name); every action goes to the app log on the computer (logs\automation.log), without text or values.

  • Playwright: chromium.connect_over_cdp(http_endpoint, headers=headers): the permanent address from cdp-tokens.
  • Puppeteer: puppeteer.connect({ browserWSEndpoint: ws_endpoint, headers }): also from cdp-tokens.
  • Selenium: debuggerAddress = the direct cdp_http address without http://, for example 127.0.0.1:53412.

A scoped token gets the direct address (cdp_http, cdp_ws) only with the automation.cdp scope and if the member may export profiles; otherwise these fields are null. Some profiles have no direct debugging address (always null) — connect through the permanent address with a token.

See examples in Playwright, Puppeteer, Selenium.

Permanent profile address. POST /api/v1/cdp-tokens {"workspace_id", "profile_id"} issues an at_… token and the address http://127.0.0.1:<port>/cdp/{workspace_id}/{profile_id}, which doesn’t change between launches; the app starts the profile itself when you connect. Details and recipes for different tools are in Connect your browser code.

Disconnecting the automation client doesn’t close the browser. A stop call or the user closes it.

Page console events and Playwright exposeBinding/exposeFunction don’t work over CDP (the engine doesn’t turn on the debugging mode in pages); see the alternatives in What works differently.

Don’t open a new browser context (browser.newContext()): it has no cookies and no profile data. Use the default context, browser.contexts[0].

"headless": true launches the profile without a window, for background tasks. The fingerprint stays the same as in a window.