Skip to content

HTTP API

recon ui and the desktop app start a local HTTP server. It serves the web UI, a JSON API under /api/v1/, a live event feed at /ws, and the offline sandboxes under /_sandbox/. The web UI uses nothing else, so anything you can do in the UI you can also script against this API.

$ recon ui --port 4801 --no-open
Recon UI listening at http://127.0.0.1:4801
http://127.0.0.1:4801

The first line goes to stderr, the bare URL to stdout. The server runs until you press Ctrl-C.

Read the session token from the page, then call a route:

$ T=$(curl -s http://127.0.0.1:4801/ | grep -o 'recon-token" content="[^"]*' | cut -d'"' -f3)
$ curl -s -X POST -H "X-Recon-Token: $T" -H 'Content-Type: application/json' http://127.0.0.1:4801/api/v1/jsonpath -d '{"json_text":"{\"a\":[1,2]}","expr":"$.a[*]"}'
{"matches":[{"path":"$.a[0]","value":1},{"path":"$.a[1]","value":2}]}
recon ui [--port <PORT>] [--no-open] [--workspace <DIR>] [--salt <SALT>]
Option Default Effect
--port 0 Port to bind. 0 picks a free port.
--no-open off Suppresses the Open in your browser: <url> line on stderr.
--workspace . Workspace directory to open at startup.
--salt / MASKKEEL_SALT recon-dev-salt Salt for PII Airlock masking.
  • The bind address is always 127.0.0.1. There is no option to listen on another interface.
  • On start the server prints Recon UI listening at <url> to stderr and the bare URL to stdout, then runs until you press Ctrl-C.
  • recon ui never launches a browser. Its help text says --no-open prints the URL “without attempting to spawn a desktop browser”, but no code path spawns one with or without the flag.
  • The global transport flags (--proxy, --ca-cert, --cookies, --insecure and the rest) are accepted but not used by recon ui. The server takes its transport settings from the workspace’s .recon/network.json, which you manage with the network routes.
  • If the port is taken, the command exits with code 2:
$ recon ui --port 4801
{
"code": "E_CLI_RUNTIME",
"message": "failed to bind loopback listener on `127.0.0.1:4801`: Address already in use (os error 98): Address already in use (os error 98)",
"fix_hint": "Check workspace `.recon.toml`, arguments, or network connectivity.",
"retryable": false
}

The workspace can be any existing directory. A folder without .recon.toml opens with default settings and the folder’s name, and the server creates its .recon/ state directory.

  • Session token. At startup the server generates a random 32-character hex token. It injects it into the UI page as <meta name="recon-token" content="...">. Every POST and DELETE route under /api/v1/, plus GET /api/v1/workspace/config, requires the header X-Recon-Token with that exact value. A new token is made on every launch.
  • Read routes are open. All other GET routes under /api/v1/ need no token. That includes run bodies, the compliance audit, vault metadata and the workspace snapshot.
  • Sandbox and WebSocket routes are open. /_sandbox/* and /ws never check the token.
  • The token is not secret from local processes. Any program that can reach the port can GET / and read the token from the HTML.
  • No CORS and no Origin check. The server sends no Access-Control-* headers and does not inspect Origin or Host. An OPTIONS preflight to an API route gets 405.
  • Order of checks. The token is checked inside each handler, after Axum has parsed the path, query and JSON body. A malformed request gets the framework error below (400, 415 or 422) even when the token is missing.

A missing or wrong token returns:

$ curl -s -i http://127.0.0.1:4801/api/v1/workspace/config
HTTP/1.1 401 Unauthorized
content-type: application/json
content-length: 77
date: Mon, 30 Nov 2026 15:44:41 GMT
{"code":"E_UNAUTHORIZED","message":"Missing or invalid X-Recon-Token header"}

Handler errors are JSON objects with code and message:

Status code When
400 E_BAD_REQUEST Invalid input, unknown environment, script errors, transport errors from the outbound request, and most failures from the underlying feature.
401 E_UNAUTHORIZED Missing or wrong X-Recon-Token.
403 E_FIREWALL_BLOCKED The Outbound Secret Firewall refused to send a secret to a host it is not scoped to. The body also has a violations array.
404 E_NOT_FOUND The run, request, environment, approval, flow or PKCE session does not exist.
500 E_INTERNAL Workspace load, file write or Flight Recorder errors.

A firewall block, sending the demo workspace’s Stripe Prod Key Leak Check request:

HTTP/1.1 403 Forbidden
content-type: application/json
content-length: 424
date: Mon, 30 Nov 2026 15:52:13 GMT
{"code":"E_FIREWALL_BLOCKED","message":"Outbound Secret Leak Firewall blocked 1 violation(s) before connecting.","violations":[{"allowed_hosts":["api.stripe.com"],"kind":"host_scope_violation","message":"Blocked secret `PROD_STRIPE_KEY` bound for `api.stripe.com` from being sent to unauthorized host `127.0.0.1`.","origin":"header","secret_label":"PROD_STRIPE_KEY","target_host":"127.0.0.1","target_name":"Authorization"}]}

Errors raised by the web framework before a handler runs are plain text, not JSON:

Status Cause Example body
400 Body is not valid JSON, or a query parameter is missing or has the wrong type Failed to deserialize query string: missing field `q`
405 Wrong method on a known path (an allow header lists the right one) empty
415 JSON route called without Content-Type: application/json Expected request with `Content-Type: application/json`
422 JSON is valid but does not match the expected shape Failed to deserialize the JSON body into the target type: missing field `request` at line 1 column 2

A path that matches no route, with any method, returns 200 with the web UI’s index.html. A typo in an API path therefore looks like success with an HTML body.

  • All request and response bodies are JSON unless noted. Send Content-Type: application/json on every POST, even with an empty body ({}).
  • env fields are environment names. When omitted, the workspace’s default_env is used.
  • request fields take a full request object, the same shape the .http parser produces and that GET /api/v1/workspace returns in requests. id, name, method and url are required; folder, handler_location, source_file, query, headers, auth, body, pre_script, post_script, assertions, taint_scopes, timeout_ms (default 15000) and follow_redirects (default true) are optional.
  • Every route that loads the workspace rewrites plain environment values that start with http://127.0.0.1:8787/_sandbox/ to the server’s real address. See Offline Sandboxes.
  • Paths below show the token requirement in the Token column.
Method Path Token Purpose
GET /api/v1/workspace no Full snapshot for the UI.
GET /api/v1/workspace/config yes Editable .recon.toml settings.
POST /api/v1/workspace/config yes Update .recon.toml settings.

Returns name, root, default_env, volatile_paths, editor_uri_template, agent_policy, environments, requests, runs (the 60 newest run summaries), volatile_ignores, airlock_salt_fingerprint, sandbox_base_url (for example http://127.0.0.1:4801/_sandbox) and native_picker_available (true only in the desktop app).

Secret values are never returned. Each environment maps variable names to either {"kind":"plain","value":...} or {"kind":"secret","label":...,"allowed_hosts":[...],"allow_query_param":...,"preview":"••••••••••••"}.

GET returns name, default_env, volatile_paths, editor_uri_template and agent_policy.

POST takes any subset of those five fields and writes .recon.toml:

Field Rule
name, default_env, editor_uri_template Trimmed. Empty strings are ignored.
volatile_paths Replaces the list. Entries are trimmed and empty ones dropped.
agent_policy Replaces the whole policy object. See Agent Policy & Approvals.

The response is the same five fields plus "saved": true.

Method Path Token Purpose
POST /api/v1/requests/save yes Create or update a request in a .http file.
POST /api/v1/requests/{id}/duplicate yes Copy a request into the same file.
POST /api/v1/requests/{id}/rename yes Rename a request and optionally move it to a folder.
DELETE /api/v1/requests/{id} yes Remove a request from its file.
POST /api/v1/environments/save yes Write an environment file.
DELETE /api/v1/environments/{name} yes Delete an environment file.

Body: {"request": <request>}. The request is written to request.source_file, or when that is empty to <collections_dir>/<slug>.http, where the slug is the name lowercased with every non-alphanumeric character turned into - (requests if nothing is left). If the file already has a request with the same id, it is replaced; otherwise the request is appended. Other requests in the file are kept.

Response: {"saved": true, "request": <request as sent, with source_file set>}.

Body (optional): {"new_name": "..."}. Default name: <name> (Copy). The copy is appended to the same file. Response: {"duplicated": true, "request": <the copy, reloaded from disk>}. 404 if the ID is unknown.

Body: {"name": "...", "folder": "..." | null}. name is required and must not be blank (400 “request name cannot be empty”). If folder is present, a string sets the folder (blank clears it) and null clears it; if absent, the folder is unchanged. Response: {"renamed": true, "request": <reloaded request>}.

Removes the request from its .http file. If no requests remain, the file is deleted. Response: {"deleted": true, "id": "..."}. 400 if the request has no backing file, 404 if the ID is unknown.

Body: {"name": "...", "variables": {...}}.

  • name keeps only ASCII letters, digits, - and _ (qa env! becomes qaenv). 400 “invalid environment name” if nothing is left.
  • The file <environments_dir>/<name>.toml is overwritten with exactly the variables you send.
  • Each variable value is either a string (plain value) or an object:
Object field Meaning
kind: "secret" or secret: true Store as a secret. Without either, the object must have a string value and is stored as plain.
value Secret value. If blank or the placeholder ••••••••••••, the existing secret value is kept; if there is none, 400 “secret <key> requires a non-empty value”.
allowed_hosts Array of hosts the firewall lets this secret go to.
allow_query_param Boolean, default false.
label Display label.

Response: {"saved": true, "name": "<safe name>"}. See Vault & Secret URIs.

name must already consist only of letters, digits, - and _ (400 otherwise). You cannot delete the last remaining environment (400 “cannot delete the last remaining environment”). 404 if the file does not exist. Response: {"deleted": true, "name": "..."}.

Method Path Token Purpose
POST /api/v1/send yes Send a request and record the run.
POST /api/v1/twin yes Send one request to two environments and diff the responses.
GET /api/v1/runs no List run summaries.
GET /api/v1/runs/{id} no One full run with Airlock view and decoded JWTs.
GET /api/v1/runs/{id}/body no Raw response body.
GET /api/v1/runs/{id}/airlock no Airlock-masked view of a run’s response.
POST /api/v1/runs/{id}/baseline yes Mark or unmark a run as baseline.
GET /api/v1/search no Full-text search over runs.
POST /api/v1/diff yes Semantic diff of two runs.
GET /api/v1/volatile-ignores no List volatile-path ignore rules.
POST /api/v1/volatile-ignores yes Add an ignore rule.
DELETE /api/v1/volatile-ignores/{id} yes Remove an ignore rule.
Field Required Meaning
request yes Request object.
env no Environment name.
overrides no Map of variable names to values, applied on top of the environment.
override_firewall_once no, default false If the firewall blocks the request, send it anyway this one time.

The server runs the pre-request script, resolves variables and auth, checks the firewall, sends the request with the workspace transport settings, runs the post-response script, masks the response with the Airlock, and records the run in the Flight Recorder as actor human with label you. Secret values are scrubbed from the recorded URL, request headers, request body, script logs and captured variables.

Response bodies that are binary (image/*, application/pdf, audio/*, video/*, application/octet-stream, or not valid UTF-8) and at most 5 MiB are also stored as raw bytes for /runs/{id}/body.

Response fields:

Field Content
run The full recorded run.
airlock body, headers, masked_paths and receipt of the masked response.
redirects Redirect hops that were followed.
diff_vs_prev null, or against_run_id, against_label (Baseline or HEAD~1) and diff, comparing with the request’s baseline run, or else its previous run. Volatile paths and ignore rules apply.
jwts JWTs found in the response body, decoded.
script_logs Script output lines.
captured_vars Variables set by the post-response script.

A run_recorded event goes out on /ws.

Body: {"request": <request>, "env_a": "...", "env_b": "..."}. Both environments are required; an unknown name returns 400 “unknown environment <name>”. Both requests pass through the firewall. Response: {"env_a", "env_b", "twin": {"left", "right", "diff"}}. Twin runs are not recorded in the Flight Recorder. See Twin-Run & Diff.

Query: limit (default 50), status_min (only runs with at least this status), request_id. Returns an array of run summaries, newest first. Each summary has seq, id, ts_utc, actor (human, agent or cli), actor_label, request_id, request_name, env_name, method, url, status, total_ms, wire_bytes, is_baseline and verified_zero_leak.

Returns {"run", "airlock", "jwts"}. run has seq, id, ts_utc, actor, actor_label, request_id, request_name, env_name, method, url, status, is_baseline, protocol, waterfall, tls, req_headers, req_body, res_headers, res_body, wire_bytes, decoded_bytes, assertions, airlock_receipt, prev_hash and entry_hash. res_body is the response as received, not masked; airlock is the masked view, computed on each call. 404 if the run does not exist.

Returns the response body as recorded, not JSON-wrapped. If raw bytes were stored, they are returned with their stored content type (or application/octet-stream). Otherwise the text body is returned with the recorded Content-Type header (or text/plain; charset=utf-8).

Headers: X-Content-Type-Options: nosniff, and Content-Security-Policy: default-src 'none'; sandbox for everything except application/pdf. With ?download=true (also 1 or yes), it adds Content-Disposition: attachment; filename="run-<id>.<ext>", where the extension is png, jpg, gif, webp, pdf, json, txt (any text/*) or bin.

$ curl -s -D - -o /dev/null "http://127.0.0.1:4801/api/v1/runs/01a22d23-91c4-73b6-85c4-9c3783c2da72/body?download=1"
HTTP/1.1 200 OK
content-type: application/json
x-content-type-options: nosniff
content-security-policy: default-src 'none'; sandbox
content-disposition: attachment; filename="run-01a22d23-91c4-73b6-85c4-9c3783c2da72.json"
content-length: 669
date: Mon, 30 Nov 2026 15:47:15 GMT

Returns {"airlock": ...}, the masked view of the stored response.

Body: {"is_baseline": true|false}. Response: {"updated": true, "is_baseline": ...}. 404 if the run does not exist.

Query: q (required; missing gives a plain-text 400), limit (default 50). Returns an array of run summaries.

Body: {"left_run_id": "...", "right_run_id": "..."}. Workspace volatile_paths and the left run’s request-level ignore rules are applied. Response: {"diff", "left", "right"}, where left and right are full runs and diff has identical, status_changed, status_left, status_right, header_changes, body_changes, ignored_count and latency_delta_ms.

  • GET /api/v1/volatile-ignores?request_id=... returns {"rules": [...]}. Without request_id it returns all rules.
  • POST /api/v1/volatile-ignores with {"request_id": "..." | null, "pattern": "$.path"} returns {"rule": {"id", "request_id", "pattern", "created_at"}}.
  • DELETE /api/v1/volatile-ignores/{id} (numeric ID) returns {"deleted": true|false}.
Method Path Token Purpose
POST /api/v1/import yes Parse a collection or command and optionally save it.
POST /api/v1/typegen yes Generate types from a JSON sample.
POST /api/v1/codegen yes Generate a client snippet for a request.
POST /api/v1/jsonpath yes Evaluate a JSONPath expression.
  • import: {"payload": "...", "format": "auto", "save": false}. format is one of auto, curl, postman, insomnia, bruno, openapi, har. With save: true, requests go to <collections_dir>/<detected_format>-import.http (overwriting it) and environments to <environments_dir>/<name>.toml. Response: {"bundle": {"detected_format", "requests", "environments", "warnings"}}. See Importers.
  • typegen: {"json_text": "...", "root_name": "Response", "lang": "ts"}. lang accepts ts/typescript, zod, rs/rust, go/golang, py/python/pydantic, mo. Response: {"code": "..."}.
  • codegen: {"request": <request>, "env": "...", "lang": "curl"}. lang accepts curl, httpie/http, fetch/js/javascript/ts, httpx/python/py, go/golang, reqwest/rust, mo, hurl, csharp/cs/c#, ruby/rb. Secret values are not written into the snippet; they appear as ${NAME}. Response: {"code": "..."}. See Code & Type Generation.
  • jsonpath: {"json_text": "...", "expr": "..."}. Response: {"matches": [{"path", "value"}]}. Invalid JSON or expression gives 400.
Method Path Token Purpose
POST /api/v1/airlock/preview yes Mask a sample response with the active rules.
GET /api/v1/airlock/config no Active mask.toml rules.
POST /api/v1/airlock/config yes Validate, save and hot-reload mask.toml.
POST /api/v1/airlock/rule-preview yes Mask a sample with draft rules.
GET /api/v1/airlock/audit no Compliance audit bundle (JSON or HTML).
GET /api/v1/ledger/verify no Verify the Flight Recorder hash chain.
  • preview: {"body": "...", "headers": [{"name","value"}], "table_hint": "response"}. Returns {"airlock": {"body", "headers", "masked_paths", "receipt"}}.
  • config GET: {"salt_fingerprint", "path", "config"}. path is the configured mask file, or mask.toml when none is set.
  • config POST: the body is a full mask config object (email_domain, date_shift_days, columns, tables, custom_rules). Invalid rules give 400. If .recon.toml has no mask_config, it is set to mask.toml and saved first. The new rules apply immediately. Response: {"saved": true, "path", "salt_fingerprint", "config"}.
  • rule-preview: {"sample": "...", "config": <optional mask config>, "table_hint": "preview"}. Uses the draft config if given, else the active one. Returns {"airlock": ...}.
  • audit: query format (html for HTML, anything else for JSON), download (true, 1 or yes adds a Content-Disposition attachment named recon-compliance-audit.html or .json), limit (default 100, clamped to 1 through 500). Both forms send X-Content-Type-Options: nosniff; HTML also sends Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'.
  • ledger/verify: {"ledger": {"total_entries", "valid", "first_broken_id", "head_hash"}, "salt_fingerprint"}.

See PII Airlock & Receipts.

Method Path Token Purpose
POST /api/v1/scan yes Scan source code for routes and DTOs.
GET /api/v1/routes no Cached scan (scans on first call).
GET /api/v1/drift no Three-way drift report.
GET /api/v1/drift/sarif no Drift report as SARIF 2.1.0.
POST /api/v1/contracts/infer yes Infer an ODCS contract from a JSON sample.
POST /api/v1/contracts/check yes Validate JSON against an ODCS contract.
POST /api/v1/openapi/export yes Build an OpenAPI 3.1 document from recorded runs.
POST /api/v1/openapi/check yes Validate a recorded response against an OpenAPI document.
POST /api/v1/capsules/export yes Export a bug report capsule for a run.
POST /api/v1/capsules/verify yes Verify a capsule’s hash and leak checks.
POST /api/v1/capsules/reproduce yes Replay a capsule and diff the result.
  • scan: {"path": "...", "sync": false}. path is relative to the workspace root (or absolute); default is the root. With sync: true the scan is also synced into the workspace and sync in the response holds the sync summary. Response: {"scan": {"root", "files_scanned", "frameworks_detected", "routes", "dtos", "warnings"}, "sync": ... | null}. The scan is cached in memory until the next scan or workspace switch.
  • routes: {"scan": ...} from the cache.
  • drift: {"drift": {"route_drifts", "field_drifts", "breaking_count", "rename_count", "warning_count"}}, computed from the cached scan, the workspace and the 40 newest runs.
  • drift/sarif: the SARIF log object itself (top-level $schema, version, runs).
  • contracts/infer: {"run_id": "..."} or {"json_text": "..."}, plus optional name (default: the run’s request name, or api_contract). Neither gives 400 “provide either run_id or json_text”. Response: {"document", "yaml"}.
  • contracts/check: {"yaml": "...", "run_id" | "json_text"}. Response: {"report": {"contract_name", "rows_checked", "valid", "violations"}}.
  • openapi/export: {"title": "...", "version": "..."}, both optional. Built from the workspace and the 80 newest runs, with Airlock masking. Response: {"spec", "yaml", "endpoints_count"}.
  • openapi/check: {"spec_yaml": "...", "run_id": "..."}. The run’s response must be JSON. Response: {"report": {"matched_method", "matched_path", "matched_status", "valid", "violations"}}.
  • capsules/export: {"run_id": "..."}. Response: {"capsule", "verification", "markdown"}.
  • capsules/verify: {"capsule": ...}. Response: {"verification": {"valid", "hash_matches", "zero_leak_verified", "findings"}}.
  • capsules/reproduce: {"capsule": ..., "base_url": "..."} (optional). Response: {"replay": ...} with the captured status and a diff against the new response.

See Code Scanning, Drift & Branch Diff, OpenAPI & ODCS Contracts and Bug Report Capsules.

Method Path Token Purpose
GET /api/v1/flows no List flow files.
POST /api/v1/flows/run yes Run a flow.
POST /api/v1/load/run yes Run a load test.
POST /api/v1/paginate/run yes Walk a paginated endpoint.
GET /api/v1/mock/status no State of the mock server.
POST /api/v1/mock/start yes Start (or restart) a mock server from recorded runs.
POST /api/v1/mock/stop yes Stop the mock server.
POST /api/v1/mock/export yes Build a mock pack without starting a server.
GET /api/v1/shadow/findings no State and findings of the shadow proxy.
POST /api/v1/shadow/start yes Start (or restart) a shadow proxy.
POST /api/v1/shadow/stop yes Stop the shadow proxy.
  • flows: {"flows": [{"name", "description", "file", "step_count", "waves"}]}.
  • flows/run: {"flow_path": "...", "env": "..."}. flow_path may be an absolute file, a path relative to the workspace root, a flow name (case-insensitive), or a path suffix. 404 “flow <x> not found” otherwise. Steps are recorded in the Flight Recorder. Response: {"report": ...}.
  • load/run: {"request", "env", "config"}. Without config the defaults are concurrency: 10, total_requests: 50. If you pass config, concurrency is required; other fields are total_requests, duration_secs, target_rps, p99_budget_ms, max_error_rate. Response: {"report": ...}. Firewall blocks give 403.
  • paginate/run: {"request", "env", "config"}. config fields and defaults: strategy (auto, link_header, cursor, page_number, offset_limit; default auto), max_pages (5), per_page (25), data_path, cursor_path, page_param (page), per_page_param (per_page), cursor_param (cursor), offset_param (offset), limit_param (limit), airlock (false). Response: {"report": ...}.
  • mock/start: {"port": 0, "airlock": true, "chaos": {...}}. The mock binds 127.0.0.1 on port (0 or absent picks a free port). Any running mock is stopped first. chaos has latency_ms (0), jitter_ms (0), error_rate (0.0), error_status (503). Response: {"active": true, "url", "config", "stats", "pack"}.
  • mock/status: {"active", "url", "config", "stats"}; all null (and active: false) when no mock runs.
  • mock/stop: {"stopped": <was one running>, "active": false}.
  • mock/export: {"airlock": true}. Response: {"pack": ...}.
  • shadow/start: {"primary_url", "candidate_url", "port", "mirror_mutations": false}. Binds 127.0.0.1 on port (free port by default) and uses the workspace volatile_paths. Any running shadow proxy is stopped first. Response: {"active": true, "url", "config", "stats"}.
  • shadow/findings: as above plus findings; findings is [] when no proxy runs.
  • shadow/stop: {"stopped", "active": false}.

The server runs at most one mock server and one shadow proxy at a time. Both stop when the server exits. See Flows, Load Testing, Pagination, Mock Server and Capture Proxy, Shadow & Watch.

Method Path Token Purpose
POST /api/v1/sse/stream yes Read an SSE stream to completion.
POST /api/v1/ws/connect yes Open the WebSocket console session.
POST /api/v1/ws/send yes Send a text frame on the session.
POST /api/v1/ws/close yes Close the session.
GET /api/v1/ws/status no Session state and frame log.
POST /api/v1/graphql/run yes Run a GraphQL operation.
POST /api/v1/graphql/introspect yes Fetch a schema summary.
POST /api/v1/grpc/inspect yes Parse .proto files.
POST /api/v1/grpc/reflect yes List services via server reflection.
POST /api/v1/grpc/call yes Call a unary gRPC method.
  • sse/stream: {"request", "env", "config": {"max_events": 200, "timeout_ms": 15000, "airlock": false}}. Response: {"report": {"events", "assembled_text", "completed", "airlocked", "compliance_receipt", ...}}.
  • ws/connect: {"url", "headers": [{"key","value"}], "env", "airlock": false}. Any open session is closed first; the server keeps one session. Response: {"connected", "url", "airlocked", "frames"}.
  • ws/send: {"message": "..."}. Response: {"sent", "connected", "frames"}. 400 “no active WebSocket connection” without a session.
  • ws/close: {"closed": <was one open>, "connected": false}.
  • ws/status: {"connected", "url", "airlocked", "frames"}. Each frame has seq, direction (sent or received), opcode, payload, is_json, offset_ms, ts_utc.
  • graphql/run: {"request": {"url", "query", "variables", "operation_name", "headers", "auth", "timeout_ms": 15000, "airlock": false}, "env"}. url may use {{variables}}. Response: {"response": ...}.
  • graphql/introspect: {"url", "headers", "auth", "env"}. Response: {"schema": {"query_type", "mutation_type", "subscription_type", "queries", "mutations", "types", "source"}}.
  • grpc/inspect: {"proto_files": [...], "include_dirs": [...]}. Relative paths resolve against the workspace root. Response: {"schema": ...}.
  • grpc/reflect: {"endpoint", "metadata", "auth", "env", "timeout_ms"}. timeout_ms defaults to 10000 and is clamped to 500 through 60000. An unknown env falls back to the default environment. Response: {"reflection": ...}.
  • grpc/call: {"call": {"endpoint", "service", "method", "request_json", "proto_files", "include_dirs", "metadata", "auth", "timeout_ms": 15000, "airlock": false, "use_reflection": false, "descriptor_set_base64"}, "env"}. proto_files and include_dirs resolve against the workspace root. Response: {"response": ...}.

Every protocol route returns 403 if the firewall blocks it and 400 for other failures. See SSE & LLM Streams, WebSocket, GraphQL and gRPC.

Method Path Token Purpose
GET /api/v1/vault/status no Vault state and entry metadata.
POST /api/v1/vault/init yes Create the Age vault.
POST /api/v1/vault/set yes Store a secret.
DELETE /api/v1/vault/{key} yes Delete a secret.
POST /api/v1/vault/recipients yes Add an Age recipient.
GET /api/v1/auth/oauth2/status no Cached OAuth 2.0 token metadata.
POST /api/v1/auth/oauth2/token yes Fetch or refresh a token.
POST /api/v1/auth/oauth2/pkce/start yes Start a browser PKCE login.
GET /api/v1/auth/oauth2/pkce/{session_id} no Poll a PKCE login.
DELETE /api/v1/auth/oauth2/{profile} yes Remove a cached token.
POST /api/v1/auth/sign/preview yes Preview an AWS SigV4 or HMAC signature.

The vault and OAuth routes never return secret or token values. Vault entries carry key, allowed_hosts, allow_query_param, description, updated_at_utc and value_fingerprint; tokens carry token_fingerprint.

  • vault/status: {"status": {"initialized", "unlocked", "entry_count", "local_recipient", "recipients", "providers"}, "entries"}. entries is empty unless the vault is unlocked.
  • vault/init: {"extra_recipients": [...]}. Response: {"status", "entries"}.
  • vault/set: {"key", "value", "allowed_hosts": [], "allow_query_param": false, "description"}. Response: {"entry", "status"}.
  • vault/{key} DELETE: {"deleted", "status"}.
  • vault/recipients: {"recipient": "age1..."}. An invalid recipient gives 400. Response: {"status", "entries"}.
  • oauth2/status: {"profiles": [...]}. Each profile has profile, token_url, token_type, scope, expires_at_utc, is_expired, has_refresh_token, allowed_hosts and token_fingerprint.
  • oauth2/token: {"grant", "token_url", "auth_url", "client_id", "client_secret", "scope", "audience", "profile", "allowed_hosts", "use_pkce": true, "env"}. token_url and client_id are required. grant defaults to client_credentials. refresh_token refreshes the cached token; any other value, including authorization_code, runs the client credentials grant. Response: {"token": <profile metadata>}.
  • oauth2/pkce/start: {"auth_url", "token_url", "client_id", "client_secret", "scope", "audience", "profile", "allowed_hosts", "use_pkce": true, "env", "timeout_secs": 180}. timeout_secs is clamped to 5 through 600. Response: {"session_id", "authorize_url", "redirect_uri"}. Open authorize_url in a browser; a background task waits for the loopback callback and exchanges the code.
  • oauth2/pkce/{session_id}: {"session_id", "state", "authorize_url", "redirect_uri", "token", "error"}. state is pending, completed or failed. Sessions live in memory and are lost when the server stops. 404 for an unknown ID.
  • oauth2/{profile} DELETE: {"deleted": true|false}.
  • sign/preview: {"scheme", "method", "url", "body", "headers", "secret", ...}. scheme aws_sigv4 (any case) uses SigV4 with access_key_id, secret, session_token, region (default us-east-1) and service (default execute-api). Any other scheme uses HMAC with secret, algorithm (sha256 default, or sha512), encoding (hex default, or base64), header_name (default X-Signature), timestamp_header and payload_template (default {timestamp}\n{method}\n{path}\n{body}). method defaults to GET. secret and access_key_id may be secret references, which are resolved first. Response: {"preview": {"scheme", "credential_scope", "canonical_preview", "headers"}}.

See Vault & Secret URIs and Auth & Request Signing.

Method Path Token Purpose
GET /api/v1/network/settings no Current transport settings.
POST /api/v1/network/settings yes Save transport settings and rebuild the HTTP client.
GET /api/v1/network/cookies no List cookies in the jar.
POST /api/v1/network/cookies yes Add or replace a cookie.
DELETE /api/v1/network/cookies yes Delete one cookie, or clear the jar.

Settings are stored per workspace in .recon/network.json:

Field Default
enable_cookies true
proxy.http_proxy, proxy.https_proxy null
proxy.no_proxy []
ca_pem_path null
client_cert_pem_path, client_key_pem_path null
insecure_skip_verify false
  • GET returns {"settings", "cookies_count", "mtls_configured", "custom_ca_configured", "insecure_tls_enabled"}. A password inside a proxy URL is shown as ***.
  • POST takes the settings object. Blank strings become null. If a proxy URL still contains the *** placeholder and matches the stored URL’s host, port and user, the stored password is kept. Certificate and key paths must be given together (400 “provide both client_cert_pem_path and client_key_pem_path for mTLS”). The HTTP client is rebuilt from the new settings before anything is saved; if that fails you get 400 and nothing changes. The new client applies to all following requests. Response: same shape as GET.
  • .recon/network.json holds the proxy password in plain text.
  • cookies GET: {"cookies": [{"name", "value", "domain", "path", "secure", "http_only", "host_only", ...}]}.
  • cookies POST: {"name", "value", "domain", "path": "/", "secure": false, "http_only": false}. A leading . is stripped from domain. Blank name or domain gives 400. Response: {"cookies": [...]}.
  • cookies DELETE: with both domain and name query parameters (and optional path, default /), deletes that cookie and returns {"deleted", "cookies"}. Otherwise clears every cookie and returns {"cleared": true, "cookies": []}.

The cookie jar is in memory only. It is shared by all requests from this server and is kept when you switch workspaces. See Transport: TLS, Proxy & Cookies.

Method Path Token Purpose
GET /api/v1/agent/activity no Recent MCP agent tool calls and policy decisions.
GET /api/v1/agent/approvals no Approval requests.
POST /api/v1/agent/approvals/{id}/decide yes Approve or deny a pending request.
  • activity: query limit (default 50, clamped to 1 through 200). Response: {"activity": [...]}. Each record has seq, id, ts_utc, actor_label, tool_name, request_name, method, env_name, url, decision, reason, run_id, approval_id and airlock_redactions.
  • approvals: query limit (same rules) and status (pending, approved, denied or expired). Response: {"approvals": [...]}. Each record has seq, id, ts_utc, expires_at_utc, actor_label, tool_name, request_name, method, env_name, url, reason, status, decided_by, decided_at_utc and decision_note.
  • decide: {"approved": true|false, "note": "..."}. Records decided_by: "human". Response: {"approval": ...}. 404 “approval <id> not found” for an unknown ID.
$ curl -s -X POST -H "X-Recon-Token: $T" -H 'Content-Type: application/json' http://127.0.0.1:4801/api/v1/agent/approvals/01a22d24-d523-7373-b26d-769392b21d08/decide -d '{"approved":true,"note":"ok from docs run"}'
{"approval":{"actor_label":"mcp-agent","decided_at_utc":"2026-11-30T15:48:39.820641308+00:00","decided_by":"human","decision_note":"ok from docs run","env_name":"local","expires_at_utc":"2026-11-30T15:49:38.307765398+00:00","id":"01a22d24-d523-7373-b26d-769392b21d08","method":"POST","reason":"Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.","request_name":"POST http://127.0.0.1:4801/_sandbox/local/v1/enrollments","seq":1,"status":"approved","tool_name":"recon_send_request","ts_utc":"2026-11-30T15:48:38.307765398+00:00","url":"http://127.0.0.1:4801/_sandbox/local/v1/enrollments"}}

See Agent Policy & Approvals.

Method Path Token Purpose
GET /api/v1/git/status no Branch and dirty files of the workspace repository.
GET /api/v1/git/diff-branch no API diff against a base ref.
  • git/status: {"git": {"is_git_repo", "branch", "head_short", "dirty_files"}}. Outside a repository, is_git_repo is false.
  • git/diff-branch: query base (default main). Response: {"report", "markdown"}. Errors, including “not inside a Git repository”, give 400.

See Drift & Branch Diff.

Method Path Token Purpose
GET /api/v1/workspaces/recent no Current and recent workspaces.
POST /api/v1/workspaces/switch yes Switch the running server to another folder.
POST /api/v1/workspaces/pick yes Show the native folder picker, then switch (desktop only).
  • recent: {"current_root", "current_name", "native_picker_available", "recent": [{"path", "name", "last_opened_utc"}]}. The list comes from recent_workspaces.json in the config directory (RECON_CONFIG_DIR, else $XDG_CONFIG_HOME/recon, else ~/.config/recon; full order in Desktop App), newest first, at most 12 entries.
  • switch: {"path": "..."}. Any existing directory works. The server reloads the workspace, Flight Recorder, mask rules and network settings, clears the cached scan, records the folder in the recent list, and broadcasts workspace_switched. The port and token stay the same. A path that is not a directory gives 400 “path does not exist or is not a directory”; a workspace that fails to load (for example invalid .recon.toml) gives 500. Response: {"switched": true, "root", "name"}.
  • pick: no body. Outside the desktop app it returns 400 “native OS folder picker is only available inside Recon Desktop”. In the desktop app it blocks until the dialog closes; cancelling returns {"picked": false, "switched": false}, choosing a folder returns {"picked": true, "switched": true, "root", "name"}.

Running mock, shadow and WebSocket console sessions, PKCE sessions and the cookie jar are not reset by a switch.

These routes serve fixed demo data and need no token. They are documented in full in Offline Sandboxes.

Method Path
GET /_sandbox/oauth/authorize
POST /_sandbox/oauth/token
GET /_sandbox/{env}/v1/students
GET /_sandbox/{env}/v1/students-paged
GET, POST /_sandbox/{env}/v1/ai/stream
POST /_sandbox/{env}/graphql
GET /_sandbox/ws/echo (WebSocket)
POST /_sandbox/local/v1/enrollments
GET /_sandbox/local/v1/badge.png
GET /_sandbox/local/v1/receipt.pdf

GET /ws upgrades to a WebSocket that pushes JSON text frames. No token is needed. The server ignores anything the client sends, except that a close frame ends the connection.

Each frame has a type field:

type Payload fields Sent when
heartbeat seq: the newest Flight Recorder sequence number Once, right after you connect. It is not repeated.
run_recorded summary: a run summary (same fields as GET /api/v1/runs) A run is recorded by this server, the CLI, the MCP server or any other process writing to the workspace’s Flight Recorder.
workspace_switched root, name The server switched workspaces.
agent_activity activity: an activity record An MCP agent tool call was logged.
agent_approval_requested approval: an approval record with status: "pending" A new pending approval appeared.
agent_approval_resolved approval: the approval record after the decision A pending approval became approved, denied or expired.

Example frames from one session, captured while an MCP agent sent a mutating request and a human approved it:

{"type":"heartbeat","seq":2}
{"type":"agent_activity","activity":{"seq":1,"id":"01a22d24-d524-76d1-9999-5b1eb451a23d","ts_utc":"2026-11-30T15:48:38.308003973+00:00","actor_label":"mcp-agent","tool_name":"recon_send_request","request_name":"POST http://127.0.0.1:4801/_sandbox/local/v1/enrollments","method":"POST","env_name":"local","url":"http://127.0.0.1:4801/_sandbox/local/v1/enrollments","decision":"pending_approval","reason":"Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.","run_id":null,"approval_id":"01a22d24-d523-7373-b26d-769392b21d08","airlock_redactions":0}}
{"type":"agent_approval_requested","approval":{"seq":1,"id":"01a22d24-d523-7373-b26d-769392b21d08","ts_utc":"2026-11-30T15:48:38.307765398+00:00","expires_at_utc":"2026-11-30T15:49:38.307765398+00:00","actor_label":"mcp-agent","tool_name":"recon_send_request","request_name":"POST http://127.0.0.1:4801/_sandbox/local/v1/enrollments","method":"POST","env_name":"local","url":"http://127.0.0.1:4801/_sandbox/local/v1/enrollments","reason":"Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.","status":"pending","decided_by":null,"decided_at_utc":null,"decision_note":null}}
{"type":"agent_approval_resolved","approval":{"seq":1,"id":"01a22d24-d523-7373-b26d-769392b21d08","ts_utc":"2026-11-30T15:48:38.307765398+00:00","expires_at_utc":"2026-11-30T15:49:38.307765398+00:00","actor_label":"mcp-agent","tool_name":"recon_send_request","request_name":"POST http://127.0.0.1:4801/_sandbox/local/v1/enrollments","method":"POST","env_name":"local","url":"http://127.0.0.1:4801/_sandbox/local/v1/enrollments","reason":"Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.","status":"approved","decided_by":"human","decided_at_utc":"2026-11-30T15:48:39.820641308+00:00","decision_note":"ok from docs run"}}
{"type":"agent_approval_resolved","approval":{"seq":1,"id":"01a22d24-d523-7373-b26d-769392b21d08","ts_utc":"2026-11-30T15:48:38.307765398+00:00","expires_at_utc":"2026-11-30T15:49:38.307765398+00:00","actor_label":"mcp-agent","tool_name":"recon_send_request","request_name":"POST http://127.0.0.1:4801/_sandbox/local/v1/enrollments","method":"POST","env_name":"local","url":"http://127.0.0.1:4801/_sandbox/local/v1/enrollments","reason":"Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.","status":"approved","decided_by":"human","decided_at_utc":"2026-11-30T15:48:39.820641308+00:00","decision_note":"ok from docs run"}}
{"type":"run_recorded","summary":{"seq":3,"id":"01a22d24-dc08-7690-a8f6-aa59667fe16d","ts_utc":"2026-11-30T15:48:40.072590318+00:00","actor":"agent","actor_label":"agent","request_id":"mcp-adhoc","request_name":"POST http://127.0.0.1:4801/_sandbox/local/v1/enrollments","env_name":"local","method":"POST","url":"http://127.0.0.1:4801/_sandbox/local/v1/enrollments","status":201,"total_ms":0.591579,"wire_bytes":131,"is_baseline":false,"verified_zero_leak":true}}
...

How events are produced:

  • A background task polls the Flight Recorder every 350 ms. It sends run_recorded for new runs (looking at the 10 newest), agent_activity for new activity rows (up to 25 per poll), and approval events by comparing the 30 newest approvals with what it saw before. That is how activity from other processes, such as recon mcp or recon send, reaches the UI.
  • POST /api/v1/send also sends run_recorded immediately, and POST /api/v1/agent/approvals/{id}/decide also sends agent_approval_resolved immediately. The poll then reports the same item again, so expect duplicates and de-duplicate by id. The capture above shows this for the approval.
  • Approvals already pending when the server starts are announced as agent_approval_requested on the first poll.
  • After a workspace switch, the poller starts from the new workspace’s latest sequence numbers; old rows are not replayed.
  • Events go through an in-memory broadcast channel with room for 128 events. A client that falls further behind silently misses the overflow.

GET / and every unmatched path return the embedded web UI. index.html is served with the session token injected as <meta name="recon-token" content="..."> just before </head>. Other assets are served with a content type guessed from the file extension. If the binary was built without UI assets, the server returns a placeholder page Recon UI assets not built. See Web Studio.