How do I make my first MetaDock API call?
Mint a scoped API key in MetaDock, point your client at the local base URL, and send a request over whichever of the five protocols you already use. Everything runs on your own machine. MCP is on every plan; the other four surfaces are part of MetaDock Pro.
Which automation protocol should I use?
MetaDock provides five ways to automate browsers: REST API, WebSocket API, Selenium WebDriver (W3C), Chrome DevTools Protocol (CDP), and MCP integration. MetaDock shows all browsers running in a visual grid, so you can watch your automation execute in real-time.
REST API
HTTP endpoints for browser control. Works with any language.
MetaDock Pro
WebSocket API
Real-time bidirectional communication and event subscriptions.
MetaDock Pro
Selenium WebDriver
W3C WebDriver protocol. Use existing scripts with minimal changes.
MetaDock Pro
Chrome DevTools Protocol
CDP discovery and WebSocket passthrough. Point Puppeteer or Playwright at a running browser.
MetaDock Pro
MCP Integration
Control browsers with AI assistants using natural language.
Every plan
Authentication
Create API keys in the MetaDock app under Settings → API, Automation & AI. There is no single shared key: you mint as many as you need and revoke them individually. A surface you switch on answers 401 to every request until a key exists. If no other network surface is running yet, it starts listening after you restart MetaDock.
Each key is a UUID v4 carrying a set of scopes: rest, websocket, mcp, cdp, and selenium. A request is accepted only if the key's scopes cover the surface it targets. Each surface also has its own toggle in the same settings panel, and all of them are off by default: a request to a surface whose toggle is off is rejected no matter which key it carries.
What a key is allowed to do
Beyond the surface scopes, a key carries four independent restrictions. Each is empty by default, which means unrestricted on that axis, and each is enforced in one place rather than per protocol: a capability denied to a key is denied whether the call arrives over REST, WebSocket, MCP or WebDriver. CDP is the exception: raw DevTools commands do not map to tools, so they are checked only for the key's cdp scope.
- Capabilities. 27 groups spanning browser control, organization, content and user data, such as
browser.read,browser.script,browser.cookiesandhistory. Nine are withheld from a new key by default because they read or move data rather than drive a page: cookies, local and session storage, screenshots and PDFs, layout screenshots, browser extensions, control inside native apps, video snapshots, browsing history, and downloads. - Individual tools.A per-key deny list that overrides the capability grant, for the case where a group is right except for one call inside it. One-click presets set the whole tree by risk tier, cumulatively: read-only observes, interact adds navigate, click, type and scroll, submit adds cookies, storage, settings and lifecycle. The tiers come from each tool's own MCP risk hints, so they cannot drift from the catalog.
- Profiles and layouts. An allowlist of the browsers a key may act on. Out-of-scope browsers answer 403, and so do the fleet-wide verbs (navigate-all, execute-all, close-all and their siblings), which carry no single target and therefore cannot be scope-checked per browser.
- Domains. A navigation allowlist. A key holding one can only navigate to, or create a browser at, a host that matches an entry exactly or as a
*.metadock.appwildcard covering the host and its subdomains. Anything else is 403, including the URL inside a fleet-wide navigate. This is the restriction to reach for when handing a key to an AI agent.
Batched calls are checked the same way. A browser_batch is resolved to the canonical tool name of every sub-action before it runs, so a batch cannot smuggle a denied tool past the gate.
Two limits apply to every surface regardless of the key. Only http:// and https:// URLs are accepted for API-driven navigation, so file:// cannot be used to read local files back through the page-reading tools, and print-to-PDF writes only to a .pdf path with no parent-directory traversal or UNC target.
The plaintext key is never stored. The database keeps a SHA-256 lookup hash plus an HMAC derived from this machine's hardware fingerprint, compared in constant time and failing closed, so a database lifted onto another machine authenticates nothing. Repeated authentication failures trigger a per-IP lockout. REST, WebSocket, WebDriver and CDP rely on the key alone, so an unattended script is never held up by a prompt. Only MCP and the mdkCLI also ask you to approve each new client in the app, unless “Allow All” is on.
Authentication Methods
On the HTTP surfaces (REST, Selenium WebDriver, MCP, CDP discovery), send the key in a header. Query-parameter authentication is not supported.
Recommended. Standard Bearer token in Authorization header.
Alternative header-based authentication.
WebSocket Authentication
A WebSocket connection carries no headers, so it authenticates in-band. The first message on the socket must be an auth frame carrying a key with the websocket scope. Include id to have the response echo it back.
{
"type": "auth",
"api_key": "your-uuid-from-metadock-settings",
"id": 1
}Python example
import requests
API_KEY = "your-uuid-from-metadock-settings"
BASE_URL = "http://127.0.0.1:8080"
# Method 1: Bearer Token (Recommended)
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get(f"{BASE_URL}/api/browsers", headers=headers)
# Method 2: X-Api-Key Header
headers = {"X-Api-Key": API_KEY}
response = requests.get(f"{BASE_URL}/api/browsers", headers=headers)JavaScript example
const API_KEY = "your-uuid-from-metadock-settings";
const BASE_URL = "http://127.0.0.1:8080";
// Method 1: Bearer Token (Recommended)
const response = await fetch(`${BASE_URL}/api/browsers`, {
headers: { "Authorization": `Bearer ${API_KEY}` }
});
// Method 2: X-Api-Key Header
const response2 = await fetch(`${BASE_URL}/api/browsers`, {
headers: { "X-Api-Key": API_KEY }
});cURL example
# Method 1: Bearer Token (Recommended)
curl -H "Authorization: Bearer YOUR_API_KEY" \
http://127.0.0.1:8080/api/browsers
# Method 2: X-Api-Key Header
curl -H "X-Api-Key: YOUR_API_KEY" \
http://127.0.0.1:8080/api/browsersC# example
using System.Net.Http;
using System.Net.Http.Headers;
var apiKey = "your-uuid-from-metadock-settings";
var baseUrl = "http://127.0.0.1:8080";
using var client = new HttpClient();
// Method 1: Bearer Token (Recommended)
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", apiKey);
var response = await client.GetAsync($"{baseUrl}/api/browsers");
// Method 2: X-Api-Key Header
client.DefaultRequestHeaders.Add("X-Api-Key", apiKey);
var response2 = await client.GetAsync($"{baseUrl}/api/browsers");Base URLs
REST API
http://127.0.0.1:8080All REST endpoints are prefixed with /api/
WebSocket API
ws://127.0.0.1:8080/wsSingle WebSocket endpoint for all operations
Selenium WebDriver
http://127.0.0.1:8080/wd/hubW3C WebDriver protocol endpoint
Chrome DevTools Protocol
http://127.0.0.1:8080/jsonCDP discovery; targets hand out /devtools/ WebSocket URLs
Response Formats
REST API Success Response
{
"success": true,
"data": {
"uuid": "browser-abc-123",
"url": "https://metadock.app",
"title": "MetaDock"
},
"timestamp": "2025-01-04T12:00:00"
}REST API Error Response
{
"success": false,
"error": "Browser not found",
"timestamp": "2025-01-04T12:00:00"
}WebSocket Response
Action responses carry only these three fields, and id is absent when the request omitted one. Pushed events are a different shape and do carry a type and a timestamp.
{
"success": true,
"data": { ... },
"id": 1
}WebDriver Response (W3C)
{
"value": {
"sessionId": "session-xyz-789",
"capabilities": { ... }
}
}