Skip to content

Offline Sandboxes

The local server that recon ui (and the desktop app) starts also hosts a set of fake API endpoints under /_sandbox/. They return fixed demo data, need no network access, and are what the demo workspace from recon init --demo talks to. Use them to try Twin-Run, the PII Airlock, the Outbound Secret Firewall, pagination, the protocol consoles and OAuth 2.0 flows without a real backend.

Create the demo workspace and start the server:

$ recon init --demo
{
"demo": true,
"initialized": true,
"workspace": "."
}
$ recon ui --port 4801
Recon UI listening at http://127.0.0.1:4801
Open in your browser: http://127.0.0.1:4801
http://127.0.0.1:4801

(The JSON form appears because output was piped; on a terminal init prints a short human summary.) The demo environments point at port 8787. Use recon ui --port 8787 if you also want the CLI and MCP server to reach the sandboxes; the web UI works on any port (see How the demo workspace points at the sandboxes).

Every sandbox route is a plain HTTP route on the server’s address, so curl works too. The samples on this page come from the server above on port 4801:

$ curl -s http://127.0.0.1:4801/_sandbox/local/v1/students | python3 -m json.tool
{
"environment": "local",
"request_id": "req_1c9cf3173d3042c082feba7c0a4b805b",
"session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzdGFmZl8wMSIsInNjb3BlIjoic2lzOnJlYWQiLCJleHAiOjE4OTM0NTYwMDB9.demo_sig",
"students": [
{
"email": "elena.original@westminster.edu",
"full_name": "Elena Vance-Original",
"gpa": 3.92,
"notes": "Advisor note: email elena.original@westminster.edu before Friday",
"phone": "503-555-0182",
"program": "MDiv",
"ssn": "123-45-6789",
"student_id": "001001"
},
...
]
}

{env} is a free path segment. Most routes echo it back in the response, and the students route switches its shape when it is exactly staging.

Method Path Returns
GET /_sandbox/{env}/v1/students Two student records with PII and a JWT. staging returns a drifted schema.
GET /_sandbox/{env}/v1/students-paged Six students split into pages, with an RFC 5988 Link header.
GET, POST /_sandbox/{env}/v1/ai/stream An OpenAI-style chat completion stream as text/event-stream.
POST /_sandbox/{env}/graphql A fixed GraphQL response, or a small introspection schema.
GET /_sandbox/ws/echo A WebSocket echo server.
GET /_sandbox/oauth/authorize An OAuth 2.0 authorization endpoint that redirects back to a loopback redirect_uri.
POST /_sandbox/oauth/token An OAuth 2.0 token endpoint.
POST /_sandbox/local/v1/enrollments 201 Created with a fixed enrollment record.
GET /_sandbox/local/v1/badge.png A 1x1 PNG image.
GET /_sandbox/local/v1/receipt.pdf A one-page PDF.

The last three routes exist only under local. The sandboxes need no credentials: they ignore Authorization headers and are not covered by the X-Recon-Token check that protects /api/v1/* (see HTTP API).

GET /_sandbox/{env}/v1/students

Returns a JSON object with:

Field Value
request_id req_ followed by a new random UUID on every call.
environment "staging" when {env} is staging, otherwise "local". Any other {env} value gets the local payload.
session_token A fixed unsigned JWT with header {"alg":"HS256","typ":"JWT"} and payload {"sub":"staff_01","scope":"sis:read","exp":1893456000}; the signature part is the literal demo_sig.
students Two records with full_name, email, phone, ssn, gpa, program and notes. The notes of the first record repeats the email address inside free text.

The staging payload differs from local in two ways, which is what Twin-Run reports as schema drift:

local staging
ID key student_id studentId
gpa type number (3.92) string ("3.92")
$ curl -s http://127.0.0.1:4801/_sandbox/staging/v1/students | python3 -m json.tool
{
"environment": "staging",
"request_id": "req_2e2ec858eb314f80a91897f344329b15",
"session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzdGFmZl8wMSIsInNjb3BlIjoic2lzOnJlYWQiLCJleHAiOjE4OTM0NTYwMDB9.demo_sig",
"students": [
{
"email": "elena.original@westminster.edu",
"full_name": "Elena Vance-Original",
"gpa": "3.92",
"notes": "Advisor note: email elena.original@westminster.edu before Friday",
"phone": "503-555-0182",
"program": "MDiv",
"ssn": "123-45-6789",
"studentId": "001001"
},
...
]
}

The request_id changes on every call. The demo workspace lists $.request_id in volatile_paths, so diffs ignore it.

GET /_sandbox/{env}/v1/students-paged

Serves six fixed student records (student_id, full_name, email, program, gpa) one page at a time.

Query parameter Default Rule
page 1 Values below 1 become 1. A page past the end returns an empty students array.
per_page 2 Clamped to 1 through 6.

The body has environment (the raw {env} segment), page, per_page, total_pages and students. While page is less than total_pages, the response carries a relative Link header for the next page:

$ curl -s -i "http://127.0.0.1:4801/_sandbox/local/v1/students-paged"
HTTP/1.1 200 OK
content-type: application/json
link: </_sandbox/local/v1/students-paged?page=2&per_page=2>; rel="next"
content-length: 293
date: Mon, 30 Nov 2026 15:45:15 GMT
{"environment":"local","page":1,"per_page":2,"students":[{"email":"elena@westminster.edu","full_name":"Elena Vance","gpa":3.92,"program":"MDiv","student_id":"001001"},{"email":"marcus@westminster.edu","full_name":"Marcus Cole","gpa":3.74,"program":"MA","student_id":"001002"}],"total_pages":3}

The last page has no Link header. Recon’s pagination explorer detects this as the link_header strategy and fetches all three pages.

GET or POST /_sandbox/{env}/v1/ai/stream

Returns Content-Type: text/event-stream with six data: events in the shape of OpenAI chat completion chunks, then data: [DONE]. The whole body is sent at once. The fourth chunk is the {env} segment, and the fifth contains an email address so the PII Airlock has something to mask. The request body is ignored.

$ curl -s -i "http://127.0.0.1:4801/_sandbox/local/v1/ai/stream"
HTTP/1.1 200 OK
content-type: text/event-stream
content-length: 534
date: Mon, 30 Nov 2026 15:45:18 GMT
data: {"choices":[{"delta":{"content":"Recon "},"index":0}],"id":"chatcmpl_demo"}
data: {"choices":[{"delta":{"content":"live "},"index":0}],"id":"chatcmpl_demo"}
data: {"choices":[{"delta":{"content":"stream ("},"index":0}],"id":"chatcmpl_demo"}
data: {"choices":[{"delta":{"content":"local"},"index":0}],"id":"chatcmpl_demo"}
data: {"choices":[{"delta":{"content":"): elena@westminster.edu"},"index":0}],"id":"chatcmpl_demo"}
data: {"choices":[{"delta":{"content":" verified."},"index":0}],"id":"chatcmpl_demo"}
data: [DONE]

See SSE & LLM Streams for how Recon assembles and masks this stream.

POST /_sandbox/{env}/graphql

The body must be JSON with Content-Type: application/json (otherwise the server returns 415). GET returns 405. Only the query string is read:

  • If query contains the text __schema, the response is a fixed introspection result: a Query type with one field students(program: String): [Student], and a Student type with fields student_id, full_name, email and program. mutationType and subscriptionType are null.
  • Otherwise the response is always the same data object with environment (the {env} segment) and two students with all four fields. The selection set, variables and the program argument are ignored.
$ curl -s -X POST "http://127.0.0.1:4801/_sandbox/local/graphql" -H 'Content-Type: application/json' -d '{"query":"{ students { student_id full_name } }"}'
{"data":{"environment":"local","students":[{"email":"elena.original@westminster.edu","full_name":"Elena Vance-Original","program":"MDiv","student_id":"001001"},{"email":"marcus.real@westminster.edu","full_name":"Marcus Realman","program":"MA","student_id":"001042"}]}}

See GraphQL.

GET /_sandbox/ws/echo (WebSocket upgrade)

On connect the server sends {"banner":"Recon WS Sandbox Echo Ready","connected":true}. For each text frame it replies with a JSON object holding echo (your text), contact (a fixed email address, there to exercise masking) and ts (the current UTC time in RFC 3339). Other frame types are ignored, and a close frame ends the session.

$ node wsecho.mjs ws://127.0.0.1:4801/_sandbox/ws/echo
{"banner":"Recon WS Sandbox Echo Ready","connected":true}
{"contact":"elena@westminster.edu","echo":"hello sandbox","ts":"2026-11-30T15:45:37.170345614+00:00"}

(wsecho.mjs is a short Node script that prints each frame and sends hello sandbox after the banner.) The web UI’s WebSocket console pre-fills this URL. See WebSocket.

POST /_sandbox/oauth/token

Accepts a JSON body or a form-encoded body. If the body parses as JSON, it reads grant_type, client_id and scope from it; otherwise it parses the body as application/x-www-form-urlencoded and reads the same three keys (an empty form scope is ignored). Nothing is validated: no client secret, code, PKCE verifier or refresh token is checked.

Input Default when absent
grant_type client_credentials
client_id demo-client
scope read:students write:enrollments

The response is always 200:

$ curl -s -X POST http://127.0.0.1:4801/_sandbox/oauth/token -d "grant_type=client_credentials&client_id=my-app&scope=read:all"
{
"access_token": "recon_sandbox_tok_my-app_client_credentials",
"expires_in": 3600,
"refresh_token": "recon_sandbox_rt_my-app",
"scope": "read:all",
"token_type": "Bearer"
}

access_token is recon_sandbox_tok_<client_id>_<grant_type> and refresh_token is recon_sandbox_rt_<client_id>. expires_in is always 3600.

GET /_sandbox/oauth/authorize

Reads redirect_uri and state from the query string and redirects (303 See Other) to redirect_uri with code=recon_sandbox_code and the same state appended. No login page is shown. All other parameters, including code_challenge, are ignored.

$ curl -s -i "http://127.0.0.1:4801/_sandbox/oauth/authorize?response_type=code&client_id=x&redirect_uri=http://127.0.0.1:9999/callback&state=abc123"
HTTP/1.1 303 See Other
location: http://127.0.0.1:9999/callback?code=recon_sandbox_code&state=abc123
content-length: 0

redirect_uri must use the http scheme and the host 127.0.0.1 or localhost. Otherwise the endpoint returns 400:

Case Response body
No redirect_uri {"code":"E_BAD_REQUEST","message":"missing `redirect_uri`"}
Not a URL message starts with invalid `redirect_uri`:
Other scheme or host {"code":"E_BAD_REQUEST","message":"sandbox authorize only permits http://127.0.0.1 or http://localhost redirect_uri"}

Together these two endpoints let the browser PKCE login in Auth & Request Signing complete end to end offline: POST /api/v1/auth/oauth2/pkce/start with auth_url set to /_sandbox/oauth/authorize and token_url set to /_sandbox/oauth/token returns an authorize_url; opening it lands on Recon’s loopback callback, and the session moves from pending to completed with a cached token. The web UI’s OAuth form pre-fills both sandbox URLs.

These three routes exist only under /_sandbox/local/.

Route Response
POST /_sandbox/local/v1/enrollments 201 Created, JSON {"course":"CS-401","id":"enr_2026_091","status":"enrolled","student_id":"001001","timestamp":"<now>"}. The request body is ignored.
GET /_sandbox/local/v1/badge.png Content-Type: image/png, a 70-byte 1x1 RGBA PNG.
GET /_sandbox/local/v1/receipt.pdf Content-Type: application/pdf, a 596-byte single-page PDF with the text Recon Local Receipt OK.
$ curl -s -i -X POST "http://127.0.0.1:4801/_sandbox/local/v1/enrollments" -H 'Content-Type: application/json' -d '{"student_id":"x"}'
HTTP/1.1 201 Created
content-type: application/json
content-length: 131
date: Mon, 30 Nov 2026 15:45:18 GMT
{"course":"CS-401","id":"enr_2026_091","status":"enrolled","student_id":"001001","timestamp":"2026-11-30T15:45:18.020453136+00:00"}

The PNG and PDF are for checking binary response handling. When you send them through the server, the run’s raw bytes are kept and served back by GET /api/v1/runs/{id}/body with the original content type.

How the demo workspace points at the sandboxes

Section titled “How the demo workspace points at the sandboxes”

recon init --demo writes these files:

File Contents
environments/local.toml base_url = "http://127.0.0.1:8787/_sandbox/local", secret DEV_API_TOKEN (rk_dev_sandbox_9981, allowed hosts 127.0.0.1 and localhost), secret PROD_STRIPE_KEY (sk_live_demo_firewall_protected, allowed host api.stripe.com only).
environments/staging.toml base_url = "http://127.0.0.1:8787/_sandbox/staging", secret DEV_API_TOKEN (rk_staging_sandbox_4412, allowed hosts 127.0.0.1 and localhost).
collections/campus-demo.http Three requests, listed below.
mask.toml email_domain = "example.edu", date_shift_days = 30, and column rules for email, full_name, ssn, phone, student_id and studentId.
.recon.toml Default config, plus agent_policy.require_approval_for_mutations = true.

The three demo requests:

Name Request What it shows
List Students GET {{base_url}}/v1/students with Authorization: Bearer {{DEV_API_TOKEN}}; asserts status == 200 and $.students[0].program == MDiv Airlock masking, JWT decoding, and Twin-Run drift between local and staging.
Create Enrollment POST {{base_url}}/v1/enrollments; asserts status == 201 A mutating request. Only local has this route.
Stripe Prod Key Leak Check POST {{base_url}}/v1/enrollments with Authorization: Bearer {{PROD_STRIPE_KEY}} The secret firewall blocks it, because the key may only go to api.stripe.com.

The demo URLs hard-code 127.0.0.1:8787. When the server loads the workspace for any /api/v1/* call, it rewrites every plain environment value that starts with http://127.0.0.1:8787/_sandbox/ to use its real bound address. The files on disk do not change. So in the web UI, the desktop app and the HTTP API, the demo works on any port:

$ curl -s http://127.0.0.1:4801/api/v1/workspace | jq '{sandbox_base_url, base_url: .environments.local.base_url}'
{
"sandbox_base_url": "http://127.0.0.1:4801/_sandbox",
"base_url": {
"kind": "plain",
"value": "http://127.0.0.1:4801/_sandbox/local"
}
}

sandbox_base_url in GET /api/v1/workspace always reports the live prefix.

The rewrite happens only inside the server. recon send, recon twin, the MCP server and other CLI commands read the environment files as written and connect to port 8787. To use the demo from the CLI or from an agent, keep a server running with recon ui --port 8787, which is what recon init --demo suggests when it finishes.

Sending Stripe Prod Key Leak Check through the server is refused before any connection is made:

$ REQ=$(curl -s http://127.0.0.1:4801/api/v1/workspace | jq -c '.requests[] | select(.name=="Stripe Prod Key Leak Check")')
$ curl -s -i -X POST -H "X-Recon-Token: $T" -H 'Content-Type: application/json' http://127.0.0.1:4801/api/v1/send -d "{\"request\":$REQ,\"env\":\"local\"}"
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"}]}

$T is the session token (see HTTP API). See Outbound Secret Firewall.

  • All data is hard-coded. Nothing you send is stored, and every call returns the same records (apart from request_id and timestamps).
  • No sandbox route checks authentication or validates input beyond what is listed above.
  • The sandboxes run only while a recon ui server or the desktop app is running. recon mock and the other servers do not host them.
  • They share the server’s loopback address, so they are reachable only from the same machine.
  • Web UI: the protocol consoles pre-fill {{base_url}}/v1/ai/stream, {{base_url}}/graphql and the /_sandbox/ws/echo URL; the OAuth form pre-fills the sandbox OAuth URLs. See Web Studio.
  • Desktop app: the embedded server hosts the same routes. See Desktop App.
  • HTTP API: see HTTP API for the /api/v1/* routes that drive these sandboxes.