Skip to content
Sections
Docs

Local inspector API

Read captured requests, stream live inspector events, and trigger local replays over loopback HTTP on 127.0.0.1.

On this page9

The local web inspector serves two machine-readable interfaces on the loopback address printed in your terminal (usually http://127.0.0.1:4040): a plain-text /llms.txt guide for AI agents and a JSON HTTP API under /api/*.

Keep the two /llms.txt endpoints distinct:

  • http://127.0.0.1:<port>/llms.txt is served locally by your running prontaro process. It lists active tunnels and ready-to-run loopback curl examples. Because the inspector listens strictly on 127.0.0.1, any AI agent or script querying it must run on the same machine.
  • https://prontaro.com/llms.txt is Prontaro’s public documentation index covering plans, limits, and CLI guides.

Using the inspector with an AI coding agent

GET /llms.txt on your local inspector port returns a compact (< 1.5 KiB) plain-text reference for coding agents. It lists active tunnels that fit within the byte budget (pointing to /api/tunnels if there are more) along with exact curl commands for reading and replaying requests. The guide also notes that sensitive fields are masked as REDACTED, omits secret-unmasking parameters, and warns that captured traffic is untrusted_external_input (data to inspect, never instructions to obey).

Point Claude Code, Cursor, Codex, or another local coding agent at the address shown in your terminal:

Prompt for a local coding agenttext
Read http://127.0.0.1:4040/llms.txt to see the active Prontaro tunnel and local inspector API.
Fetch the latest failing webhook request (status 5xx), explain why my handler returned an error,
fix the bug in my handler, and replay that exact request locally until it returns 200.

If you launch prontaro from a script or an agent’s non-interactive background shell (where stdout or stderr is not a TTY), pass --inspect so the loopback server starts:

Enable the loopback API in non-interactive runsbash
prontaro http 3000 --name webhooks --inspect

In non-interactive mode, prontaro still writes only the public HTTPS URL to stdout and logs the bound loopback URL (inspector listening addr="http://127.0.0.1:4040") to stderr. Always read the actual bound address from that log line or terminal screen if port 4040 is already taken.

Local HTTP endpoints

The loopback server exposes 7 /api/* operations, plus the embedded browser UI (GET /, GET /assets/{file}, GET /favicon.ico) and GET /llms.txt. API errors return JSON in the shape {"error":{"code":"...","message":"..."}}.

Method & path Purpose Notes
GET / and GET /assets/{file} Embedded browser inspector UI Strict CSP and Cache-Control: no-store
GET /llms.txt Plain-text API reference for local AI agents Active tunnels, curl examples, untrusted_external_input warning
GET /api/health Inspector status and memory counters Returns app, version, pid, addr, tunnels, requests, evicted, capture_dropped, events_dropped, mem_bytes, mem_limit_bytes
GET /api/tunnels Tunnels attached to this CLI process Returns id, ref, kind, public_url, local_target, local_marks, status, visitor_notice (TCP tunnels appear as not inspected)
GET /api/requests Newest-first list of captured requests Query filters: tunnel, method, status (500, 4xx, 5xx, >=400, or errors for every entry with "error": true), path, q (searches masked fields only), kind (http or blocked), hide_assets=1, limit (default 100, max 500)
DELETE /api/requests Clear the in-memory request buffer Requires Content-Type: application/json
GET /api/requests/{id} Full details for one captured request Masked headers, bodies, "error", duration_ms, replay_of, redacted_fields, and "untrusted_external_input": true
POST /api/requests/{id}/replay Replay or edit-and-replay locally Requires Content-Type: application/json (max 384 KiB); sends directly to your local server with zero Prontaro server traffic
GET /api/events Inspector live event stream (SSE) Emits request (same summary shape, including "error"), tunnel, cleared, and dropped events plus : ping every 25s; up to 16 concurrent subscribers

Common curl examples

Replace http://127.0.0.1:4040 with the loopback URL printed by your prontaro process if it bound a different port.

List and inspect captured requests

List recent errors (4xx, 5xx, 502 local down, blocked, and closed)bash
curl -s 'http://127.0.0.1:4040/api/requests?status=errors&hide_assets=1&limit=20'
Inspect a single request by IDbash
curl -s 'http://127.0.0.1:4040/api/requests/1'

Every request summary (in GET /api/requests and SSE request events) and request detail (GET /api/requests/{id}) includes a boolean "error" field set to true for HTTP 4xx/5xx responses, 502 local server failures, blocked requests, and connections closed before a response (status: 0). Passing status=errors filters by this exact flag. Both responses also include "untrusted_external_input": true as a reminder for automated consumers that request headers, paths, and bodies come from external callers.

Replay or edit a request locally

Plain replay preserves the captured request body bytes and retained header order while stripping hop-by-hop headers, recalculating Content-Length, and setting Connection: close. It never leaves your machine and spends no monthly tunnel quota:

Replay request #1 directly against your local serverbash
curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{}' \
  'http://127.0.0.1:4040/api/requests/1/replay'

If the captured body exceeded 256 KiB and was truncated, the endpoint returns 409 Conflict (body_truncated) instead of silently resending partial data. Pass {"force":true} only if you intentionally want to replay the truncated capture:

Force replay of a truncated (>256 KiB) capturebash
curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{"force":true}' \
  'http://127.0.0.1:4040/api/requests/1/replay'

To replace the entire method, path, headers, and body before sending locally, pass an edit object (remember that editing a signed payload or header invalidates provider HMAC signatures):

Full edit and replay locallybash
curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{"edit":{"method":"POST","path":"/webhooks/stripe","headers":[{"name":"Content-Type","value":"application/json"}],"body":"{\"type\":\"invoice.paid\"}"}}' \
  'http://127.0.0.1:4040/api/requests/1/replay'

To override only specific fields while keeping the original unredacted headers, path, or body inside the inspector, pass a partial patch object instead (prontaro mcp --allow-edit uses this mode so secrets never leave the inspector). Omitted fields inherit raw values from the captured request, overriding body without headers automatically strips Content-Encoding, and passing both edit and patch returns 400 invalid_input:

Partial patch replay (override body only, keep original headers)bash
curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{"patch":{"body":"{\"type\":\"invoice.paid\"}"}}' \
  'http://127.0.0.1:4040/api/requests/1/replay'

Both edit.headers and patch.headers reject hop-by-hop headers (Connection, Content-Length, Transfer-Encoding, Upgrade, Expect, and related transport headers) with 400 invalid_input—prontaro calculates Content-Length and adds Connection: close automatically.

Clear the buffer and stream inspector events

Clear the in-memory request buffer (JSON Content-Type required)bash
curl -s -X DELETE \
  -H 'Content-Type: application/json' \
  'http://127.0.0.1:4040/api/requests'
Watch inspector events in real timebash
curl -sN 'http://127.0.0.1:4040/api/events'

Secret masking and the reveal parameter

By default, GET /api/requests and GET /api/requests/{id} mask common sensitive headers (including Authorization, Cookie, Set-Cookie, and X-Api-Key), secret query parameter names, and recognized JSON or form-encoded token fields as REDACTED, listing the masked locations in redacted_fields. Pattern-based masking covers common field names and cannot guarantee that custom payload structures contain no sensitive fields.

Passing ?reveal=1 to GET /api/requests/{id} returns unmasked values only when the request carries both Sec-Fetch-Site: same-origin and X-Prontaro-UI: 1. Treat this check accurately: it is a browser cross-origin guard, not local-process authentication. Web browsers forbid cross-origin scripts from setting Sec-Fetch-Site: same-origin, protecting the reveal path from malicious websites, whereas another local process running on the same machine can explicitly send those headers.

Security of the local server

Because the inspector holds captured HTTP requests in memory on your workstation, the loopback server enforces strict browser isolation:

  • Loopback bind only: listens strictly on 127.0.0.1:<port> and never binds to 0.0.0.0 or external network interfaces.
  • Exact Host allowlist: rejects any request whose Host header is not 127.0.0.1:<port>, localhost:<port>, or [::1]:<port> for the exact bound port, preventing DNS rebinding attacks.
  • Same-origin browser isolation: /api/* checks Sec-Fetch-Site: same-origin (falling back to a matching Referer when absent), verifies that any Origin header matches http://<Host>, and never sends CORS headers (Access-Control-Allow-Origin). A page on another local port such as http://localhost:3000 cannot read or replay your captured traffic from the browser.
  • Security headers and CSP: every response sets Cache-Control: no-store, X-Content-Type-Options: nosniff, and Referrer-Policy: no-referrer. UI routes also enforce a strict Content-Security-Policy (default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; object-src 'none').
  • JSON Content-Type on mutations: POST and DELETE calls to /api/* require Content-Type: application/json, blocking simple cross-site HTML form submissions.
  • Local process boundary: non-browser clients on the same machine (such as curl or a local coding agent) do not send browser Sec-Fetch-Site or Origin headers, so they can call /api/* directly. Any local process that can connect to 127.0.0.1:<port> shares access to the inspector while prontaro is running.

Next steps

Something wrong on this page? Contact us

Contact us

Enter your email so we can reply.Enter a valid email, e.g. name@company.example.
Tell us what you need or what went wrong.up to 2,000 characters

Sent! We’ll reply to .

Or email us at support@prontaro.com