Documentation / API

Local API

#Control mobyx from your own code

The Local API lets any program on this computer do what you do in the window: make browser profiles and Mobyx Devices, start and stop them, tap and type on phones, open pages and run JavaScript in a browser, and run workflows on any mix of targets. It is the running app that answers, so what a script does shows up on the pages, in the Mobyx Monitor and in Logs at once. It is part of the paid plans.

#Turn it on

Settings → API → Turn on. The tab shows the address (http://127.0.0.1:50326/api/v1), your API key, ready-made examples with your key filled in, and Open the API reference: every route, with an OpenAPI file to import into Postman. The API listens on this computer only, and every request carries the key in the X-API-Key header. Make a new key whenever it has been shared: the old one stops working at once.

#Who can use it

• It listens on 127.0.0.1 only, so nothing outside this computer reaches it.
• Every route but the reference needs your key: X-API-Key: mbx_... or Authorization: Bearer mbx_....
• A web page open in your browser cannot use it: a request that carries an Origin is refused, the host must be this computer, and no CORS headers are given.
• It is off until you turn it on, it needs the 3 Months or Yearly plan, and it closes by itself if the plan ends or you sign out.
• Keep the key to yourself: anyone who has it can control your browsers and phones. Make a new key if it has been shared.
• A debugging port has no key. While a Chrome profile is running with debug: true, any program on this computer can connect to that profile's port and control it (that is how Playwright, Puppeteer and Selenium attach). Start it that way only when you need to, on a computer only you use; stopping the profile closes the port.

#Your own Playwright, Puppeteer or Selenium

Start a Chrome profile with debug: true and the answer has a debug_url. Connect to it and you drive the profile, with its fingerprint, cookies and proxy, from your own automation library.

from mobyx_client import MobyxClient          # download it from the API reference

mobyx = MobyxClient(key="mbx_...")
browser = mobyx.create_browser(engine="chrome", proxy="1.2.3.4:8000:user:pass")
started = mobyx.start_browser(browser["id"], debug=True)

from playwright.sync_api import sync_playwright
with sync_playwright() as p:
    page = p.chromium.connect_over_cdp(started["debug_url"]).contexts[0].pages[0]
    page.goto("https://example.com")

#Phones and workflows

/phones lists every connected phone and running Mobyx Device. Each one takes tap, swipe, text, key (home, back, recent...), click (finds a button by its text or ID, like a Smart Click), apps, adb shell and screenshots. /workflows/run runs a workflow saved from Workflow Studio, or a compact plan (the format of the recipes and of the AI Assistant), on phones (serial), browsers (browser:<id>) and Mobyx Devices (mobyx:<id>) together; closed browsers and devices are started first. Follow it at /runs/<id>.

#What it answers

Success is {"ok": true, "data": ...}. A failure is {"ok": false, "error": {"code": ..., "message": ...}} with the HTTP status below, and a message in plain words.

400 bad_request
A field is missing or is not what it should be.
401 unauthorized
No key, or the wrong key.
402 payment_required
The plan does not include it, or a plan limit was reached.
403 forbidden
The request did not come from this computer, or came from a web page.
404 not_found
No such route, profile, device or phone.
405 method_not_allowed
The route exists but not with that method (GET, POST...).
409 conflict
mobyx could not do it right now (a profile is already running, a device is booting...).
413 too_large
The body is larger than 20 MB.
503 busy
mobyx is already answering as many requests as it can: try again in a moment.
504 timeout
It did not answer in time.
500 internal
Something unexpected: the message says what; it is also written to Logs.