caelum0x 9a411cd22b docs: reconcile stale counts (68 routes, 64 pages, 7 skills) + add /ensemble/live to OpenAPI
Updated FEATURE_MATRIX/API_CLIENTS/WHATS_NEW/API/PRODUCT_OVERVIEW/PRIZE_MAP/api README to the real counts; OpenAPI now 68 paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 17:50:24 +03:00
..

Guardrail Alpha API — OpenAPI Spec

openapi.yaml is an OpenAPI 3.1 document describing the read-only Guardrail Alpha HTTP API. Every documented endpoint is a GET and is side-effect free.

The spec covers all 68 routes currently registered in apps/guardrail-api/src/server.rs — including the newest /journal, /ensemble, /skills, and /version. A human-readable index with sample responses lives in ../API.md.

Viewing the spec

Pick whichever is convenient:

  • Swagger Editor (no install): open https://editor.swagger.io, then File → Import file and select openapi.yaml (or paste its contents into the left pane). The rendered docs and a request explorer appear on the right.

  • Redocly CLI (preview + lint):

    npx @redocly/cli preview-docs docs/api/openapi.yaml   # live preview server
    npx @redocly/cli lint docs/api/openapi.yaml           # validate the spec
    
  • Swagger UI via Docker:

    docker run --rm -p 8081:8080 \
      -e SWAGGER_JSON=/spec/openapi.yaml \
      -v "$(pwd)/docs/api:/spec" swaggerapi/swagger-ui
    # then open http://localhost:8081
    
  • VS Code: install an OpenAPI extension (e.g. "OpenAPI (Swagger) Editor") and open openapi.yaml for inline preview and validation.

The default server is http://localhost:8080. Start the API with:

DATABASE_URL=sqlite://data/guardrail_alpha.db cargo run -p guardrail-api

How this spec is maintained

This document is generated by hand to match apps/guardrail-api/src/server.rs. Paths, query parameters, and rough response shapes were read directly from server.rs and the handler modules (routes/mod.rs, backtest.rs, walkforward.rs, sweep.rs, history.rs, compile.rs). It is not generated from code annotations, so when routes change in server.rs, update openapi.yaml to match.

Response bodies are assembled dynamically from event payloads and run reports, so most responses use a loose object schema (additionalProperties: true). Two endpoints have approximate typed schemas under components.schemas: BacktestResponse (for /backtest) and AlertsResponse (for /alerts). The /metrics endpoint returns Prometheus text/plain, and /report/markdown and /export/submission.md return text/markdown.