HTTP API

Two HTTP servers run alongside Egg. The browser exposes tabs, navigation, screenshots, and CDP. The gateway exposes AI, media processing, fetching, privacy checks, the agent, monitors, credentials, and end-to-end-encrypted sync. Both bind to 127.0.0.1.

Discovery & auth

On startup each server writes a JSON file with its port and bearer token. Anything calling the API reads that file.

# Browser API (egg.exe)
%APPDATA%\com.eggbrowser.desktop\api_info.json
~/Library/Application Support/com.eggbrowser.desktop/api_info.json

# Gateway API (egg-daemon.exe)
%APPDATA%\com.eggbrowser.desktop\daemon_info.json
~/Library/Application Support/com.eggbrowser.desktop/daemon_info.json

# Schema
{
  "port": 19247,
  "token": "a3f8c2e1-...",
  "pid": 12345,
  "started_at": "2026-05-01T08:00:00Z"
}
# Authenticate every request with the token
PORT=$(jq -r .port  ~/Library/Application\ Support/com.eggbrowser.desktop/daemon_info.json)
TOKEN=$(jq -r .token ~/Library/Application\ Support/com.eggbrowser.desktop/daemon_info.json)

curl -s "http://127.0.0.1:$PORT/health" -H "Authorization: Bearer $TOKEN"

Conventions

The gateway groups its routes into three tiers. Each tier carries different stability guarantees.

PrefixTierStability
/api/v1/…Versioned publicStable contract. Additive changes within v1; breaking changes ship as v2.
/api/… (unversioned)Public, pre-v1Historical gateway routes (agent, monitors, sync, credentials, lifecycle). Stable in practice; will fold into /api/v1/ as the surface settles.
/x/…Egg-internalNot part of the public contract. May change without notice. See Internal endpoints.

Browser API

Hosted by egg.exe. Drives the running browser: tabs, navigation, JS eval, screenshots, raw CDP.

Lifecycle & status

MethodPathPurpose
GET/api/statusBuild id, version, uptime. No auth required.
GET/api/diagnosticsDiagnostic snapshot for support reports.
POST/api/focusBring the main window forward.
POST/api/screenshotCapture a frame, a tab’s webview, or the desktop. Returns a PNG path.
POST/api/navigateDeep-link the React shell via React Router.
POST/api/evalRun JS in the main window. Body is wrapped in an async function; use return for a value.

Tabs & pages

MethodPathPurpose
GET/api/browser/tabsList every tab with id, url, title, active state.
POST/api/browser/tabsCreate a new tab. Body: {"url":"..."}.
DELETE/api/browser/tabs/{id}Close the tab.
POST/api/browser/tabs/{id}/activateSwitch to the tab.
POST/api/browser/tabs/{id}/cdpSend a raw CDP method to the tab. {method, params}.
POST/api/browser/navigateNavigate an existing tab. {tab_id, url}.
POST/api/browser/readReader-mode extraction of the active tab.
POST/api/browser/execRun JS inside a tab’s webview.
GET/api/browser/historyBrowsing history.

Automation

MethodPathPurpose
POST/api/browser/cmdRun one micro-command. {tab_id, command, args}.
POST/api/browser/batchRun a sequence of micro-commands in order.
GET/api/browser/cdp/eventsServer-Sent Events stream of subscribed CDP events across tabs.

Data & settings

MethodPathPurpose
GET/api/bookmarksList bookmarks.
GET/api/settingsRead all user settings.
PUT/api/settings/{key}Update one setting.
GET/api/extensionsList installed Chrome extensions.
POST/api/extensions/installInstall from a Web Store URL or unpacked folder.
DELETE/api/extensions/{id}Uninstall an extension.
GET/api/sidebarSidebar items.

Gateway API

Hosted by egg-daemon.exe. Owns every external HTTP call Egg makes. Provider credentials live here; tier gating happens here; outbound traffic to AI providers, image hosts, search APIs, and Egg’s cloud relay all originate here.

AI — /api/ai

One endpoint per modality. Provider routing is the gateway’s responsibility: every endpoint accepts either a capability (text_fast, vision, etc.) or an explicit override. Tier gating runs before any cloud call.

MethodPathPurpose
POST/api/ai/completeNon-streaming chat completion. {capability?, override?, messages, tools?, ...} returns {content, tool_calls?, usage}.
POST/api/ai/streamStreaming chat completion. SSE events: delta, tool, done, error.
POST/api/ai/embedText embeddings. {text, provider?} returns {embedding: number[]}. provider is optional: "google" (768d) or "openai" (1536d).
POST/api/ai/transcribeAudio transcription. {input_path, language?} returns {text, segments?}. The gateway picks a local or cloud asset based on the configured capability.
POST/api/ai/speech-recognizeShort-form speech recognition. {input_path, language?} returns {text}. Optimized for utterances under ~60s.
POST/api/ai/ttsText-to-speech. {text, voice?, backend?}. backend is "auto" (default, prefer local when installed), "local", or "cloud". Saves audio to local disk and returns its path.
POST/api/ai/visionImage understanding. {images: [{path|url|base64}], prompt, capability?} returns {content, usage}.
POST/api/ai/generate-imageImage generation. {prompt, size?, n?} returns one or more image paths or URLs.
POST/api/ai/video-generateVideo generation (async). Submits to the provider, polls for completion, returns the video URL.
POST/api/ai/vadVoice activity detection. {input_path, threshold?, min_speech_ms?, min_silence_ms?} returns speech intervals. Audio is preprocessed to 16 kHz mono server-side.
POST/api/ai/rerankCross-encoder reranking. {query, docs[], top_n?} returns each document scored for relevance, sorted descending. Useful for improving retrieval results before passing to an LLM.

Media — /api/media

Server-side media processing: probe, transcode, mux, extract, sample, download. Inputs and outputs are filesystem paths inside the app data dir, system tmp, or the OS download dir; paths outside those roots are rejected. Long-running operations stream SSE progress events.

MethodPathPurpose
POST/api/media/probeContainer and stream metadata. Sync JSON. Returns duration, video streams, audio streams, format.
POST/api/media/transcodeGeneric video/audio transcode. SSE progress. Accepts pre-input args, multi-input, filter_complex, output maps.
POST/api/media/concatConcatenate inputs. SSE. method: demuxer (stream-copy) or filter (re-encode).
POST/api/media/muxMux video and audio. SSE. Optional stream-copy.
POST/api/media/extract-audioStrip audio from a video. SSE.
POST/api/media/silence-detectDetect silence intervals in an audio track. Sync JSON.
POST/api/media/extract-subtitlesExtract embedded subtitle tracks. Sync JSON. Returns SRT text.
POST/api/media/sample-scenesScene-change frame sampler. Sync JSON. Returns frame paths and timestamps.
POST/api/media/extract-clipStream-copy a time range. SSE.
POST/api/media/extract-frameSingle frame grab. Sync JSON.
POST/api/media/downloadVideo download. SSE progress. Accepts a caller-chosen job id.
DELETE/api/media/download/{job_id}Cancel an in-flight download.

Fetch — /api/v1/fetch

Generic external HTTP, mediated by the gateway. Every URL is validated against an SSRF allow-list: loopback, RFC1918, link-local, CGNAT, ULA, multicast, and .local are rejected, and DNS is resolved server-side to defeat rebinding.

MethodPathPurpose
POST/api/v1/fetch/pageFetch a page. {url, include: ["title", "content", "raw", "meta"]}. Returns only the requested fields.
POST/api/v1/fetch/imageFetch a remote image. {url, max_bytes?} returns bytes plus content-type.

Privacy — /api/v1/privacy

MethodPathPurpose
POST/api/v1/privacy/hibpCheck a password hash against Have I Been Pwned’s breach corpus. {sha1_prefix} (5 hex chars, k-anonymity) returns the list of suffix matches.

Agent chat

MethodPathPurpose
POST/api/agent/chatSend a message. Streams tokens, tool calls, and plan-approval prompts.
POST/api/ag-uiAgent-Generated UI. The agent posts a JSON UI description and the browser renders it. Preview.

Autonomy & scheduling

MethodPathPurpose
GET / PUT/api/agents/{agent_id}/private-timeRead or set protected windows where the agent works without interruption.
GET/api/agents/{agent_id}/autonomyCurrent autonomy permissions.
GET/api/agents/{agent_id}/reservationsList reservations.
POST/api/reservationsCreate one.
PUT / DELETE/api/reservations/{id}Update or cancel.
GET/api/agents/{agent_id}/time-blocksList scheduled blocks.
POST / DELETE/api/time-blocks (and {id})Create or cancel.
POST/api/agents/{agent_id}/materialize-blocksMaterialize the next planned blocks now.
POST/api/agents/{agent_id}/plan-nowForce a re-plan immediately.
GET/api/agents/{agent_id}/soft-planInspect the rolling soft plan.

Monitors & alerts

MethodPathPurpose
GET/monitorsList page monitors.
GET / PUT / DELETE/monitors/{id}Read, update, delete.
POST/monitors/{id}/checkForce-check a monitor now.
GET / POST/alertsList or create alerts.
DELETE/alerts/{id}Delete one.

Credentials & queue

Provider credentials (LLM API keys, OAuth tokens, service-account JSON) live in the gateway. Read responses always redact secret material; only the gateway-internal lookup path sees raw keys.

MethodPathPurpose
GET / POST/api/credentials/providersList or create a provider credential. POST responses redact the key.
PATCH / DELETE/api/credentials/providers/{id}Update or remove.
GET / POST/credentialsLegacy generic credentials (3rd-party APIs).
DELETE/credentials/{id}Delete a generic credential.
GET / POST/queueList or enqueue offline-queue items.
DELETE/queue/{id}Drop one.
GET / POST/agent/tasksList or create background agent tasks.
GET/agent/tasks/{id}Task state.

File watches

MethodPathPurpose
GET / POST/file-watchesList or create a directory watch.
DELETE/file-watches/{id}Stop watching.
GET/file-eventsRecent FS events.

Cross-device sync

End-to-end-encrypted device pairing. X25519 ECDH, AES-256-GCM. The cloud holds opaque ciphertext only.

MethodPathPurpose
POST/sync/invite/createGenerate a 6-character pairing invite.
POST/sync/invite/acceptAccept an invite from another device.
POST/sync/pairings/confirmConfirm the SAS code shown on both devices.
GET/sync/pairingsList paired devices.
POST/sync/pairings/revokeRevoke a pairing.
GET/sync/status, /sync/has-keySync state.
POST/sync/nowForce a sync round.
POST/sync/initial-transferOne-time bulk transfer (history, tabs).
GET/sync/eventsSync event stream.

Lifecycle

MethodPathPurpose
GET/health, /statusLiveness and structured status.

OpenAPI spec

The gateway publishes a machine-readable OpenAPI 3.1 document covering the versioned public surface (/api/v1/*).

curl -s "http://127.0.0.1:$PORT/api/v1/openapi.json" \
  -H "Authorization: Bearer $TOKEN"

The unversioned gateway routes (chat, autonomy, monitors, credentials, sync) are stable in practice but not yet included in the spec; they’ll be folded in as the surface settles into /api/v1/.

Internal endpoints

Routes under the /x/ prefix are Egg-internal contracts used by the browser shell and Egglet runtime. They’re documented for transparency but aren’t part of the public API: shapes change without notice and aren’t covered by version guarantees. See Internal endpoints for the full list.

Example session

# 1. Read gateway discovery
INFO="$HOME/Library/Application Support/com.eggbrowser.desktop/daemon_info.json"
PORT=$(jq -r .port  "$INFO")
TOKEN=$(jq -r .token "$INFO")
HDR="Authorization: Bearer $TOKEN"

# 2. Ask for a one-shot completion via the text_fast capability
curl -s -X POST "http://127.0.0.1:$PORT/api/ai/complete" \
  -H "$HDR" -H 'Content-Type: application/json' \
  -d '{"capability":"text_fast","messages":[{"role":"user","content":"In one sentence: what is Egg?"}]}'

# 3. Probe a video file
curl -s -X POST "http://127.0.0.1:$PORT/api/media/probe" \
  -H "$HDR" -H 'Content-Type: application/json' \
  -d '{"input_path":"/tmp/clip.mp4"}'

# 4. Fetch a page’s title and OG metadata
curl -s -X POST "http://127.0.0.1:$PORT/api/v1/fetch/page" \
  -H "$HDR" -H 'Content-Type: application/json' \
  -d '{"url":"https://eggbrowser.com","include":["title","meta"]}'

# 5. Stream a chat completion
curl -N -X POST "http://127.0.0.1:$PORT/api/ai/stream" \
  -H "$HDR" -H 'Content-Type: application/json' \
  -d '{"capability":"text_fast","messages":[{"role":"user","content":"Say hi."}]}'