This page maps the FastAPI routers to their endpoints, with brief descriptions and auth notes.
Routers Overviewο
zyra.api.routers.cliGET /v1/cli/commandsβ Discovery: stages, commands, and argument schemas (with examples)GET /v1/cli/examplesβ Curated example request bodies and pipelinesPOST /v1/cli/runβ Execute a CLI command (sync or async)GET /examplesβ Interactive examples page (Upload β Run β Download, WS streaming)Auth: Requires API key header when
ZYRA_API_KEYis set (except/docsand/redoc)
zyra.api.routers.searchGET /v1/searchβ Perform discovery across sources (local/profile/OGC); JSON outputGET /v1/search/profilesβ List bundled discovery profilesPOST /searchβ Discovery with JSON body; setanalyze: truefor LLM-assisted summary and picksAuth: Requires API key header when enabled
zyra.api.routers.filesPOST /uploadβ Multipart file upload; returns{file_id, path}Auth: Requires API key header when enabled
Notes: Uploaded files are written under
ZYRA_UPLOAD_DIR(default/tmp/zyra_uploads)
zyra.api.routers.jobsGET /jobs/{job_id}β Job status (stdout, stderr, exit_code, output_file, resolved_input_paths)DELETE /jobs/{job_id}β Cancel a queued jobGET /jobs/{job_id}/manifestβ JSON list of job artifacts (name, path, size, mtime, media_type)GET /jobs/{job_id}/downloadβ Download an artifact; supports?file=NAMEand?zip=1Auth: Requires API key header when enabled
Notes: Results under
ZYRA_RESULTS_DIR/{job_id}; TTL viaZYRA_RESULTS_TTL_SECONDS; periodic prune via cleanup loop
zyra.api.routers.wsWS /ws/jobs/{job_id}β Live JSON messages for logs/progress/final payloadQuery params:
api_key(whenZYRA_API_KEYis set) β requiredstream=stdout,stderr,progressβ filter which keys to stream
Auth: Fail-fast on bad/missing key (closes with code 1008, no data)
Modes: Redis pub/sub or in-memory pub/sub parity
zyra.api.routers.mcpGET /v1/mcp(andOPTIONS /v1/mcp) β MCP discovery payload for MCP clientsPOST /v1/mcpβ JSON-RPC 2.0 endpoint with methods:initialize,statusReport(alias:status/report)tools/list,tools/call(aliases:listTools,callTool)
GET /v1/mcp/progress/{job_id}β Server-Sent Events (SSE) stream for async job progressWS /v1/ws/mcpβ JSON-RPC frames over WebSocket (progress notifications on the same socket)Auth: Header when enabled (HTTP);
?api_key=query param for WS when enabledNotes: Body size limit via
MCP_MAX_BODY_BYTES(bytes). See also/ws/jobs/{job_id}for job streaming.
Domain routers (minimal domain APIs mapping to CLI):
zyra.api.routers.domain_processβPOST /v1/processzyra.api.routers.domain_visualizeβPOST /v1/visualize(alias:/v1/render)zyra.api.routers.domain_assetsβPOST /v1/assetszyra.api.routers.domain_disseminateβPOST /v1/export(aliases:/v1/disseminate, legacy:/v1/decimate)zyra.api.routers.domain_acquireβPOST /v1/import(alias:/v1/acquire)zyra.api.routers.domain_decideβPOST /v1/decide(alias:/v1/optimize)zyra.api.routers.domain_simulateβPOST /v1/simulatezyra.api.routers.domain_narrateβPOST /v1/narratezyra.api.routers.domain_verifyβPOST /v1/verifyzyra.api.routers.domain_transformβPOST /v1/transformBehavior: Validates a domain-specific body (discriminator
tool), normalizes args using CLI schemas, then delegates to/cli/run(sync or async). Async returns{ status: 'accepted', job_id, poll, download, manifest }. Errors return a standardizedvalidation_errororexecution_errorenvelope instead of 422.Limits & logging: Optional
DOMAIN_MAX_BODY_BYTESlimit; structured domain call logs are emitted with timings.
Auth Recapο
HTTP endpoints (CLI, Files, Jobs) require the API key header when configured
WebSocket requires
?api_key=in the URL when configured/examplespage can be gated withZYRA_REQUIRE_KEY_FOR_EXAMPLES=1OpenAPI docs remain readable without a key
System & LLM
GET /v1/healthβ service probeGET /v1/readyβ readiness, includes checks (uploads path, disk, queue, binaries, llm)GET /v1/llm/testβ optional LLM connectivity probe (provider/model resolved from env)
Common Workflowsο
Upload β Run β Download
POST /upload(storefile_id)POST /cli/run(usefile_id:<id>placeholder in args) β async returnsjob_idStream:
ws://.../ws/jobs/{job_id}?api_key=<key>&stream=progressGET /jobs/{job_id}untilstatus=succeeded;GET /jobs/{job_id}/downloadto fetch artifact
Discovery and Examples
GET /cli/commandsfor per-command schemas and examplesGET /cli/examplesfor curated examples; try them in/examples
Environment Variables (selected)ο
Auth:
ZYRA_API_KEY,ZYRA_API_KEY_HEADER,ZYRA_REQUIRE_KEY_FOR_EXAMPLESCORS:
ZYRA_CORS_ALLOW_ALL,ZYRA_CORS_ORIGINSUploads:
ZYRA_UPLOAD_DIRResults:
ZYRA_RESULTS_DIR,ZYRA_RESULTS_TTL_SECONDS,ZYRA_RESULTS_CLEAN_INTERVAL_SECONDSStreaming:
ZYRA_USE_REDIS,ZYRA_REDIS_URL,ZYRA_QUEUEMCP:
ENABLE_MCP(1/0),MCP_MAX_BODY_BYTESDomain:
DOMAIN_MAX_BODY_BYTESRoot/path behind proxies:
API_ROOT_PATH(e.g.,/zyra) β sets FastAPIroot_path; server usesroot_path_in_servers=Trueso OpenAPI and links include the prefix when mounted under a reverse proxy.
Behind a Proxy (tip)ο
Set
API_ROOT_PATHto the mount path (for example,/zyra).Ensure the proxy forwards standard headers (
Host,X-Forwarded-Proto).
Example (nginx):
# .env for Zyra API
API_ROOT_PATH=/zyra
# nginx
location /zyra/ {
proxy_pass http://127.0.0.1:8000/; # note trailing slash
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Notes
The server renders links and OpenAPI under the configured root path.
CORS can be enabled via
CORS_ALLOW_ALL=1orCORS_ORIGINS.